Fix a missing symbol in ScalaCompile.

Review Request #1945 - Created March 19, 2015 and submitted

Information
John Sirois
pants
jsirois/scala/fix_compile
1288
1898
f06c8d1...
Reviewers
pants-reviews
patricklaw, stuhood, zundel
This fixes up a missing directory member variable used to emit scalac
plugin info files for ScalacPlugin targets.  It also adds an integration
test covering straight scalac, mixed scalac/javac and the previously
raising scalac plugin case.

Also fixup JavaCompile/AptCompile, pushing apt-specific workdir member
variables and handling down to AptCompile as fallout of trying to
understand why https://rbcommons.com/s/twitter/r/1885/ broke
ScalaCompile but not JavaCompile/AptCompile.  Add a set of AptCompile
integration tests to prove out this cleanup.

In the course of fixing and adding tests, move a misplaced JavaCompile
integration test.

 3rdparty/BUILD                                                                                      |  12 ------------
 src/python/pants/backend/jvm/tasks/jvm_compile/java/apt_compile.py                                  |  19 +++++++++++++++++--
 src/python/pants/backend/jvm/tasks/jvm_compile/java/java_compile.py                                 |  14 --------------
 src/python/pants/backend/jvm/tasks/jvm_compile/scala/scala_compile.py                               |  11 ++++++++++-
 testprojects/src/scala/com/pants/testproject/scalac/plugin/BUILD                                    |  11 +++++++++++
 testprojects/src/scala/com/pants/testproject/scalac/plugin/HelloScalac.scala                        |  35 +++++++++++++++++++++++++++++++++++
 tests/python/pants_test/backend/jvm/tasks/jvm_compile/BUILD                                         |  11 +++++++++++
 tests/python/pants_test/backend/jvm/tasks/jvm_compile/base_compile_integration_test.py              |  37 +++++++++++++++++++++++++++++++++++++
 tests/python/pants_test/backend/jvm/tasks/jvm_compile/java/BUILD                                    |  30 ++++++++++++++++++++++++++++++
 tests/python/pants_test/{tasks/jvm_compile/scala => backend/jvm/tasks/jvm_compile/java}/__init__.py |   0
 tests/python/pants_test/backend/jvm/tasks/jvm_compile/java/test_apt_compile_integration.py          |  44 ++++++++++++++++++++++++++++++++++++++++++++
 tests/python/pants_test/{ => backend/jvm}/tasks/jvm_compile/java/test_java_compile_integration.py   |   0
 tests/python/pants_test/backend/jvm/tasks/jvm_compile/scala/BUILD                                   |  27 +++++++++++++++++++++++++++
 tests/python/pants_test/{tasks/jvm_compile => backend/jvm/tasks/jvm_compile/scala}/__init__.py      |   0
 tests/python/pants_test/backend/jvm/tasks/jvm_compile/scala/test_scala_compile_integration.py       |  48 ++++++++++++++++++++++++++++++++++++++++++++++++
 tests/python/pants_test/{ => backend/jvm}/tasks/jvm_compile/scala/test_zinc_analysis.py             |   3 +--
 tests/python/pants_test/{ => backend/jvm}/tasks/jvm_compile/scala/testdata/analysis.tar.bz2         | Bin
 tests/python/pants_test/tasks/BUILD                                                                 |   2 --
 tests/python/pants_test/tasks/jvm_compile/java/BUILD                                                |  18 ------------------
 tests/python/pants_test/tasks/jvm_compile/scala/BUILD                                               |  15 ---------------
 20 files changed, 271 insertions(+), 66 deletions(-)

I first noticed the problem attempting to upgrade twitter/commons to pantsbuild.pants 0.0.30:

...
23:04:35 00:00   [compile]
23:04:35 00:00     [compile]
23:04:35 00:00     [jvm]
23:04:35 00:00       [jvm-compilers]
23:04:35 00:00         [find-deleted-sources]
23:04:35 00:00         [prepare-analysis]
                     Invalidated 5 targets.
23:04:36 00:01         [partition-analysis]
                     Compiling 5 scala sources in 5 targets (partition 1 of 1).
