Introduce a jvm binary shader.

Review Request #2050 - Created April 10, 2015 and submitted

Information
John Sirois
pants
jsirois/issues/663/introduce_shader
663, 1362, 1388
2052
cb3adf8...
Reviewers
pants-reviews
nhoward_tw, patricklaw, zundel
This tool initially handles just binary jar auto-shading to support
shading of bootstrapped jvm tools.  It should be easy to extend to add
support for fully customizable non-binary jar shading though.  The tool
uses jarjar to perform the shading but the interface steers clear of
jarjarisms so this should be a stable base to move forward with even if
we end up needing to swap out the shading backend.

 BUILD.tools                                     |   5 ++
 src/python/pants/java/executor.py               |  19 ++--
 src/python/pants/java/jar/BUILD                 |  15 +++-
 src/python/pants/java/jar/shader.py             | 236 ++++++++++++++++++++++++++++++++++++++++++++++++++
 src/python/pants/java/nailgun_executor.py       |   4 +-
 tests/python/pants_test/java/jar/BUILD          |  11 +++
 tests/python/pants_test/java/jar/test_shader.py |  94 ++++++++++++++++++++
 7 files changed, 374 insertions(+), 10 deletions(-)

The jarjar jar (unused in this RB, used in next) was synced to bintray from
this commit: https://github.com/pantsbuild/maven-repo/commit/782e0cb4
Tested the sync with a successful resolve:

$ PANTS_DEV=1 ./pants resolve.ivy --open //:jarjar

And coverage is good for the new code:

$ PANTS_PY_COVERAGE=modules:pants.java.jar.shader PANTS_DEV=1 ./pants test tests/python/pants_test/java/jar/:shader
...
21:53:58 00:00   [test]
21:53:58 00:00     [run_prep_command]
21:53:58 00:00     [test]
21:53:58 00:00     [pytest]
21:53:58 00:00       [run]
                     ============== test session starts ===============
                     platform linux2 -- Python 2.7.8 -- py-1.4.26 -- pytest-2.7.0
                     rootdir: /tmp, inifile: 
                     plugins: timeout
                     collected 4 items 

                     ../../../../../tmp ....
                      coverage: platform linux2, python 2.7.8-final-0 -
                     Name                               Stmts   Miss Branch BrMiss  Cover
                     --------------------------------------------------------------------
                     src/python/pants/java/jar/shader      86      8     30      8    86%

                     ============ 4 passed in 5.17 seconds ============
                     Name                               Stmts   Miss Branch BrMiss  Cover
                     --------------------------------------------------------------------
                     src/python/pants/java/jar/shader      86      8     30      8    86%

21:54:04 00:06     [junit]
21:54:04 00:06     [specs]
               SUCCESS

CI went green here:
https://travis-ci.org/pantsbuild/pants/builds/57977570

Issues

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

Status: Closed (submitted)

Stu Hood

   
src/python/pants/java/jar/shader.py (Diff revision 4)
 
 
 

I think one of the goals of shading is to allow all of the tools to run in the same nailgun instance? In that case, it would probably be good for the shade prefix to be unique/private for each tool.

  1. That wasn't a goal I had in mind, just to isolate the tool from the code it operates over, not the tool from another tool.
    
    The case you mention sortof makes sense, but it brings to mind other cases that definitely make sense / will happen.
    
    I'm dropping this RB issue since the RB is in master.
    Instead I've opened a github issue: https://github.com/pantsbuild/pants/issues/1420
Loading...