diff --git a/src/main/groovy/nebula/plugin/info/dependencies/DependenciesInfoPlugin.groovy b/src/main/groovy/nebula/plugin/info/dependencies/DependenciesInfoPlugin.groovy index a5633e8..7d286e2 100644 --- a/src/main/groovy/nebula/plugin/info/dependencies/DependenciesInfoPlugin.groovy +++ b/src/main/groovy/nebula/plugin/info/dependencies/DependenciesInfoPlugin.groovy @@ -18,6 +18,7 @@ package nebula.plugin.info.dependencies import groovy.transform.CompileDynamic import nebula.plugin.info.InfoBrokerPlugin import nebula.plugin.info.InfoCollectorPlugin +import org.gradle.api.Action import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.artifacts.Configuration @@ -38,7 +39,6 @@ class DependenciesInfoPlugin implements Plugin, InfoCollectorPlugin { def dependencyMap = project.rootProject.property('nebulaInfoDependencies') Map dependencies = [:] project.plugins.withType(InfoBrokerPlugin) { InfoBrokerPlugin manifestPlugin -> - processBuildscriptClasspath(project, dependencies) processProjectDependencies(project, dependencies) dependencyMap["${project.name}-dependencies".toString()] = dependencies if (project == project.rootProject) { @@ -47,20 +47,6 @@ class DependenciesInfoPlugin implements Plugin, InfoCollectorPlugin { } } - private void processBuildscriptClasspath(Project project, Map dependencies) { - project.buildscript.configurations.all({ Configuration conf -> - if (canBeResolved(conf)) { - if(conf.getState() == Configuration.State.UNRESOLVED) { - conf.incoming.afterResolve { ResolvableDependencies resolvableDependencies -> - processIncomingDependencies(resolvableDependencies, 'Resolved-Buildscript-Dependencies', dependencies) - } - } else { - processIncomingDependencies(conf.incoming, 'Resolved-Buildscript-Dependencies', dependencies) - } - } - }) - } - private void processProjectDependencies(Project project, Map dependencies) { project.configurations.all({ Configuration conf -> if (canBeResolved(conf)) { diff --git a/src/test/groovy/nebula/plugin/info/InfoPluginIntegrationSpec.groovy b/src/test/groovy/nebula/plugin/info/InfoPluginIntegrationSpec.groovy index fdae4ed..03d8f11 100644 --- a/src/test/groovy/nebula/plugin/info/InfoPluginIntegrationSpec.groovy +++ b/src/test/groovy/nebula/plugin/info/InfoPluginIntegrationSpec.groovy @@ -54,7 +54,7 @@ class InfoPluginIntegrationSpec extends IntegrationSpec { ExecutionResult result = runTasksSuccessfully('assemble') then: - result.standardOutput.contains('{buildscript-singlemodule-test-dependencies={Resolved-Buildscript-Dependencies-Classpath=com.google.guava:guava:21.0, Resolved-Dependencies-CompileClasspath=com.google.guava:guava:18.0}}') + result.standardOutput.contains('{buildscript-singlemodule-test-dependencies={Resolved-Dependencies-CompileClasspath=com.google.guava:guava:18.0}}') } def 'it returns build reports at the end of multiproject build'() { @@ -96,126 +96,7 @@ class InfoPluginIntegrationSpec extends IntegrationSpec { result.standardOutput.contains('common-dependencies={Resolved-Dependencies-CompileClasspath=com.google.guava:guava:18.0}') result.standardOutput.contains('app-dependencies={Resolved-Dependencies-CompileClasspath=com.google.guava:guava:19.0}') } - - def 'it returns build reports at the end of multiproject build - with buildscript classpath info'() { - given: - buildFile << """ - buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath "com.google.guava:guava:21.0" - } - } - - allprojects { - ${applyPlugin(InfoPlugin)} - } - - subprojects { - repositories { mavenCentral() } - } - - def broker = project.plugins.getPlugin(${InfoBrokerPlugin.name}) - - gradle.buildFinished { - println broker.buildReports().get('resolved-dependencies') - } - """.stripIndent() - - settingsFile << """ - rootProject.name='buildscript-multimodule-test' - """ - - def common = addSubproject('common', '''\ - apply plugin: 'java' - dependencies { - implementation 'com.google.guava:guava:18.0' - } - '''.stripIndent()) - writeHelloWorld('nebula.common', common) - def app = addSubproject('app', '''\ - apply plugin: 'java' - dependencies { - implementation 'com.google.guava:guava:19.0' - } - '''.stripIndent()) - writeHelloWorld('nebula.app', app) - - when: - ExecutionResult result = runTasksSuccessfully('build') - - then: - result.standardOutput.contains('buildscript-multimodule-test-dependencies={Resolved-Buildscript-Dependencies-Classpath=com.google.guava:guava:21.0}') - result.standardOutput.contains('common-dependencies={Resolved-Dependencies-CompileClasspath=com.google.guava:guava:18.0}') - result.standardOutput.contains('app-dependencies={Resolved-Dependencies-CompileClasspath=com.google.guava:guava:19.0}') - } - - def 'it returns build reports at the end of multiproject build - with buildscript classpath info - submodule has classpath'() { - given: - buildFile << """ - buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath "com.google.guava:guava:21.0" - } - } - - allprojects { - ${applyPlugin(InfoPlugin)} - } - - subprojects { - repositories { mavenCentral() } - } - - def broker = project.plugins.getPlugin(${InfoBrokerPlugin.name}) - - gradle.buildFinished { - println broker.buildReports().get('resolved-dependencies') - } - """.stripIndent() - - settingsFile << """ - rootProject.name='buildscript-multimodule-test' - """ - - def common = addSubproject('common', '''\ - apply plugin: 'java' - dependencies { - implementation 'com.google.guava:guava:18.0' - } - '''.stripIndent()) - writeHelloWorld('nebula.common', common) - def app = addSubproject('app', '''\ - buildscript { - repositories { - maven { - url "https://plugins.gradle.org/m2/" - } - } - dependencies { - classpath "com.github.jengelman.gradle.plugins:shadow:5.2.0" - } - } - - apply plugin: 'java' - dependencies { - implementation 'com.google.guava:guava:19.0' - } - '''.stripIndent()) - writeHelloWorld('nebula.app', app) - - when: - ExecutionResult result = runTasksSuccessfully('build') - - then: - result.standardOutput.contains('{buildscript-multimodule-test-dependencies={Resolved-Buildscript-Dependencies-Classpath=com.google.guava:guava:21.0}, app-dependencies={Resolved-Buildscript-Dependencies-Classpath=com.github.jengelman.gradle.plugins:shadow:5.2.0,commons-io:commons-io:2.6,org.apache.ant:ant:1.9.7,org.apache.ant:ant-launcher:1.9.7,org.apache.logging.log4j:log4j-api:2.17.1,org.apache.logging.log4j:log4j-core:2.17.1,org.codehaus.plexus:plexus-utils:3.0.24,org.jdom:jdom2:2.0.6,org.ow2.asm:asm:7.0-beta,org.ow2.asm:asm-analysis:7.0-beta,org.ow2.asm:asm-commons:7.0-beta,org.ow2.asm:asm-tree:7.0-beta,org.vafer:jdependency:2.1.1, Resolved-Dependencies-CompileClasspath=com.google.guava:guava:19.0}, common-dependencies={Resolved-Dependencies-CompileClasspath=com.google.guava:guava:18.0}}') - } - + def 'works with jenkins jpi plugin'() { given: buildFile << """