Commit Graph

85 Commits

Author SHA1 Message Date
Dale Wijnand fca9c85546 Merge branch '1.0.x' into merge-1.0.x-into-1.1.x
* 1.0.x:
  Make PositionImpl thread-safe
  Support scala 2.13.0-pre-* & 2.13.0-M1
2017-12-13 16:06:14 +00:00
Dale Wijnand 8c1e062fd1 Support scala 2.13.0-pre-* & 2.13.0-M1
Fixes sbt/sbt#3771
Fixes sbt/zinc#460
2017-11-28 15:34:34 +00:00
Dale Wijnand 7e855b8323 Merge branch '1.0.x' into merge-1.0.x-into-1.x
* 1.0.x: (28 commits)
  Split compiler bridge tests to another subproject
  Implement compiler bridge for 2.13.0-M2
  Add yourkit acknoledgement in the README
  "sbt '++ 2.13.0-M2!' compile" does not work with sbt 1.0.0
  Add header to cached hashing spec
  Add headers to missing files
  Fix #332: Add sbt-header back to the build
  Update sbt-scalafmt to 1.12
  Make classpath hashing more lightweight
  Fix #442: Name hash of value class should include underlying type
  source-dependencies/value-class-underlying: fix test
  Ignore null in generic lambda tparams
  Improve and make scripted parallel
  Fix #436: Remove annoying log4j scripted exception
  Fix #127: Use `unexpanded` name instead of `name`
  Add pending test case for issue/127
  source-dependencies / patMat-scope workaround
  Fixes undercompilation on inheritance on same source
  Add real reproduction case for sbt/zinc#417
  Add trait-trait-212 for Scala 2.12.3
  ...

 Conflicts:
	internal/zinc-apiinfo/src/main/scala/sbt/internal/inc/ClassToAPI.scala
	project/build.properties
	zinc/src/main/scala/sbt/internal/inc/MixedAnalyzingCompiler.scala

The ClassToAPI conflict is due to:
* https://github.com/sbt/zinc/pull/393 (a 1.x PR), conflicting with
* https://github.com/sbt/zinc/pull/446 (a 1.0.x PR).

