Apply excludes consistently across classpaths

Review Request #2247 - Created May 20, 2015 and submitted

Information
Nick Howard (Twitter)
pants
1562
93cdacb...
Reviewers
pants-reviews
benjyw, fkorotkov, jsirois, patricklaw, tejal, zundel

We ran into an issue with isolated compile and excludes.

  1. compiling a target that excludes a jar that its dependency requires with the isolated strategy without build cache enabled will cause that dependency to fail to compile, because the ivy resolve excludes the jar entirely.
  2. If you use the resolve.ivy --soft-excludes option, then the jar will be resolved. But, it will no longer be excluded from the classpath of the target that excludes it. This can cause runtime issues because the excluded jars may end up on the classpath together with the jars that replace them.

What this change does is
- move classpath manipulations into static helper methods
- filter classpaths for excluded jars after they are constructed everywhere they are constructed

The exclude strategy I've ended up at is to collect all the transitive excludes, convert them into partial file paths, and strip jars that match. This has a behavior that's similar to how the global strategy works.

I ran a test suite that runs into the issues with log4j and log4j-over-slf4j with the changes and saw that tests ran successfully rather than failing to compile or blowing the stack.

I'm also working on a unit test suite and an integration suite.

Issues

  • 2
  • 5
  • 0
  • 7
Description From Last Updated
PyDoc for public and maybe even private methods will be helpfull Fedor Korotkov Fedor Korotkov
Products may by provided by multiple targets... it shouldn't be common, but having two jar_library definitions for the same jar ... Stu Hood Stu Hood
Fedor Korotkov
Fedor Korotkov
Fedor Korotkov
Tejal Desai
Tejal Desai
Nick Howard (Twitter)
Eric Ayers
Fedor Korotkov
Tejal Desai
Nick Howard (Twitter)
Eric Ayers
Benjy Weinberger
Nick Howard (Twitter)
Patrick Lawson
Patrick Lawson
Nick Howard (Twitter)
Review request changed

Status: Closed (submitted)

Change Summary:

https://github.com/pantsbuild/pants/commit/5615199ebb89d8adde5421c9de7a7c5406c304cb

Stu Hood

   
src/python/pants/goal/products.py (Diff revision 8)
 
 
 
 
 
 
 
 
 
 
 

Products may by provided by multiple targets... it shouldn't be common, but having two jar_library definitions for the same jar would do it, for example.

Loading...