This code originates from a PR against sbt 0.13:
https://github.com/sbt/sbt/pull/2576
The sbt/librarymanagement part was forward-ported to
sbt/librarymanagement and merged, while the sbt/sbt part wasn't.
So let's get rid of this so we can drop the dependency on
util-completion.
I'm now going to use `CacheStore.apply` in `JsonUtil` (used by cached resolution). This gets rid of `fileToStore` parameter from a bunch of classes and simplifies the setup around librarymanagement.
This is a combination of 13 commits. I squashed these 13 commits to make
forward porting those changes easier, since some commit undo the changes
of other commits.
The PRs that include these changes can be found at
https://github.com/sbt/sbt/pull/2564 and
https://github.com/sbt/sbt/pull/2576.
Static launcher, get bridge sources from resources
This commit introduces a new "static" launcher that does not use Ivy to
gather all the artifacts that it requires, but rather expect them to be
immediately available.
To be able to use sbt without Internet access, we add a new
`ComponentCompiler` that is able to retrieve the bridge sources from the
resources on classpath and compile it.
Fix classpath issues in static launcher
The launcher defines a top classloader that willbe used by all
`ScalaInstance`s. Previously, this top classloader had a parent that
contained the scala library 2.10, which prevented the correct
compilation of the compiler bridge for scala 2.11.
Also, we no longer need the scala-reflect JAR.
Tests for FakeResolver
Add `scala-reflect.jar` to JARs of `StaticScalaProvider`
It turns out we need to have `scala-reflect.jar` on classpath to compile
the compiler bridge for the static scala instance of the launcher.
Comply to Ivy's specification in `FakeResolver`
Remove `CompilerBridgeProvider` and `ResourceBridgeProvider`
It turns out that we can leverage the`FakeResolver` that has been
implemented to use with the static launcher, and resolve a "fake
compiler bridge" using it, rather than copying it from the resources.
This also has the advantage of not requiring to change the build
definition.
Fix NPE in FakeResolver
Add compiler bridge sources to fake resolver
This allows sbt to resolve the compiler bridge sources when using the
static launcher
Don't hardcode sbt version in static launcher
Add scala compiler and library to fake resolver
This allows us to still resolve them if we have no other resolver
configured.
Add `RepositoriesParser`
This parser is used by the static launcher to parse the definition of
resolvers that override the build resolvers.
Support repositories override in static launcher
The static launcher will now parse user-defined repositories like the
usual launcher does.
Specifically, the static launcher now uses the following configuration:
- `sbt.boot.directory`: specifies the boot directory that sbt will use.
Defaults to `~/.sbt/boot`.
- `sbt.override.build.repos`: indicate whether we want to override the
build resolvers. Defaults to false.
- `sbt.repository.config`: specifies the path to the files that
contains repositories definition. Defaults to
`${sbt.boot.directory}/repositories`.
Notes for sbt/sbt#2564 & sbt/sbt#2576