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

Sort entries in output zinc jars #7834

Merged
merged 3 commits into from Jun 2, 2019

Conversation

Projects
None yet
1 participant
@stuhood
Copy link
Member

commented Jun 2, 2019

Problem

The jars produced by the zinc -jar flag were not ending up sorted due to conversion to a Map before writing. Additionally, they contained a duplicate entry (that findbugs would choke on) as an artifact of how relativization was happening.

Solution

Preserve the sorted order that is created by the TreeSet that we collect entries into, and do not create an entry for the "root" directory of the inputs.

Result

Pants is able to consume the -jar option successfully in #7833.

@stuhood

This comment has been minimized.

Copy link
Member Author

commented Jun 2, 2019

#7833 is looking sane and usable while consuming this patch locally, so I'm going to go ahead and land it in order to get a CI burn over there.

@stuhood stuhood merged commit 97b6085 into pantsbuild:master Jun 2, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@stuhood stuhood deleted the twitter:stuhood/zinc-sorted-jar-entries branch Jun 2, 2019

stuhood added a commit that referenced this pull request Jun 5, 2019

Use zinc to create the context jar for zinc and rsc (#7833)
### Problem

We are not currently using `zinc`'s `-jar` option to jar our outputs, which means that in order to use the `--use-classpath-jars` option (without adding a wrapper script) we would need to capture a snapshot of loose output class files, download it, zip it, and then re-upload... which would mostly defeat the purpose of that option. 

### Solution

After fixing a minor issue with `zinc` (#7834), use its `-jar` option to produce the context jar. `javac_compile` continues to use the existing python codepath for this.

In order to continue to inject resources created for annotation processors and compiler plugins, even when the compiler is itself producing the output jar, we now provide the extra_resources as a `Digest` that a compiler should mix in.

### Result

`--use-classpath-jars` can be used with `hermetic` `zinc` and `rsc`.

stuhood added a commit that referenced this pull request Jun 5, 2019

Use zinc to create the context jar for zinc and rsc (#7833)
We are not currently using `zinc`'s `-jar` option to jar our outputs, which means that in order to use the `--use-classpath-jars` option (without adding a wrapper script) we would need to capture a snapshot of loose output class files, download it, zip it, and then re-upload... which would mostly defeat the purpose of that option.

After fixing a minor issue with `zinc` (#7834), use its `-jar` option to produce the context jar. `javac_compile` continues to use the existing python codepath for this.

In order to continue to inject resources created for annotation processors and compiler plugins, even when the compiler is itself producing the output jar, we now provide the extra_resources as a `Digest` that a compiler should mix in.

`--use-classpath-jars` can be used with `hermetic` `zinc` and `rsc`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.