Skip to content

Commit

Permalink
(fix) Required compile changes for Gradle 5
Browse files Browse the repository at this point in the history
  • Loading branch information
John Engelman committed Jan 19, 2019
1 parent 3415428 commit 62c4ecb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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))
}
}
}
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -88,4 +90,10 @@ class DefaultInheritManifest implements InheritManifest {
internalManifest.from(o, closure)
return this
}

@Override
Manifest from(Object o, Action<ManifestMergeSpec> action) {
internalManifest.from(o, action)
return this
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -95,7 +96,7 @@ class ShadowCopyAction implements CopyAction {
unusedClasses = Collections.emptySet()
}

final ZipOutputStream zipOutStr
ZipOutputStream zipOutStr

try {
zipOutStr = compressor.createArchiveOutputStream(zipFile)
Expand Down Expand Up @@ -125,7 +126,7 @@ class ShadowCopyAction implements CopyAction {
)
}
}
return versionUtil.getWorkResult(true)
return WorkResults.didWork(true)
}

private void processTransformers(ZipOutputStream stream) {
Expand Down

0 comments on commit 62c4ecb

Please sign in to comment.