Skip to content

Commit

Permalink
Zinc 1.0.0-X20 upgrade: JVM portion (#4728)
Browse files Browse the repository at this point in the history
### Problem

Pants is on an older version of zinc (one that does not use class-based name-hashing), and the modern zinc project is moving quickly thanks to @jvican and others.

We had previously been on `X7` but it was reverted in #4510 because benchmarks showed that no incremental compilation was happening for scala code.

### Solution

* Upgrade to zinc `1.0.0-X20`
* Use the zinc `AnalysisMappers` API described on #4513 to make analysis files portable without parsing
* Extract options parsing out of the `Settings` object and into its own module, to allow for reuse in multiple binary entrypoints
* Refactor and split our zinc wrapper into `zinc-compiler` and `zinc-extractor` to support parsing the `product_deps_by_src` and `classes_by_source` products directly (in order to move toward making analysis a black box)
* Switch to usage of new builder-pattern APIs for constructing zinc objects
* Remove the `Loggers`/`Reporters` facades in favor of built in support for filtering log messages

### Result

The new version of the zinc wrapper correctly supports incremental compile (with the exception of sbt/zinc#355), and the python portions of pants no longer require any internal knowledge of zinc analysis. The python half of this change will remove that code.
  • Loading branch information
Stu Hood authored Jul 18, 2017
1 parent 4f7c91c commit 33e98e1
Show file tree
Hide file tree
Showing 39 changed files with 1,555 additions and 1,595 deletions.
9 changes: 9 additions & 0 deletions 3rdparty/jvm/com/fasterxml/jackson/module/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright 2017 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

jar_library(
name='scala',
jars = [
scala_jar(org='com.fasterxml.jackson.module', name='jackson-module-scala', rev='2.8.4'),
]
)
9 changes: 9 additions & 0 deletions 3rdparty/jvm/org/scala-lang/modules/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright 2017 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

jar_library(
name='scala-java8-compat',
jars=[
scala_jar(org='org.scala-lang.modules', name='scala-java8-compat', rev='0.8.0'),
],
)
13 changes: 10 additions & 3 deletions 3rdparty/jvm/org/scala-sbt/BUILD
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
# Copyright 2017 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

jar_library(
name='zinc',
jars=[
scala_jar(org='org.scala-sbt', name='zinc', rev='1.0.0-X7',
scala_jar(org='org.scala-sbt', name='zinc', rev='1.0.0-X20',
excludes=[
exclude(org='org.scala-sbt', name='io_2.11'),
exclude(org='org.scala-sbt', name='util-logging_2.11'),
]),
],
dependencies=[
':io',
':util-logging',
],
)

jar_library(
name='util-logging',
jars=[
# TODO: `zinc` only declares a dep on the `tests` classifier for
# util-logging for some reason. We redefine the dep here to get the full package.
scala_jar(org='org.scala-sbt', name='util-logging', rev='1.0.0-M17', force=True),
scala_jar(org='org.scala-sbt', name='util-logging', rev='1.0.0-M27', force=True),
],
)

Expand All @@ -23,6 +30,6 @@ jar_library(
jars=[
# TODO: `zinc` only declares a dep on the `tests` classifier for
# io. We redefine the dep here to get the full package.
scala_jar(org='org.scala-sbt', name='io', rev='1.0.0-M9', force=True),
scala_jar(org='org.scala-sbt', name='io', rev='1.0.0-M13', force=True),
],
)
186 changes: 0 additions & 186 deletions src/scala/org/pantsbuild/zinc/AnalysisMap.scala

This file was deleted.

Loading

0 comments on commit 33e98e1

Please sign in to comment.