[classpath products] introduce ResolvedJar and M2Coordinate and use them for improved exclude handling

Review Request #2654 - Created Aug. 18, 2015 and submitted

Nick Howard (Twitter)
jsirois, stuhood, zundel

This change removes a TODO around exclude matching where we were using string contents comparisons. Now, we compare org and name as opaque values as pulled from the excludes defined on targets.
It also moves towards the refactoring described in [1], since this is a clear place where that could be used effectively. My thought is that by stepping into this in a constrained way, we can start migrating towards a model that looks like that internally. It should also make it easier make the next step.

  • pants.backend.jvm.jar_dependency_utils contains ResolvedJar and M2Coordinate
  • ivy_utils is updated to return ResolvedJars instead of IvyModules
  • ivy_utils will also throw an error if there are multiple org:name#classifier tuples associated with an artifact
  • ClasspathProducts now has add_jars_for_target / add_jars_for_targets that accepts ResolvedJars
  • ivy_resolve patches up the ResolvedJars with the symlink mappings for them after they've been resolved

The new behavior in this transitional place is that excludes are not applied to non-resolved path elements anymore. I think this is probably a good thing, since those tend to be either class directories, or other classpath entries not managed by resolve.

Follow on work

  • improve excludes behavior generally. I'm working on this next, as there are cases in our repo where the current behavior is tricky to understand and apply correctly. I'll be posting a doc about it soon.
  • step into consolidating ivy conf usages so that they can be removed safely
  • clean up usages of adding string based elements to classpaths. (I didn't do it with this commit, because there's a large number of tests that would be affected in ways that would obscure things)

  1. https://docs.google.com/document/d/1sEMXUmj7v-YCBZ_wHLpCFjkHOeWjsc1NR1hRIJ9uCZ8/edit#heading=h.8mden3kdj1co

passing CI https://github.com/pantsbuild/pants/pull/2007. I also did some smoke testing against our internal repo.


  • 0
  • 3
  • 1
  • 4
Description From Last Updated
Eric Ayers
Eric Ayers
Andy Reitz
Stu Hood
Andy Reitz
Eric Ayers
Eric Ayers
Nick Howard (Twitter)
Nick Howard (Twitter)
Review request changed

Status: Closed (submitted)