Class ParallelZip

java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
org.gradle.api.internal.ConventionTask
org.gradle.api.tasks.AbstractCopyTask
org.gradle.api.tasks.bundling.AbstractArchiveTask
com.ljarocki.parallelzip.ParallelZip
All Implemented Interfaces:
Comparable<org.gradle.api.Task>, org.gradle.api.file.ContentFilterable, org.gradle.api.file.CopyProcessingSpec, org.gradle.api.file.CopySourceSpec, org.gradle.api.file.CopySpec, org.gradle.api.internal.DynamicObjectAware, org.gradle.api.internal.file.copy.CopySpecSource, org.gradle.api.internal.IConventionAware, org.gradle.api.internal.TaskInternal, org.gradle.api.Named, org.gradle.api.plugins.ExtensionAware, org.gradle.api.Task, org.gradle.api.tasks.util.PatternFilterable, org.gradle.util.Configurable<org.gradle.api.Task>

public abstract class ParallelZip extends org.gradle.api.tasks.bundling.AbstractArchiveTask
A drop-in replacement for Gradle's Zip task that compresses entries in parallel.

Because it extends AbstractArchiveTask it accepts the full CopySpec DSL — from / into / include / exclude / rename / filter / duplicatesStrategy, nesting, and the archiveFileName / destinationDirectory conventions — exactly like Zip. Swapping type: Zip for type: ParallelZip needs no other changes.

 tasks.register('dist', ParallelZip) {
     from 'build/staging'
     into 'myapp-1.0'
     archiveFileName = 'dist.zip'
     destinationDirectory = layout.buildDirectory
     store = false               // true = STORE everything (fastest, ~7% larger)
     skipAlreadyCompressed = true    // false = always attempt DEFLATE, 1.3.x-like size
     level = 6                   // DEFLATE level 0..9 (ignored when store = true)
     threads = 12                // default: available processors
     preserveFileTimestamps = false   // inherited; false = reproducible archive
 }
 
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.gradle.api.Task

    org.gradle.api.Task.Namer
  • Field Summary

    Fields inherited from interface org.gradle.api.Task

    TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected org.gradle.api.internal.file.copy.CopyAction
     
    abstract org.gradle.api.provider.Property<Integer>
    DEFLATE level 0..9, or -1 for the zlib default (6).
    abstract org.gradle.api.provider.Property<Boolean>
    When true (the default), an entry recognized by file-signature as already compressed (jars, gzip, images, and more -- see ARCHITECTURE.md) is STORED without even attempting DEFLATE.
    abstract org.gradle.api.provider.Property<Boolean>
    When true, every entry is STORED (no compression).
    abstract org.gradle.api.provider.Property<Integer>
    Number of compression threads.

    Methods inherited from class org.gradle.api.tasks.bundling.AbstractArchiveTask

    createCopyActionExecuter, getArchiveAppendix, getArchiveBaseName, getArchiveClassifier, getArchiveExtension, getArchiveFile, getArchiveFileName, getArchivePath, getArchiveVersion, getDestinationDirectory, into, into, into, isPreserveFileTimestamps, isReproducibleFileOrder, setPreserveFileTimestamps, setReproducibleFileOrder

    Methods inherited from class org.gradle.api.tasks.AbstractCopyTask

    copy, createRootSpec, dirPermissions, eachFile, eachFile, exclude, exclude, exclude, exclude, expand, expand, filePermissions, filesMatching, filesMatching, filesNotMatching, filesNotMatching, filter, filter, filter, filter, from, from, from, getDirectoryFileTreeFactory, getDirMode, getDirPermissions, getDocumentationRegistry, getDuplicatesStrategy, getExcludes, getFileLookup, getFileMode, getFilePermissions, getFileResolver, getFileSystem, getFilteringCharset, getIncludeEmptyDirs, getIncludes, getInstantiator, getMainSpec, getObjectFactory, getPropertyFactory, getRootSpec, getSource, include, include, include, include, isCaseSensitive, rename, rename, rename, rename, setCaseSensitive, setDirMode, setDuplicatesStrategy, setExcludes, setFileMode, setFilteringCharset, setIncludeEmptyDirs, setIncludes, with

    Methods inherited from class org.gradle.api.internal.ConventionTask

    conventionMapping, conventionMapping, getConventionMapping

    Methods inherited from class org.gradle.api.DefaultTask

    compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesService

    Methods inherited from class org.gradle.api.internal.AbstractTask

    acceptServiceReferences, appendParallelSafeAction, doNotTrackState, getAsDynamicObject, getConvention, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, setImpliesSubProjects

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.gradle.api.Task

    doNotTrackState, getConvention, notCompatibleWithConfigurationCache
  • Constructor Details

    • ParallelZip

      public ParallelZip()
  • Method Details

    • getStore

      @Input @Optional public abstract org.gradle.api.provider.Property<Boolean> getStore()
      When true, every entry is STORED (no compression). Default: false.
    • getLevel

      @Input @Optional public abstract org.gradle.api.provider.Property<Integer> getLevel()
      DEFLATE level 0..9, or -1 for the zlib default (6). Ignored when getStore() is true.
    • getSkipAlreadyCompressed

      @Input @Optional public abstract org.gradle.api.provider.Property<Boolean> getSkipAlreadyCompressed()
      When true (the default), an entry recognized by file-signature as already compressed (jars, gzip, images, and more -- see ARCHITECTURE.md) is STORED without even attempting DEFLATE. Set to false to always attempt DEFLATE regardless of signature -- matching 1.3.x's behavior, which relied only on the statistical incompressibility sniff (still active either way). Trades some of 1.4.0's speed win back for a smaller archive closer to 1.3.x's size.
    • getThreads

      @Internal public abstract org.gradle.api.provider.Property<Integer> getThreads()
      Number of compression threads. Default: available processors. Marked @Internal because it does not affect the archive bytes (output is identical for any thread count), so changing it must not invalidate the task's up-to-date state.
    • createCopyAction

      protected org.gradle.api.internal.file.copy.CopyAction createCopyAction()
      Specified by:
      createCopyAction in class org.gradle.api.tasks.AbstractCopyTask