23:04:36 00:01         [compile]
23:04:36 00:01           [zinc]
                         [info] Compile success at Mar 18, 2015 11:04:36 PM [0.163s]

               Waiting for background workers to finish.
               FAILURE

Exception caught:
  File "/home/jsirois/dev/3rdparty/jsirois-twitter-commons/build-support/pants.venv/bin/pants", line 9, in <module>
    load_entry_point('pantsbuild.pants==0.0.30', 'console_scripts', 'pants')()
  File "/home/jsirois/dev/3rdparty/jsirois-twitter-commons/build-support/pants.venv/lib/python2.7/site-packages/pants/bin/pants_exe.py", line 81, in main
    _run(exiter)
  File "/home/jsirois/dev/3rdparty/jsirois-twitter-commons/build-support/pants.venv/lib/python2.7/site-packages/pants/bin/pants_exe.py", line 74, in _run
    result = goal_runner.run()
  File "/home/jsirois/dev/3rdparty/jsirois-twitter-commons/build-support/pants.venv/lib/python2.7/site-packages/pants/bin/goal_runner.py", line 174, in run
    result = self._do_run()
  File "/home/jsirois/dev/3rdparty/jsirois-twitter-commons/build-support/pants.venv/lib/python2.7/site-packages/pants/bin/goal_runner.py", line 230, in _do_run
    return engine.execute(context, self.goals)
  File "/home/jsirois/dev/3rdparty/jsirois-twitter-commons/build-support/pants.venv/lib/python2.7/site-packages/pants/engine/engine.py", line 26, in execute
    self.attempt(context, goals)
  File "/home/jsirois/dev/3rdparty/jsirois-twitter-commons/build-support/pants.venv/lib/python2.7/site-packages/pants/engine/round_engine.py", line 212, in attempt
    goal_executor.attempt(explain)
  File "/home/jsirois/dev/3rdparty/jsirois-twitter-commons/build-support/pants.venv/lib/python2.7/site-packages/pants/engine/round_engine.py", line 45, in attempt
    task.execute()
  File "/home/jsirois/dev/3rdparty/jsirois-twitter-commons/build-support/pants.venv/lib/python2.7/site-packages/pants/backend/core/tasks/group_task.py", line 320, in execute
    group_member.execute_chunk(chunk)
  File "/home/jsirois/dev/3rdparty/jsirois-twitter-commons/build-support/pants.venv/lib/python2.7/site-packages/pants/backend/jvm/tasks/jvm_compile/jvm_compile.py", line 271, in execute_chunk
    update_artifact_cache_vts_work)
  File "/home/jsirois/dev/3rdparty/jsirois-twitter-commons/build-support/pants.venv/lib/python2.7/site-packages/pants/backend/jvm/tasks/jvm_compile/jvm_compile_global_strategy.py", line 269, in compile_chunk
    register_vts([self.compile_context(t) for t in vts.targets])
  File "/home/jsirois/dev/3rdparty/jsirois-twitter-commons/build-support/pants.venv/lib/python2.7/site-packages/pants/backend/jvm/tasks/jvm_compile/jvm_compile.py", line 357, in _register_vts
    for root, abs_paths in self.extra_products(compile_context.target):
  File "/home/jsirois/dev/3rdparty/jsirois-twitter-commons/build-support/pants.venv/lib/python2.7/site-packages/pants/backend/jvm/tasks/jvm_compile/scala/scala_compile.py", line 78, in extra_products
    root, plugin_info_file = ZincUtils.write_plugin_info(self._resources_dir, target)

Exception message: 'ScalaCompile' object has no attribute '_resources_dir'

After this fix I was able to burn a local pantsbuild.pants sdist and point twitter/commons at that at which point its ci ran green:

jsirois@gill ~/dev-jsirois-pants4 (jsirois/scala/fix_compile) $ ./build-support/bin/release.sh -n
jsirois@gill ~/dev/3rdparty/jsirois-twitter-commons (jsirois/pants/upgrade_0.0.30 *) $ PIP_OPTIONS="--find-links /home/jsirois/dev-jsirois-pants4/dist/" ./build-support/bin/ci.sh

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

John Sirois
Eric Ayers
Stu Hood
John Sirois
John Sirois
John Sirois
Review request changed

Status: Closed (submitted)

Loading...