Make BootstrapJvmTools fail fast on a bad user-specified address.

Review Request #2795 - Created Sept. 10, 2015 and submitted

Information
Garrett Malmquist
pants
gmalmquist/missing-jvm-tool-options-fail-loudly
2167
3b455a4...
Reviewers
pants-reviews
jsirois, zundel
Previously, if you specified a target for a jvm-tool that pants
failed to resolve, if the jvm-tool had a default classpath, pants
would simply inject a synthetic JarLibrary with the same name that
used the default classpath.

This resulted in pants pretending to use the user-specified target
that it couldn't find, but silently it was using the default.

This caused problems for square internally when we tried to specify
a different version of the wire-compiler with an (unwittingly)
malformatted spec. The build continued along merrily and subtly
pulled in the wrong version of wire, only blowing up when it tried
to compile a target that used features not available in pants's
default version of wire.

Example output after this change:

    ~/Src/Pants ./pants --gen-wire-wire-compiler="this-target-definitely-does-not-exist" clean-all compile examples/src/wire::
    INFO] Detected git repository at /Users/gmalmquist/Src/Pants on branch gmalmquist/missing-jvm-tool-options-fail-loudly

    17:41:55 00:00 [main]
                   (To run a reporting server: ./pants server)
    17:41:55 00:00   [bootstrap]
    17:41:55 00:00   [setup]
    17:41:55 00:00     [parse]
    FAILURE: Failed to resolve target for tool: this-target-definitely-does-not-exist. This target was obtained from
    option wire-compiler in scope gen.wire.

    Make sure you didn't make a typo in the tool's address. You specified that the
    tool should use the target found at "this-target-definitely-does-not-exist".

    This target has a default classpath configured, so you can simply remove:
      [gen.wire]
      wire-compiler: this-target-definitely-does-not-exist
    from pants.ini (or any other config file) to use the default tool.

    The default classpath is: com.squareup.wire-wire-compiler-1.6.0

    Note that tool target addresses in pants.ini should be specified *without* quotes.

    17:41:55 00:00   [complete]
                   FAILURE

Manual testing, added tests to test_bootstrap_jvm_tools_integration.

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

John Sirois
Eric Ayers
Garrett Malmquist
Eric Ayers
Garrett Malmquist
Garrett Malmquist
Review request changed

Status: Closed (submitted)

Change Summary:

Thanks John & Eric. In commit 4d5904d238eeb9d3a46c7d0fcc361f50f352989f

John Sirois
Ship It!
Loading...