[jvm-compile][bug] Fixes other target's class dir ending up on classpath
Review Request #4198 — Created Aug. 30, 2016 and submitted
|benjyw, gmalmquist, stuhood|
https://rbcommons.com/s/twitter/r/3635/ introduced a regression where classpath entries for targets other than the target being compiled could end up on the compile classpath if there are multiple targets being compiled.
You tell pants to compile targets A, B and C.
When jvm_compile creates the compile jobs, it does it in the order A, B and C.
Then, for A and B instead of having their own class directories on the classpath, they'll have C's. This is because
compile_contextwill point at C and we were using
compile_contextto find the class directory.
This fixes it by replacing the usages of the closed over iteration variable with the passed ctx variable.
It also adds a regression test.
Wrote failing regression test and made it pass. CI away on the linked PR.
Added an example to the description.