diff --git a/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/internal/AbstractDependencyFilter.groovy b/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/internal/AbstractDependencyFilter.groovy index ca497e559..bbe92df7d 100644 --- a/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/internal/AbstractDependencyFilter.groovy +++ b/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/internal/AbstractDependencyFilter.groovy @@ -2,7 +2,6 @@ package com.github.jengelman.gradle.plugins.shadow.internal import groovy.util.logging.Slf4j import org.gradle.api.Project -import org.gradle.api.artifacts.Configuration import org.gradle.api.artifacts.Dependency import org.gradle.api.artifacts.ResolvedDependency import org.gradle.api.file.FileCollection @@ -25,7 +24,7 @@ abstract class AbstractDependencyFilter implements DependencyFilter { Set includedDependencies, Set excludedDependencies) - FileCollection resolve(Configuration configuration) { + FileCollection resolve(FileCollection configuration) { Set includedDeps = [] Set excludedDeps = [] resolve(configuration.resolvedConfiguration.firstLevelModuleDependencies, includedDeps, excludedDeps) @@ -34,7 +33,7 @@ abstract class AbstractDependencyFilter implements DependencyFilter { }.flatten()) } - FileCollection resolve(Collection configurations) { + FileCollection resolve(Collection configurations) { configurations.collect { resolve(it) }.sum() as FileCollection ?: project.files() diff --git a/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/internal/DependencyFilter.groovy b/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/internal/DependencyFilter.groovy index b2c072cfa..e8f6d4644 100644 --- a/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/internal/DependencyFilter.groovy +++ b/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/internal/DependencyFilter.groovy @@ -1,6 +1,5 @@ package com.github.jengelman.gradle.plugins.shadow.internal -import org.gradle.api.artifacts.Configuration import org.gradle.api.artifacts.Dependency import org.gradle.api.artifacts.ResolvedDependency import org.gradle.api.file.FileCollection @@ -9,18 +8,18 @@ import org.gradle.api.specs.Spec interface DependencyFilter { /** - * Resolve a Configuration against the include/exclude rules in the filter + * Resolve a FileCollection against the include/exclude rules in the filter * @param configuration * @return */ - FileCollection resolve(Configuration configuration) + FileCollection resolve(FileCollection configuration) /** - * Resolve all Configurations against the include/exclude ruels in the filter and combine the results + * Resolve all FileCollections against the include/exclude ruels in the filter and combine the results * @param configurations * @return */ - FileCollection resolve(Collection configurations) + FileCollection resolve(Collection configurations) /** * Exclude dependencies that match the provided spec. diff --git a/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowJar.java b/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowJar.java index 739b75043..1b42c6b94 100644 --- a/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowJar.java +++ b/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowJar.java @@ -31,7 +31,7 @@ public class ShadowJar extends Jar implements ShadowSpec { private List transformers; private List relocators; - private transient List configurations; + private List configurations; private transient DependencyFilter dependencyFilter; private boolean minimizeJar; @@ -429,11 +429,11 @@ public void setRelocators(List relocators) { } @Classpath @Optional - public List getConfigurations() { + public List getConfigurations() { return this.configurations; } - public void setConfigurations(List configurations) { + public void setConfigurations(List configurations) { this.configurations = configurations; } diff --git a/src/test/groovy/com/github/jengelman/gradle/plugins/shadow/ConfigurationCacheSpec.groovy b/src/test/groovy/com/github/jengelman/gradle/plugins/shadow/ConfigurationCacheSpec.groovy index 97b3eb9b2..0dfe14e38 100644 --- a/src/test/groovy/com/github/jengelman/gradle/plugins/shadow/ConfigurationCacheSpec.groovy +++ b/src/test/groovy/com/github/jengelman/gradle/plugins/shadow/ConfigurationCacheSpec.groovy @@ -132,4 +132,38 @@ class ConfigurationCacheSpec extends PluginSpecification { and: result.output.contains("Reusing configuration cache.") } + + def "configuration caching of configurations is up-to-date"() { + given: + file('settings.gradle') << """ + include 'lib' + """.stripIndent() + + and: + file('lib/src/main/java/lib/Lib.java') << """ + package lib; + public class Lib {} + """.stripIndent() + file('lib/build.gradle') << """ + apply plugin: 'java' + apply plugin: 'com.github.johnrengelman.shadow' + + repositories { maven { url "${repo.uri}" } } + dependencies { + implementation "junit:junit:3.8.2" + } + + shadowJar { + configurations = [project.configurations.compileClasspath] + } + + """.stripIndent() + + when: + run('--configuration-cache', 'shadowJar', '-s') + def result = run('--configuration-cache', 'shadowJar', '-s') + + then: + result.output.contains(":lib:shadowJar UP-TO-DATE") + } }