1
1
package com.github.jrubygradle.jar
2
2
3
- import com.github.jengelman.gradle.plugins.shadow.internal.GradleVersionUtil
3
+ /*
4
+ * These two internal imports from the Shadow plugin are unavoidable because of
5
+ * the expected internals of ShadowCopyAction
6
+ */
7
+ import com.github.jengelman.gradle.plugins.shadow.internal.DefaultZipCompressor
4
8
import com.github.jengelman.gradle.plugins.shadow.internal.ZipCompressor
9
+
5
10
import com.github.jrubygradle.JRubyPrepare
6
11
import com.github.jrubygradle.jar.internal.JRubyDirInfoTransformer
7
12
import com.github.jrubygradle.jar.internal.JRubyJarCopyAction
8
13
import groovy.transform.PackageScope
14
+ import org.apache.tools.zip.ZipOutputStream
9
15
import org.gradle.api.InvalidUserDataException
10
16
import org.gradle.api.artifacts.Configuration
11
17
import org.gradle.api.file.DuplicatesStrategy
@@ -15,6 +21,7 @@ import org.gradle.api.tasks.Internal
15
21
import org.gradle.api.tasks.Optional
16
22
import org.gradle.api.tasks.StopExecutionException
17
23
import org.gradle.api.tasks.bundling.Jar
24
+ import org.gradle.api.tasks.bundling.ZipEntryCompression
18
25
19
26
/**
20
27
* JRubyJar creates a Java Archive with Ruby code packed inside of it.
@@ -240,7 +247,6 @@ class JRubyJar extends Jar {
240
247
appendix = ' jruby'
241
248
/* Make sure our default configuration is present regardless of whether we use it or not */
242
249
prepareTask = project. task(" prepare${ prepareNameForSuffix(name)} " , type : JRubyPrepare )
243
- versionUtil = new GradleVersionUtil (getProject(). getGradle(). getGradleVersion())
244
250
dependsOn prepareTask
245
251
246
252
// TODO get rid of this and try to adjust the CopySpec for the gems
@@ -297,7 +303,6 @@ class JRubyJar extends Jar {
297
303
[new JRubyDirInfoTransformer ()], /* transformers */
298
304
[], /* relocators */
299
305
mainSpec. buildRootResolver(). getPatternSet(), /* patternSet */
300
- versionUtil, /* util */
301
306
false , /* preserveFileTimestamps */
302
307
false , /* minimizeJar */
303
308
null /* unusedTracker */
@@ -307,7 +312,14 @@ class JRubyJar extends Jar {
307
312
308
313
@Internal
309
314
protected ZipCompressor getInternalCompressor () {
310
- return versionUtil. getInternalCompressor(getEntryCompression(), this )
315
+ switch (entryCompression) {
316
+ case ZipEntryCompression . DEFLATED :
317
+ return new DefaultZipCompressor (this . zip64, ZipOutputStream . DEFLATED )
318
+ case ZipEntryCompression . STORED :
319
+ return new DefaultZipCompressor (this . zip64, ZipOutputStream . STORED )
320
+ default :
321
+ throw new IllegalArgumentException (String . format(' Unknown Compression type %s' , entryCompression))
322
+ }
311
323
}
312
324
313
325
/**
@@ -329,5 +341,4 @@ class JRubyJar extends Jar {
329
341
protected String embeddedJRubyMainsVersion = DEFAULT_JRUBY_MAINS
330
342
protected String jarConfiguration = DEFAULT_JRUBYJAR_CONFIG
331
343
protected String jarMainClass
332
- protected GradleVersionUtil versionUtil
333
344
}
0 commit comments