Export synthetic jar path for external junit run

Review Request #3626 — Created March 30, 2016 and submitted

wisechengyi
pants
3111
3623
3638, 3637
pants-reviews
benjyw, nhoward_tw, peiyu, stuhood, zundel

This change adds --manifest-only under export-classpath goal to export the synthetic classpath jar that would've been used for pants junit run to dist/export-classpath/manifest.jar, so IntelliJ JUnit runner can pick it up.

Currently IntelliJ junit runner will load up classfiles for all targets imported in a project. For example, when x:: is imported to intellij, and user invokes a test that only concerns x/y/z:foo, classfiles for all targets in x:: will still be loaded.

This change will have the following benefits:
1. intellij junit runner will be as hygienic as pants junit run.
2. it simplifies the existing interface of classfile collection by target ids.
3. less time for intellij junit runner to find the classpath.
4. discover intellij junit runner stat based on this flag.

https://travis-ci.org/wisechengyi/pants/builds/119919857

  1. 
      
  2. "synthetic" is overloaded here... would be good to drop the "synthetic jar" name and call this something else if possible. Maybe a "classpath manifest jar"? or "manifest jar"? or something?

    1. changed to --manifest-only

  3. There is a method for safe concurrent creation: https://github.com/pantsbuild/pants/blob/master/src/python/pants/util/dirutil.py#L213

    1. commets added.
      synthetic_jar = safe_classpath(classpath, basedir) takes care of the concurrent creation under dist/export-classpath, though return file name is random thus renamed afterwards.

  4. 
      
  1. Thanks!

    Please add a unit test for this.

  2. Flag should probably have jar in the name. Not clear what a standalone 'manifest' would be.

    1. renamed to --manifest-jar-only

  3. This is a weird API. Maybe just add the ability to send it to a custom path?

    1. added custom_name as an optional arg in safe_classpath

  4. 
      
  1. Thanks!

  2. 
      
Review request changed

Status: Closed (submitted)

Change Summary:

aaeddcbaafcbd5bd517b87143284d15fa9db9fe5

Loading...