Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zip entry actions #333

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

johkelly
Copy link

A more general implementation of #246 , motivated by the same desire to have shadow jars that play nice with rsync. This implementation pushes a list of Action<ZipEntry> into the ZipOutputStream code so that all processed ZipEntrys can be run against them.

Arbitrary actions can be written in the build.gradle:

shadowJar{
    modifyZipEntries { ze ->
        println ze.hashCode()
        ze.setName("mutatedName")
        // ...
    }
}

And the motivating action has a sugared form:

shadowJar{
    zeroZipEntryTimestamps()
}

I'm a coworker of the requester for #246 , and lifted some of his comments and test code.

This is motivated by wanting to zero timestamps on entries for byte-stable
shadow jars, but generalized in case other uses are created.
@@ -100,6 +103,11 @@ public ShadowJar dependencies(Action<DependencyFilter> c) {
return this;
}

public ShadowJar entryAction(Action<ZipEntry> action) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're gonna need to make our own 1st class citizen for ZipEntry. We can't expose the apache classes as part of the public API for shadow because those classes are relocated during packaging.

But overall this PR looks good. I'll likely merge it this way and then figure out the stuff above.

@johnrengelman johnrengelman added this to the 2.1.0 milestone Nov 4, 2017
@johnrengelman
Copy link
Collaborator

This work will go into a 2.1.0 build since it's adding new public API.

@johnrengelman johnrengelman modified the milestones: 4.0.0, 5.0.0 Sep 16, 2018
@johnrengelman johnrengelman removed this from the 5.0.0 milestone Jan 20, 2019
@Goooler Goooler deleted the branch GradleUp:main July 28, 2024 13:54
@Goooler Goooler closed this Jul 28, 2024
@Goooler Goooler reopened this Jul 28, 2024
@Goooler Goooler changed the base branch from master to main July 28, 2024 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants