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

stuhood
Copy link
Sponsor Member

@stuhood stuhood 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
Copy link
Sponsor Member Author

stuhood 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
@stuhood stuhood deleted the stuhood/zinc-sorted-jar-entries branch June 2, 2019 05:56
stuhood added a commit that referenced this pull request Jun 5, 2019
### 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
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant