From f08b02010ccae23e224776dfafc347a28aea7c67 Mon Sep 17 00:00:00 2001 From: Christian Stein Date: Wed, 3 Apr 2019 18:07:39 +0200 Subject: [PATCH] Avoid UnusedTracker creation when minimizeJar is not requested Issue #479 --- .../jengelman/gradle/plugins/shadow/tasks/ShadowJar.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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 9918bac2f..d46143627 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 @@ -8,8 +8,6 @@ import com.github.jengelman.gradle.plugins.shadow.transformers.GroovyExtensionModuleTransformer; import com.github.jengelman.gradle.plugins.shadow.transformers.ServiceFileTransformer; import com.github.jengelman.gradle.plugins.shadow.transformers.Transformer; -import groovy.lang.MetaClass; -import org.codehaus.groovy.runtime.InvokerHelper; import org.gradle.api.Action; import org.gradle.api.artifacts.Configuration; import org.gradle.api.file.FileCollection; @@ -77,7 +75,7 @@ public InheritManifest getManifest() { @Override protected CopyAction createCopyAction() { DocumentationRegistry documentationRegistry = getServices().get(DocumentationRegistry.class); - final UnusedTracker unusedTracker = UnusedTracker.forProject(getProject(), configurations, dependencyFilterForMinimize); + final UnusedTracker unusedTracker = minimizeJar ? UnusedTracker.forProject(getProject(), configurations, dependencyFilterForMinimize) : null; return new ShadowCopyAction(getArchivePath(), getInternalCompressor(), documentationRegistry, this.getMetadataCharset(), transformers, relocators, getRootPatternSet(), shadowStats, versionUtil, isPreserveFileTimestamps(), minimizeJar, unusedTracker);