Loading sources/src/resources/init-scripts/gradle-actions.github-dependency-graph-gradle-plugin-apply.groovy +17 −1 Changes for sources/src/resources/init-scripts/gradle-actions.github-dependency-graph-gradle-plugin-apply.groovy: 17 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -4,13 +4,29 @@ buildscript { return System.getProperty(name) ?: System.getenv(envVarName) } def pluginRepositoryUrl = getInputParam('gradle.plugin-repository.url') ?: 'https://plugins.gradle.org/m2' def pluginRepositoryUsername = getInputParam('gradle.plugin-repository.username') def pluginRepositoryPassword = getInputParam('gradle.plugin-repository.password') def dependencyGraphPluginVersion = getInputParam('dependency-graph-plugin.version') ?: '1.2.2' logger.lifecycle("Resolving dependency graph plugin ${dependencyGraphPluginVersion} from plugin repository: ${pluginRepositoryUrl}") repositories { maven { url pluginRepositoryUrl } maven { url pluginRepositoryUrl if (pluginRepositoryUsername && pluginRepositoryPassword) { logger.lifecycle("Applying credentials for plugin repository: ${pluginRepositoryUrl}") credentials { username(pluginRepositoryUsername) password(pluginRepositoryPassword) } authentication { basic(BasicAuthentication) } } } } dependencies { classpath "org.gradle:github-dependency-graph-gradle-plugin:${dependencyGraphPluginVersion}" } } apply plugin: org.gradle.github.GitHubDependencyGraphPlugin sources/test/init-scripts/src/test/groovy/com/gradle/gradlebuildaction/TestDependencyGraph.groovy +36 −1 Changes for sources/test/init-scripts/src/test/groovy/com/gradle/gradlebuildaction/TestDependencyGraph.groovy: 36 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ class TestDependencyGraph extends BaseInitScriptTest { assert reportFile.exists() where: testGradleVersion << [GRADLE_8_X] testGradleVersion << DEPENDENCY_GRAPH_VERSIONS } def "produces dependency graph with configuration-cache on latest Gradle"() { Loading Loading @@ -127,6 +127,41 @@ class TestDependencyGraph extends BaseInitScriptTest { testGradleVersion << DEPENDENCY_GRAPH_VERSIONS } def "can configure alternative repository for plugins"() { assumeTrue testGradleVersion.compatibleWithCurrentJvm when: def vars = envVars vars.put('GRADLE_PLUGIN_REPOSITORY_URL', 'https://plugins.grdev.net/m2') def result = run(['help', '--info'], initScript, testGradleVersion.gradleVersion, [], vars) then: assert reportFile.exists() assert result.output.contains("Resolving dependency graph plugin 1.2.2 from plugin repository: https://plugins.grdev.net/m2") where: testGradleVersion << DEPENDENCY_GRAPH_VERSIONS } def "can provide credentials for alternative repository for plugins"() { assumeTrue testGradleVersion.compatibleWithCurrentJvm when: def vars = envVars vars.put('GRADLE_PLUGIN_REPOSITORY_URL', 'https://plugins.grdev.net/m2') vars.put('GRADLE_PLUGIN_REPOSITORY_USERNAME', 'REPO_USER') vars.put('GRADLE_PLUGIN_REPOSITORY_PASSWORD', 'REPO_PASSWORD') def result = run(['help', '--info'], initScript, testGradleVersion.gradleVersion, [], vars) then: assert reportFile.exists() assert result.output.contains("Resolving dependency graph plugin 1.2.2 from plugin repository: https://plugins.grdev.net/m2") assert result.output.contains("Applying credentials for plugin repository: https://plugins.grdev.net/m2") where: testGradleVersion << DEPENDENCY_GRAPH_VERSIONS } def getEnvVars() { return [ GITHUB_DEPENDENCY_GRAPH_ENABLED: "true", Loading Loading
sources/src/resources/init-scripts/gradle-actions.github-dependency-graph-gradle-plugin-apply.groovy +17 −1 Changes for sources/src/resources/init-scripts/gradle-actions.github-dependency-graph-gradle-plugin-apply.groovy: 17 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -4,13 +4,29 @@ buildscript { return System.getProperty(name) ?: System.getenv(envVarName) } def pluginRepositoryUrl = getInputParam('gradle.plugin-repository.url') ?: 'https://plugins.gradle.org/m2' def pluginRepositoryUsername = getInputParam('gradle.plugin-repository.username') def pluginRepositoryPassword = getInputParam('gradle.plugin-repository.password') def dependencyGraphPluginVersion = getInputParam('dependency-graph-plugin.version') ?: '1.2.2' logger.lifecycle("Resolving dependency graph plugin ${dependencyGraphPluginVersion} from plugin repository: ${pluginRepositoryUrl}") repositories { maven { url pluginRepositoryUrl } maven { url pluginRepositoryUrl if (pluginRepositoryUsername && pluginRepositoryPassword) { logger.lifecycle("Applying credentials for plugin repository: ${pluginRepositoryUrl}") credentials { username(pluginRepositoryUsername) password(pluginRepositoryPassword) } authentication { basic(BasicAuthentication) } } } } dependencies { classpath "org.gradle:github-dependency-graph-gradle-plugin:${dependencyGraphPluginVersion}" } } apply plugin: org.gradle.github.GitHubDependencyGraphPlugin
sources/test/init-scripts/src/test/groovy/com/gradle/gradlebuildaction/TestDependencyGraph.groovy +36 −1 Changes for sources/test/init-scripts/src/test/groovy/com/gradle/gradlebuildaction/TestDependencyGraph.groovy: 36 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -36,7 +36,7 @@ class TestDependencyGraph extends BaseInitScriptTest { assert reportFile.exists() where: testGradleVersion << [GRADLE_8_X] testGradleVersion << DEPENDENCY_GRAPH_VERSIONS } def "produces dependency graph with configuration-cache on latest Gradle"() { Loading Loading @@ -127,6 +127,41 @@ class TestDependencyGraph extends BaseInitScriptTest { testGradleVersion << DEPENDENCY_GRAPH_VERSIONS } def "can configure alternative repository for plugins"() { assumeTrue testGradleVersion.compatibleWithCurrentJvm when: def vars = envVars vars.put('GRADLE_PLUGIN_REPOSITORY_URL', 'https://plugins.grdev.net/m2') def result = run(['help', '--info'], initScript, testGradleVersion.gradleVersion, [], vars) then: assert reportFile.exists() assert result.output.contains("Resolving dependency graph plugin 1.2.2 from plugin repository: https://plugins.grdev.net/m2") where: testGradleVersion << DEPENDENCY_GRAPH_VERSIONS } def "can provide credentials for alternative repository for plugins"() { assumeTrue testGradleVersion.compatibleWithCurrentJvm when: def vars = envVars vars.put('GRADLE_PLUGIN_REPOSITORY_URL', 'https://plugins.grdev.net/m2') vars.put('GRADLE_PLUGIN_REPOSITORY_USERNAME', 'REPO_USER') vars.put('GRADLE_PLUGIN_REPOSITORY_PASSWORD', 'REPO_PASSWORD') def result = run(['help', '--info'], initScript, testGradleVersion.gradleVersion, [], vars) then: assert reportFile.exists() assert result.output.contains("Resolving dependency graph plugin 1.2.2 from plugin repository: https://plugins.grdev.net/m2") assert result.output.contains("Applying credentials for plugin repository: https://plugins.grdev.net/m2") where: testGradleVersion << DEPENDENCY_GRAPH_VERSIONS } def getEnvVars() { return [ GITHUB_DEPENDENCY_GRAPH_ENABLED: "true", Loading