jar-tool properly skipping Manifest file using entry's jarPath

Review Request #3437 - Created Feb. 8, 2016 and submitted

Information
Peiyu Wang
pants
2899
Reviewers
pants-reviews
gmalmquist, jsirois, stuhood, zundel

Since entryPath=="MANIFEST.MF", the check for
JarFile.MANIFEST_NAME.equals(entryPath) will always be false, instead we
should check entry's jarPath, i.e, the path that's to be written into the jar.

This is surfaced by an uncommon new use case: some applications like scalding
need two main functions in their jars. The second main is supplied as a
MANIFEST.MF resource.

Now when running binary, -files contains /path/to/META-INF/=META-INF/,
manifest.mf is not skipped because of the above, and results
duplicate entry: META-INF/MANIFEST.MF error.

Note: for binary, skipping the 2nd manifest is the appropriate action. Because
there is only one manifest/main for the binary jar. For bundle, this code path
is not executed because we only generated synthetic classpath now.

https://travis-ci.org/peiyuwang/pants/builds/107703027 passed

Peiyu Wang
Peiyu Wang
Stu Hood
Garrett Malmquist
Peiyu Wang
Review request changed

Status: Closed (submitted)

Change Summary:

submitted as 56bf0251aae8f66913772439fcd6520d3d7e7a56

Loading...