Commit Graph

63 Commits

Author SHA1 Message Date
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
Eugene Yokota ba398b5b9c Update dependencies 2016-05-04 23:13:28 -04:00
Grzegorz Kossakowski aa0a77930a Rename incrementalcompiler to zinc
Reflect the rename of the repo to zinc in project's structure.
2016-03-31 00:02:59 +02:00
Grzegorz Kossakowski f32ea08a53 Zinc is compatible with Scala 2.10 and 2.11 only
The class-based-dependencies branch nuked compatibility with older Scala
compiler versions.
2016-03-16 20:28:41 +01:00
Martin Duhem b04faef33f Fix compiler bridge sources retrieval 2016-02-24 09:55:22 +01:00
Eugene Yokota 78c76cb775 librarymanagement 0.1.0-M7 2016-02-24 00:08:23 -05:00
Eugene Yokota c2406c0648 Use real local to retrieve compiler bridge during test. Fixes #36 2015-12-24 05:36:31 -05:00
Eugene Yokota 17f55850f6 Quieter log during scripted 2015-12-22 00:20:29 -05:00
Martin Duhem 85a05ed237 Fix command and definition of compiler bridge
The compiler bridge had a dependency on the scala compiler in the
version defined in the build definition. This means that when trying to
fetch the compiler bridge for, say, Scala 2.9.2, we would also pull in
the Scala compiler 2.10.5.

The compiler bridge now has a "provided" dependency on the Scala
compiler.
2015-11-23 15:44:23 +01:00
Martin Duhem 5dd2b1f16a Fix tests that fetch and build the compiler bridge. 2015-11-23 11:54:13 +01:00
Martin Duhem c62f8f4683 Put `util-interface` on classpath when compiling compiler bridge
Also, write tests to make sure that we remain able to compile the
compiler bridge for different versions of Scala.

Fixes sbt/incrementalcompiler#32
2015-11-16 22:46:38 +01:00
Eugene Yokota f2ee845280 Move things around further. 2015-09-16 00:58:48 -04:00
Eugene Yokota 785c639805 Fix the hardcoded ModuleID to compiler-interface 2015-09-14 22:04:19 -04:00
Eugene Yokota 0df130fbe2 New scalariform 2015-09-14 01:22:52 -04:00
Eugene Yokota f26f95fe6a Reorganize subprojects around 2015-09-13 01:13:42 -04:00
Martin Duhem ce915b23ba Retrieve java compiler interfaces using Ivy
Previously the component compiler depended on a `componentID` added to
some interfaces to be able to compile the compiler interface. sbt's
launcher placed artifacts marked with this `componentID` in a special
directory that was then used by the ComponentCompiler to be able to
compile the compiler interface.

This commit modifies the ComponentCompiler so that it does not expect
these components to be already present in some directory, but instead
downloads it using Ivy when required.
2015-09-11 13:53:51 +02:00
Martin Duhem 0cc451b8b2 Fix deprecation message 2015-09-11 10:22:33 +02:00