Merge pull request #5345 from eed3si9n/wip/bridge

Fix Zinc component compiler to respect -Dsbt.ivy.home
This commit is contained in:
eugene yokota 2019-12-30 06:38:38 -05:00 committed by GitHub
commit 8dfce72a2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 4 deletions

View File

@ -1201,7 +1201,11 @@ def otherRootSettings =
scriptedUnpublished := scriptedUnpublishedTask.evaluated,
scriptedSource := (sourceDirectory in sbtProj).value / "sbt-test",
watchTriggers in scripted += scriptedSource.value.toGlob / **,
scriptedLaunchOpts := List("-Xmx1500M", "-Xms512M", "-server"),
scriptedLaunchOpts := List("-Xmx1500M", "-Xms512M", "-server") :::
(sys.props.get("sbt.ivy.home") match {
case Some(home) => List(s"-Dsbt.ivy.home=$home")
case _ => Nil
}),
publishAll := { val _ = (publishLocal).all(ScopeFilter(inAnyProject)).value },
publishLocalBinAll := { val _ = (publishLocalBin).all(ScopeFilter(inAnyProject)).value },
aggregate in bintrayRelease := false
@ -1213,7 +1217,11 @@ def otherRootSettings =
"-server",
"-Dsbt.override.build.repos=true",
s"""-Dsbt.repository.config=${scriptedSource.value / "repo.config"}"""
),
) :::
(sys.props.get("sbt.ivy.home") match {
case Some(home) => List(s"-Dsbt.ivy.home=$home")
case _ => Nil
}),
scripted := scriptedTask.evaluated,
scriptedUnpublished := scriptedUnpublishedTask.evaluated,
scriptedSource := (sourceDirectory in sbtProj).value / "repo-override-test"

View File

@ -26,6 +26,10 @@ object RunFromSourceMain {
def fork(fo0: ForkOptions, workingDirectory: File): Process = {
val fo = fo0
.withWorkingDirectory(workingDirectory)
.withRunJVMOptions(sys.props.get("sbt.ivy.home") match {
case Some(home) => Vector(s"-Dsbt.ivy.home=$home")
case _ => Vector()
})
implicit val runner = new ForkRun(fo)
val cp = {
TestBuildInfo.test_classDirectory +: TestBuildInfo.fullClasspath
@ -117,7 +121,10 @@ object RunFromSourceMain {
def topLoader = new java.net.URLClassLoader(Array(), null)
def globalLock = noGlobalLock
def bootDirectory = RunFromSourceMain.bootDirectory
def ivyHome = file(sys.props("user.home")) / ".ivy2"
def ivyHome: File = sys.props.get("sbt.ivy.home") match {
case Some(home) => file(home)
case _ => file(sys.props("user.home")) / ".ivy2"
}
case class PredefRepo(id: Predefined) extends PredefinedRepository
import Predefined._
def ivyRepositories = Array(PredefRepo(Local), PredefRepo(MavenCentral))

View File

@ -159,7 +159,13 @@ private[sbt] object ZincComponentCompiler {
): CompilerBridgeProvider =
new ZincCompilerBridgeProvider(None, manager, dependencyResolution, scalaJarsTarget)
private final val LocalIvy = s"$${user.home}/.ivy2/local/${Resolver.localBasePattern}"
private final val LocalIvy =
(sys.props.get("sbt.ivy.home") match {
case Some(home) =>
if (home.endsWith("/")) home
else home + "/"
case _ => s"$${user.home}/.ivy2/"
}) + "local/" + Resolver.localBasePattern
final val LocalResolver: Resolver = {
val toUse = Vector(LocalIvy)