The build.properties conflict is due to different PRs bumping
sbt.version from 1.0.0 to 1.0.2 to 1.0.3. (#413, #418, #453).

The MixedAnalyzingCompiler conflict is due to:
* https://github.com/sbt/zinc/pull/427 (a 1.x PR), conflicting with
* https://github.com/sbt/zinc/pull/452 (a 1.0.x PR).
2017-11-23 12:30:03 +00:00
Eugene Yokota 282b0f7f51 Split compiler bridge tests to another subproject
Splitting compiler bridge tests to another subproject because while the bridge itself can be compiled with just compiler-interface, util-interface, and Scala Compiler as dependencies, the testing introduces more (such as IO). This creates problem for new Scala versions where IO or test libraries do not exist yet (e.g. Scala 2.13.0-M2).

This also removes the Mima test due to the lack of 2.13 bridge for Zinc 1.0.0.
Compiler bridge just needs to compile itself against the interface and Scala compiler, so there's no need to run Mima test.
2017-11-21 11:52:03 -05:00
Allan Timothy Leong bd1a38be54 Remove unused imports + variables 2017-10-22 16:31:03 +08:00
Dale Wijnand 1c1ba43ed1 Add back, re-configure & re-enable Scalafmt 2017-08-22 16:05:24 +01:00
jvican 57d25161dc Use Scala 2.12.3
We have to look into the reason why the shaded version of the compiler
plugin reports the following error and halts the build:

```
protoc-jar: executing: [/tmp/protocjar2818613521400194680/bin/protoc.exe, --plugin=protoc-gen-scala=/tmp/protocbridge4921434211196915044, --scala_out=grpc:/data/rw/code/scala/zinc/internal/zinc-persist/target/scala-2.12/src_managed/main, -I/data/rw/code/scala/zinc/internal/zinc-persist/src/main/protobuf, -I/data/rw/code/scala/zinc/internal/zinc-persist/target/protobuf_external, /data/rw/code/scala/zinc/internal/zinc-persist/src/main/protobuf/schema.proto]
java.lang.AbstractMethodError: Method scalapb/ScalaPbCodeGenerator$.run(Lcom/google/protobuf/compiler/PluginProtos$CodeGeneratorRequest;)Lcom/google/protobuf/compiler/PluginProtos$CodeGeneratorResponse; is abstract
	at scalapb.ScalaPbCodeGenerator$.run(ScalaPbCodeGenerator.scala)
	at protocbridge.frontend.PluginFrontend$.$anonfun$runWithBytes$1(PluginFrontend.scala:56)
	at scala.util.Try$.apply(Try.scala:209)
	at protocbridge.frontend.PluginFrontend$.runWithBytes(PluginFrontend.scala:54)
	at protocbridge.frontend.PluginFrontend$.runWithInputStream(PluginFrontend.scala:67)
	at protocbridge.frontend.PosixPluginFrontend$.$anonfun$prepare$1(PosixPluginFrontend.scala:25)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
	at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:653)
	at scala.util.Success.$anonfun$map$1(Try.scala:251)
	at scala.util.Success.map(Try.scala:209)
	at scala.concurrent.Future.$anonfun$map$1(Future.scala:287)
	at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:29)
	at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:29)
	at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:60)
	at scala.concurrent.impl.ExecutionContextImpl$AdaptedForkJoinTask.exec(ExecutionContextImpl.scala:140)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
```
2017-07-27 11:34:52 +02:00
Eugene Yokota 7284e7b5b6 Merge branch 'pr/335' into wip/integration
# Conflicts:
#	internal/zinc-ivy-integration/src/main/scala/sbt/internal/inc/ZincComponentCompiler.scala
#	project/Dependencies.scala
2017-07-15 15:36:37 -04:00
jvican f69ba0ea68 Remove any reference to `F0` and `F1`
Syncs up with https://github.com/sbt/util/pull/84.
2017-07-14 17:22:11 +02:00
Martin Duhem 763effd337 Adapt Zinc to use the new LibraryManagement API 2017-07-06 15:35:34 +02:00
Eugene Yokota 34d0dae6e2 Fix ScalaFmt wiring 2017-07-03 14:53:56 -04:00
Eugene Yokota c95396b020 Add scalaCompiler variant that accepts ModuleID 2017-05-29 12:08:31 -04:00
Eugene Yokota 9e28e0bfd6 Bump all the modules 2017-05-28 00:09:50 -04:00
jvican 11fa775ef8 Rename `getXXX` by `fetchXXX`
As suggested by Eugene.
2017-05-26 15:32:29 +02:00
jvican 551c5d9aa4 Add headers to files missing it 2017-05-22 17:02:32 +02:00
jvican 66c34d180e Move `ClasspathOptionsUtil` to the Java public API
Move the previous Scala implementation to Java as static methods.
2017-05-22 17:00:29 +02:00
jvican 19ddb6f2a2 Move ZincBridgeProvider to `xsbti.compile`
Before, we were using `sbt.inc`. As we have settled to define all the
interfaces in the `xsbti.compile` namespaces, it's not worth it to force
users remember other locations for the interfaces forwarding the default
implementations in Scala.
2017-05-22 16:07:53 +02:00
jvican e071577d6a Hide Zinc Compilation implementation
Before, we had made this public in `sbt.inc`, but this is not necessary
anymore.
2017-05-22 15:54:20 +02:00
jvican c8560c6b4e Add `ZincCompilerUtil` to get the Scalac compiler
* Move `IncrementalCompilerUtil` to `ZincCompilerUtil`.
* Change `IncrementalCompilerUtil` to an interface with static methods.
* Remove bug in which ScalaInstance implementation was leaking to the
  public API.
2017-05-22 15:49:26 +02:00
jvican 96f7e08864 Remove the use of `BaseIvySpecification`
This is the proof that we're now testing the Zinc public API because
we're resolving with the ivy options and resolution specified in the
default compiler bridge provider.
2017-05-21 20:21:58 +02:00
jvican 4d0f06a2ee Add public method to get default component provider
Expose default component provider through a static method in
`ZincCompilerBridge`. This method is necessary to invoke the bridge.

Removes the previous global lock and component provider implementations
in `BridgeProviderSpecification`.
2017-05-21 20:21:58 +02:00
jvican 6d012abaf9 Remove verbose Java global lock implementation 2017-05-21 20:21:58 +02:00
jvican aa3527996f Add public method to get no-op global lock 2017-05-21 20:21:58 +02:00
jvican 025c4cef9a Add public method to get a local ivy resolver 2017-05-21 20:21:58 +02:00
jvican c228ce8817 Add Java API for Zinc Ivy integration
* Adds a method to fetch the default implementation of the compiler
  provider.
* Adds a method to get a default `IvyConfiguration` from a small number
  of parameters.

The public API is implemented in Java to ensure binary compatibility no
matter what happens to the internal Scala implementations. It also makes
it easier for Java users to use the API and avoid importing MODULE$'s
and Scala generated class files.'
2017-05-21 20:21:57 +02:00
jvican d794ead617 Fix error when showing unresolved warning lines 2017-05-21 20:21:57 +02:00
jvican 47415e7def Compile bridge for 2.12.x and other Scala versions
This commit makes sure that we always check that we compile against the
latest two versions in Scala 2.10, Scala 2.11 and Scala 2.12.

This commit also removes the null loggers and uses normal loggers to
check what the output of the bridge provider is. This output is
important and the rationale to do this is that it should be visible for
us in order to detect cases where there's a regression or the output is
modified in some way. Output is short anyway.
2017-05-21 20:21:57 +02:00
jvican f4c38c8355 Test `getScalaInstance` & `getCompiledBridge`
* Remove unused code in `BridgeProviderSpecification` and test the real
  code in the default provider.
* Don't use temporary directory to download the Scala jars, retrive them
  in a directory specified by the user.
* Use `java.net.ClassLoader` instead of `ScalaClassLoader`.
* Use the `ScalaInstance` interface, not the implementation. Remove any
  reference to the implementation.
2017-05-21 20:21:57 +02:00
jvican ae40c096e3 Remove custom `getScalaInstance` and use default 2017-05-21 20:21:57 +02:00
jvican 62a5037d23 Add `getScalaInstance` to `CompilerBridgeProvider` 2017-05-21 20:21:57 +02:00
jvican d48f65a8a7 Fix oversight in InvalidComponent message 2017-05-21 20:21:57 +02:00
jvican 8d9d007d3c Rename `getCompilerSources` to `getCompiledBridge`
Previous name was incorrect, we actually return the compiled bridge.
2017-05-21 20:21:57 +02:00
jvican e756f07aed Add headers to files that don't have them 2017-05-21 20:21:56 +02:00
jvican 3f1cce379f Add `CompilerBridgeProvider` interface and misc.
* Add interface for the provider.
* Rename `IvyComponentCompiler` to `ZincComponentCompiler`.
* Split `ZincComponentCompiler` and `ZincComponentManager`.
* Define `IfMissing` and `InvalidComponent` into independent files.
* Rename variables and internal API to be clearer.
2017-05-21 20:21:56 +02:00
jvican 9c1268412a Reformat zinc with scalafmt
The same as https://github.com/sbt/librarymanagement/pull/87/.
2017-05-03 18:34:51 +02:00
Eugene Yokota ad7bd2c2d6 Bump to util 1.0.0-M22 and 1.0.0-X10
Bumping to the latest librarymanagement.
2017-04-17 16:05:56 -04:00
Eugene Yokota 34da766f2b Better error message for bridge resolution
The compiler bridge dependency resolution had `missingOk = true` flag on. This would silently succeed even when one of the dependency is missing, and it would randomly fail bridge compilation, which is very confusing.
2017-04-11 03:08:06 -04:00
Eugene Yokota ef6193e8cf Adds Hello world for 2.10, 2.11, and 2.12 2017-03-23 23:56:42 -04:00
jvican 5cea7ae09f Do a first pass on the Zinc internal implementation
This commit addresses several concers:

* Document better the Zinc internal implementation.
* Getting the implementation ready for moving things from internal to
  public APIs. This will be done in a follow-up commit.
* Removing `inputs` and `setups` from the `IncrementalCompilerUtil` as
  they exist mainly to interface between Scala code and Java code. The
  reality is that both Java and Scala developers can easily call the
  constructors by themselves and don't learn more API methods.
* Removes unused imports, that emit stupid warnings.
* Make code more readable, especifically in the analyzing compilers for
  both Java and Scala, which was hardly understandable and documented.
* Make `AnalyzingJavaCompiler` to extend `JavaCompiler` as
  `AnalyzingCompiler` does for `ScalaCompiler`. In an upcoming commit,
  `AnalyzingCompiler` will be renamed into `AnalyzingScalaCompiler` for
  consistency reasons.
* Replace use of `sbt.util.Logger` helpers by `sbt.util.InterfaceUtil`.
2017-02-26 14:32:05 +01:00
Eugene Yokota ddb9cfd3f9 Switch over to using ManagedLogger 2017-02-17 12:40:56 -05:00
Eugene Yokota b6fc9f9517 Put copyright notice
Fixes #222
2017-02-07 16:49:58 -05:00
Eugene Yokota 818cee0156 Migrate ComponentManager from librarymanagement
This migrates the `ComponentManager` from librarymanagement, and refactors it to clarify the double caching of the compiler bridge.

The main purpose of this refactoring is to fix sbt/sbt#2539. As it stands, becaue Ivy cache directory is being used as the secondary cache of the compiled compiler bridge, it's annoying to work with the compiler bridge. Instead of using "Ivy cache", the new `ZincComponentManager` accepts `secondaryCacheDir: Option[File]`, which during test defaults to `target/zinc-components`.

Fixes sbt/sbt#2539
2017-01-29 17:56:35 -05:00
Eugene Yokota c75a69bbb0 Cross build to Scala 2.12 2017-01-07 06:27:38 -05:00
Dale Wijnand 376718f976 Upgrade to newer modules, migrate to new lm api 2017-01-05 17:40:23 +00:00
Dale Wijnand b9060c63ee Upgrade to new sbt/librarymanagement 2016-11-18 13:05:24 +00:00
Dale Wijnand e4dfbb0174 Bump TravisCI to 2.11.8, match crossScalaVersions 2016-11-17 16:32:26 +00:00
Simon Schäfer 531ea5f635 Rename CompilerInterfaceProvider to CompilerBridgeProvider
Fix #162
2016-11-03 09:29:41 +01:00
eugene yokota 0539410fdd Merge pull request #128 from Duhemm/wip/compiler-api
Minimal API for `ScalaCompiler`, expose in `Compilers`
2016-06-08 01:30:51 -04:00
Martin Duhem 7799afdef8 Generate `ClasspathOptions` with sbt-datatype
Also rename the previous object called `ClasspathOptions` to
`ClasspathOptionsUtil`.
2016-06-01 16:22:58 +02:00
Eugene Yokota 1ec9fc4b28 Don't use other projects' tests 2016-05-11 15:08:08 -04:00