Requiring explicit dependency on the DistributionLocator subsystem.

Review Request #2707 - Created Aug. 26, 2015 and submitted

Information
Garrett Malmquist
pants
gmalmquist/untangle-executor-distribution
2072
68da441...
Reviewers
pants-reviews
benjyw, jsirois, stuhood, zundel

This includes adding DistributionLocator as subsystem dependency of
IvySubsystem, and requiring a distribution input to execute_java in
pants.java.util.

The latter change is obviously the more distruptive, and due to how
the default parameters work, it is difficult to see that
distribution is necessary when trying to use that function, unless
you read the pydocs carefully.

To alleviate this, I've added an execute_java method to
Distribution, which just calls util.execute_java, passing itself
as the distribution.

This way, instead of importing pants.java.util, you just import
DistributionLocator, and use something like:

DistributionLocator.cached().execute_java(...)

Which is more verbose, but requires one less import and makes it
obvious that you need a subsystem dependency on
DistributionLocator.

It makes sense to me that the Distribution should be able to invoke
its own java binary, and the actual meat-and-potatoes code is still
in pants.java.util, so I don't think this pollutes the primarily
information-holder functionality of Distribution too much. But I am
open to changing it if people find it offensive.

Regardless, this change also has the nice side-effect of making it
much more explicit that you're using an arbitrary cached version of
the jvm whenever you run java, which should make it easier and more
maintainable to use more constrained versions if necessary.

Added unit tests to pants_test/java/test_executor.py.

CI went green here: https://travis-ci.org/gmalmquist/pants/builds/77366143

Issues

  • 0
  • 1
  • 0
  • 1
Description From Last Updated
Benjy Weinberger
Eric Ayers
John Sirois
Garrett Malmquist
John Sirois
John Sirois
Garrett Malmquist
Garrett Malmquist
Review request changed

Status: Closed (submitted)

Change Summary:

In commit d3987fc2b51646638f06722c6c138674e014aa76

Eric Ayers
Ship It!
Loading...