diff --git a/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/internal/GradleVersionUtil.groovy b/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/internal/GradleVersionUtil.groovy index 8a2f01299..4e54a32cd 100644 --- a/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/internal/GradleVersionUtil.groovy +++ b/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/internal/GradleVersionUtil.groovy @@ -2,7 +2,6 @@ package com.github.jengelman.gradle.plugins.shadow.internal import org.apache.tools.zip.ZipOutputStream import org.gradle.api.internal.file.copy.CopySpecInternal -import org.gradle.api.tasks.WorkResult import org.gradle.api.tasks.bundling.Jar import org.gradle.api.tasks.bundling.ZipEntryCompression import org.gradle.api.tasks.util.PatternSet @@ -23,20 +22,11 @@ class GradleVersionUtil { ZipCompressor getInternalCompressor(ZipEntryCompression entryCompression, Jar jar) { switch (entryCompression) { case ZipEntryCompression.DEFLATED: - return new DefaultZipCompressor(jar.zip64, ZipOutputStream.DEFLATED); + return new DefaultZipCompressor(jar.zip64, ZipOutputStream.DEFLATED) case ZipEntryCompression.STORED: - return new DefaultZipCompressor(jar.zip64, ZipOutputStream.STORED); + return new DefaultZipCompressor(jar.zip64, ZipOutputStream.STORED) default: - throw new IllegalArgumentException(String.format("Unknown Compression type %s", entryCompression)); - } - } - - @SuppressWarnings("deprecation") - WorkResult getWorkResult(boolean didWork) { - if (version < GradleVersion.version("4.2")) { - return new org.gradle.api.internal.tasks.SimpleWorkResult(didWork) - } else { - org.gradle.api.tasks.WorkResults.didWork(didWork) + throw new IllegalArgumentException(String.format("Unknown Compression type %s", entryCompression)) } } } diff --git a/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/tasks/DefaultInheritManifest.groovy b/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/tasks/DefaultInheritManifest.groovy index 6f1f0b742..59aab7207 100644 --- a/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/tasks/DefaultInheritManifest.groovy +++ b/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/tasks/DefaultInheritManifest.groovy @@ -1,9 +1,11 @@ package com.github.jengelman.gradle.plugins.shadow.tasks +import org.gradle.api.Action import org.gradle.api.internal.file.FileResolver import org.gradle.api.java.archives.Attributes import org.gradle.api.java.archives.Manifest import org.gradle.api.java.archives.ManifestException +import org.gradle.api.java.archives.ManifestMergeSpec import org.gradle.api.java.archives.internal.DefaultManifest import org.gradle.api.java.archives.internal.DefaultManifestMergeSpec import org.gradle.util.ConfigureUtil @@ -88,4 +90,10 @@ class DefaultInheritManifest implements InheritManifest { internalManifest.from(o, closure) return this } + + @Override + Manifest from(Object o, Action action) { + internalManifest.from(o, action) + return this + } } diff --git a/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowCopyAction.groovy b/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowCopyAction.groovy index 8a0940a23..d42b3ee34 100644 --- a/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowCopyAction.groovy +++ b/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/tasks/ShadowCopyAction.groovy @@ -30,6 +30,7 @@ import org.gradle.api.internal.file.copy.CopyActionProcessingStream import org.gradle.api.internal.file.copy.FileCopyDetailsInternal import org.gradle.api.specs.Spec import org.gradle.api.tasks.WorkResult +import org.gradle.api.tasks.WorkResults import org.gradle.api.tasks.bundling.Zip import org.gradle.api.tasks.util.PatternSet import org.gradle.internal.UncheckedException @@ -95,7 +96,7 @@ class ShadowCopyAction implements CopyAction { unusedClasses = Collections.emptySet() } - final ZipOutputStream zipOutStr + ZipOutputStream zipOutStr try { zipOutStr = compressor.createArchiveOutputStream(zipFile) @@ -125,7 +126,7 @@ class ShadowCopyAction implements CopyAction { ) } } - return versionUtil.getWorkResult(true) + return WorkResults.didWork(true) } private void processTransformers(ZipOutputStream stream) {