mirror of https://github.com/sbt/sbt.git
In-source zinc's LM integration code
This commit is contained in:
parent
b9b520f79e
commit
e978357e47
37
build.sbt
37
build.sbt
|
|
@ -89,15 +89,18 @@ def baseSettings: Seq[Setting[_]] =
|
||||||
def testedBaseSettings: Seq[Setting[_]] =
|
def testedBaseSettings: Seq[Setting[_]] =
|
||||||
baseSettings ++ testDependencies
|
baseSettings ++ testDependencies
|
||||||
|
|
||||||
val mimaSettings = Def settings (
|
def sbt10Plus = Seq(
|
||||||
|
"1.0.0", "1.0.1", "1.0.2", "1.0.3", "1.0.4",
|
||||||
|
"1.1.0", "1.1.1", "1.1.2", "1.1.3", "1.1.4", "1.1.5", "1.1.6",
|
||||||
|
"1.2.0", "1.2.1", /*DOA,*/ "1.2.3", "1.2.4", /*DOA,*/ "1.2.6", "1.2.7", "1.2.8",
|
||||||
|
) ++ sbt13Plus
|
||||||
|
def sbt13Plus = Seq() // Add sbt 1.3+ stable versions when released
|
||||||
|
|
||||||
|
def mimaSettings = mimaSettingsSince(sbt10Plus)
|
||||||
|
def mimaSettingsSince(versions: Seq[String]) = Def settings (
|
||||||
mimaPreviousArtifacts := {
|
mimaPreviousArtifacts := {
|
||||||
Seq(
|
val crossVersion = if (crossPaths.value) CrossVersion.binary else CrossVersion.disabled
|
||||||
"1.0.0", "1.0.1", "1.0.2", "1.0.3", "1.0.4",
|
versions.map(v => organization.value % moduleName.value % v cross crossVersion).toSet
|
||||||
"1.1.0", "1.1.1", "1.1.2", "1.1.3", "1.1.4", "1.1.5", "1.1.6",
|
|
||||||
"1.2.0", "1.2.1", "1.2.3"
|
|
||||||
).map { v =>
|
|
||||||
organization.value % moduleName.value % v cross (if (crossPaths.value) CrossVersion.binary else CrossVersion.disabled)
|
|
||||||
}.toSet
|
|
||||||
},
|
},
|
||||||
mimaBinaryIssueFilters ++= Seq(
|
mimaBinaryIssueFilters ++= Seq(
|
||||||
// Changes in the internal package
|
// Changes in the internal package
|
||||||
|
|
@ -425,7 +428,6 @@ lazy val actionsProj = (project in file("main-actions"))
|
||||||
addSbtCompilerClasspath,
|
addSbtCompilerClasspath,
|
||||||
addSbtCompilerApiInfo,
|
addSbtCompilerApiInfo,
|
||||||
addSbtLmCore,
|
addSbtLmCore,
|
||||||
addSbtCompilerIvyIntegration,
|
|
||||||
addSbtZinc
|
addSbtZinc
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -576,11 +578,25 @@ lazy val mainSettingsProj = (project in file("main-settings"))
|
||||||
addSbtLmCore
|
addSbtLmCore
|
||||||
)
|
)
|
||||||
|
|
||||||
|
lazy val zincLmIntegrationProj = (project in file("zinc-lm-integration"))
|
||||||
|
.enablePlugins(BuildInfoPlugin)
|
||||||
|
.settings(
|
||||||
|
name := "Zinc LM Integration",
|
||||||
|
testedBaseSettings,
|
||||||
|
buildInfo in Compile := Nil, // Only generate build info for tests
|
||||||
|
BuildInfoPlugin.buildInfoScopedSettings(Test),
|
||||||
|
buildInfoPackage in Test := "sbt.internal.inc",
|
||||||
|
buildInfoObject in Test := "ZincLmIntegrationBuildInfo",
|
||||||
|
buildInfoKeys in Test := List[BuildInfoKey]("zincVersion" -> zincVersion),
|
||||||
|
mimaSettingsSince(sbt13Plus),
|
||||||
|
)
|
||||||
|
.configure(addSbtZincCompileCore, addSbtLmCore, addSbtLmIvyTest)
|
||||||
|
|
||||||
// The main integration project for sbt. It brings all of the projects together, configures them, and provides for overriding conventions.
|
// The main integration project for sbt. It brings all of the projects together, configures them, and provides for overriding conventions.
|
||||||
lazy val mainProj = (project in file("main"))
|
lazy val mainProj = (project in file("main"))
|
||||||
.enablePlugins(ContrabandPlugin)
|
.enablePlugins(ContrabandPlugin)
|
||||||
.dependsOn(logicProj, actionsProj, mainSettingsProj, runProj, commandProj, collectionProj,
|
.dependsOn(logicProj, actionsProj, mainSettingsProj, runProj, commandProj, collectionProj,
|
||||||
scriptedSbtReduxProj, scriptedPluginProj)
|
scriptedSbtReduxProj, scriptedPluginProj, zincLmIntegrationProj)
|
||||||
.settings(
|
.settings(
|
||||||
testedBaseSettings,
|
testedBaseSettings,
|
||||||
name := "Main",
|
name := "Main",
|
||||||
|
|
@ -798,6 +814,7 @@ def allProjects =
|
||||||
actionsProj,
|
actionsProj,
|
||||||
commandProj,
|
commandProj,
|
||||||
mainSettingsProj,
|
mainSettingsProj,
|
||||||
|
zincLmIntegrationProj,
|
||||||
mainProj,
|
mainProj,
|
||||||
sbtProj,
|
sbtProj,
|
||||||
bundledLauncherProj,
|
bundledLauncherProj,
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ import sbt.Scope.{ GlobalScope, ThisScope, fillTaskAxis }
|
||||||
import sbt.internal.CommandStrings.ExportStream
|
import sbt.internal.CommandStrings.ExportStream
|
||||||
import sbt.internal._
|
import sbt.internal._
|
||||||
import sbt.internal.inc.JavaInterfaceUtil._
|
import sbt.internal.inc.JavaInterfaceUtil._
|
||||||
import sbt.internal.inc.ZincUtil
|
import sbt.internal.inc.{ ZincLmUtil, ZincUtil }
|
||||||
import sbt.internal.io.{ Source, WatchState }
|
import sbt.internal.io.{ Source, WatchState }
|
||||||
import sbt.internal.librarymanagement.{ CustomHttp => _, _ }
|
import sbt.internal.librarymanagement.{ CustomHttp => _, _ }
|
||||||
import sbt.internal.librarymanagement.mavenint.{
|
import sbt.internal.librarymanagement.mavenint.{
|
||||||
|
|
@ -470,7 +470,7 @@ object Defaults extends BuildCommon {
|
||||||
IvyActions.cleanCachedResolutionCache(ivyModule.value, streams.value.log)
|
IvyActions.cleanCachedResolutionCache(ivyModule.value, streams.value.log)
|
||||||
},
|
},
|
||||||
scalaCompilerBridgeBinaryJar := None,
|
scalaCompilerBridgeBinaryJar := None,
|
||||||
scalaCompilerBridgeSource := ZincUtil.getDefaultBridgeModule(scalaVersion.value),
|
scalaCompilerBridgeSource := ZincLmUtil.getDefaultBridgeModule(scalaVersion.value),
|
||||||
)
|
)
|
||||||
// must be a val: duplication detected by object identity
|
// must be a val: duplication detected by object identity
|
||||||
private[this] lazy val compileBaseGlobal: Seq[Setting[_]] = globalDefaults(
|
private[this] lazy val compileBaseGlobal: Seq[Setting[_]] = globalDefaults(
|
||||||
|
|
@ -532,7 +532,7 @@ object Defaults extends BuildCommon {
|
||||||
compilerBridgeJar = jar
|
compilerBridgeJar = jar
|
||||||
)
|
)
|
||||||
case _ =>
|
case _ =>
|
||||||
ZincUtil.scalaCompiler(
|
ZincLmUtil.scalaCompiler(
|
||||||
scalaInstance = scalaInstance.value,
|
scalaInstance = scalaInstance.value,
|
||||||
classpathOptions = classpathOptions.value,
|
classpathOptions = classpathOptions.value,
|
||||||
globalLock = launcher.globalLock,
|
globalLock = launcher.globalLock,
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ package internal
|
||||||
|
|
||||||
import sbt.util.Logger
|
import sbt.util.Logger
|
||||||
import sbt.internal.util.JLine
|
import sbt.internal.util.JLine
|
||||||
import sbt.internal.inc.{ ScalaInstance, ZincUtil }
|
import sbt.internal.inc.{ ScalaInstance, ZincLmUtil, ZincUtil }
|
||||||
import xsbti.compile.ClasspathOptionsUtil
|
import xsbti.compile.ClasspathOptionsUtil
|
||||||
|
|
||||||
object ConsoleProject {
|
object ConsoleProject {
|
||||||
|
|
@ -41,7 +41,7 @@ object ConsoleProject {
|
||||||
compilerBridgeJar = jar
|
compilerBridgeJar = jar
|
||||||
)
|
)
|
||||||
case None =>
|
case None =>
|
||||||
ZincUtil.scalaCompiler(
|
ZincLmUtil.scalaCompiler(
|
||||||
scalaInstance = scalaInstance,
|
scalaInstance = scalaInstance,
|
||||||
classpathOptions = ClasspathOptionsUtil.repl,
|
classpathOptions = ClasspathOptionsUtil.repl,
|
||||||
globalLock = launcher.globalLock,
|
globalLock = launcher.globalLock,
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ import Keys.{
|
||||||
import Project.inScope
|
import Project.inScope
|
||||||
import sbt.internal.inc.classpath.ClasspathUtilities
|
import sbt.internal.inc.classpath.ClasspathUtilities
|
||||||
import sbt.librarymanagement.ivy.{ InlineIvyConfiguration, IvyDependencyResolution, IvyPaths }
|
import sbt.librarymanagement.ivy.{ InlineIvyConfiguration, IvyDependencyResolution, IvyPaths }
|
||||||
import sbt.internal.inc.{ ZincUtil, ScalaInstance }
|
import sbt.internal.inc.{ ZincLmUtil, ZincUtil, ScalaInstance }
|
||||||
import sbt.internal.util.Attributed.data
|
import sbt.internal.util.Attributed.data
|
||||||
import sbt.internal.util.Types.const
|
import sbt.internal.util.Types.const
|
||||||
import sbt.internal.util.{ Attributed, Settings, ~> }
|
import sbt.internal.util.{ Attributed, Settings, ~> }
|
||||||
|
|
@ -93,14 +93,14 @@ private[sbt] object Load {
|
||||||
val si = ScalaInstance(scalaProvider.version, scalaProvider.launcher)
|
val si = ScalaInstance(scalaProvider.version, scalaProvider.launcher)
|
||||||
val zincDir = BuildPaths.getZincDirectory(state, globalBase)
|
val zincDir = BuildPaths.getZincDirectory(state, globalBase)
|
||||||
val classpathOptions = ClasspathOptionsUtil.boot
|
val classpathOptions = ClasspathOptionsUtil.boot
|
||||||
val scalac = ZincUtil.scalaCompiler(
|
val scalac = ZincLmUtil.scalaCompiler(
|
||||||
scalaInstance = si,
|
scalaInstance = si,
|
||||||
classpathOptions = classpathOptions,
|
classpathOptions = classpathOptions,
|
||||||
globalLock = launcher.globalLock,
|
globalLock = launcher.globalLock,
|
||||||
componentProvider = app.provider.components,
|
componentProvider = app.provider.components,
|
||||||
secondaryCacheDir = Option(zincDir),
|
secondaryCacheDir = Option(zincDir),
|
||||||
dependencyResolution = dependencyResolution,
|
dependencyResolution = dependencyResolution,
|
||||||
compilerBridgeSource = ZincUtil.getDefaultBridgeModule(scalaProvider.version),
|
compilerBridgeSource = ZincLmUtil.getDefaultBridgeModule(scalaProvider.version),
|
||||||
scalaJarsTarget = zincDir,
|
scalaJarsTarget = zincDir,
|
||||||
log = log
|
log = log
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ object Dependencies {
|
||||||
case Some(version) => version
|
case Some(version) => version
|
||||||
case _ => "1.3.0-M3"
|
case _ => "1.3.0-M3"
|
||||||
}
|
}
|
||||||
private val zincVersion = "1.3.0-M3"
|
val zincVersion = "1.3.0-M3"
|
||||||
|
|
||||||
private val sbtIO = "org.scala-sbt" %% "io" % ioVersion
|
private val sbtIO = "org.scala-sbt" %% "io" % ioVersion
|
||||||
|
|
||||||
|
|
@ -29,6 +29,7 @@ object Dependencies {
|
||||||
private val utilScripted = "org.scala-sbt" %% "util-scripted" % utilVersion
|
private val utilScripted = "org.scala-sbt" %% "util-scripted" % utilVersion
|
||||||
|
|
||||||
private val libraryManagementCore = "org.scala-sbt" %% "librarymanagement-core" % lmVersion
|
private val libraryManagementCore = "org.scala-sbt" %% "librarymanagement-core" % lmVersion
|
||||||
|
private val libraryManagementIvy = "org.scala-sbt" %% "librarymanagement-ivy" % lmVersion
|
||||||
|
|
||||||
private val libraryManagementImpl = {
|
private val libraryManagementImpl = {
|
||||||
val lmOrganization =
|
val lmOrganization =
|
||||||
|
|
@ -56,9 +57,9 @@ object Dependencies {
|
||||||
private val compilerClasspath = "org.scala-sbt" %% "zinc-classpath" % zincVersion
|
private val compilerClasspath = "org.scala-sbt" %% "zinc-classpath" % zincVersion
|
||||||
private val compilerApiInfo = "org.scala-sbt" %% "zinc-apiinfo" % zincVersion
|
private val compilerApiInfo = "org.scala-sbt" %% "zinc-apiinfo" % zincVersion
|
||||||
private val compilerBridge = "org.scala-sbt" %% "compiler-bridge" % zincVersion
|
private val compilerBridge = "org.scala-sbt" %% "compiler-bridge" % zincVersion
|
||||||
private val compilerIvyIntegration = "org.scala-sbt" %% "zinc-ivy-integration" % zincVersion
|
|
||||||
private val zinc = "org.scala-sbt" %% "zinc" % zincVersion
|
private val zinc = "org.scala-sbt" %% "zinc" % zincVersion
|
||||||
private val zincCompile = "org.scala-sbt" %% "zinc-compile" % zincVersion
|
private val zincCompile = "org.scala-sbt" %% "zinc-compile" % zincVersion
|
||||||
|
private val zincCompileCore = "org.scala-sbt" %% "zinc-compile-core" % zincVersion
|
||||||
|
|
||||||
def getSbtModulePath(key: String, name: String) = {
|
def getSbtModulePath(key: String, name: String) = {
|
||||||
val localProps = new java.util.Properties()
|
val localProps = new java.util.Properties()
|
||||||
|
|
@ -73,11 +74,19 @@ object Dependencies {
|
||||||
lazy val sbtLmPath = getSbtModulePath("sbtlm.path", "sbt/lm")
|
lazy val sbtLmPath = getSbtModulePath("sbtlm.path", "sbt/lm")
|
||||||
lazy val sbtZincPath = getSbtModulePath("sbtzinc.path", "sbt/zinc")
|
lazy val sbtZincPath = getSbtModulePath("sbtzinc.path", "sbt/zinc")
|
||||||
|
|
||||||
def addSbtModule(p: Project, path: Option[String], projectName: String, m: ModuleID) =
|
def addSbtModule(
|
||||||
|
p: Project,
|
||||||
|
path: Option[String],
|
||||||
|
projectName: String,
|
||||||
|
moduleId: ModuleID,
|
||||||
|
c: Option[Configuration] = None
|
||||||
|
) = {
|
||||||
|
val m = moduleId.withConfigurations(c.map(_.name))
|
||||||
path match {
|
path match {
|
||||||
case Some(f) => p dependsOn ProjectRef(file(f), projectName)
|
case Some(f) => p dependsOn ClasspathDependency(ProjectRef(file(f), projectName), c.map(_.name))
|
||||||
case None => p settings (libraryDependencies += m, dependencyOverrides += m)
|
case None => p settings (libraryDependencies += m, dependencyOverrides += m)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def addSbtIO(p: Project): Project = addSbtModule(p, sbtIoPath, "io", sbtIO)
|
def addSbtIO(p: Project): Project = addSbtModule(p, sbtIoPath, "io", sbtIO)
|
||||||
|
|
||||||
|
|
@ -100,6 +109,8 @@ object Dependencies {
|
||||||
addSbtModule(p, sbtLmPath, "lmCore", libraryManagementCore)
|
addSbtModule(p, sbtLmPath, "lmCore", libraryManagementCore)
|
||||||
def addSbtLmImpl(p: Project): Project =
|
def addSbtLmImpl(p: Project): Project =
|
||||||
addSbtModule(p, sbtLmPath, "lmImpl", libraryManagementImpl)
|
addSbtModule(p, sbtLmPath, "lmImpl", libraryManagementImpl)
|
||||||
|
def addSbtLmIvyTest(p: Project): Project =
|
||||||
|
addSbtModule(p, sbtLmPath, "lmIvy", libraryManagementIvy, Some(Test))
|
||||||
|
|
||||||
def addSbtCompilerInterface(p: Project): Project =
|
def addSbtCompilerInterface(p: Project): Project =
|
||||||
addSbtModule(p, sbtZincPath, "compilerInterface212", compilerInterface)
|
addSbtModule(p, sbtZincPath, "compilerInterface212", compilerInterface)
|
||||||
|
|
@ -109,11 +120,11 @@ object Dependencies {
|
||||||
addSbtModule(p, sbtZincPath, "zincApiInfo212", compilerApiInfo)
|
addSbtModule(p, sbtZincPath, "zincApiInfo212", compilerApiInfo)
|
||||||
def addSbtCompilerBridge(p: Project): Project =
|
def addSbtCompilerBridge(p: Project): Project =
|
||||||
addSbtModule(p, sbtZincPath, "compilerBridge212", compilerBridge)
|
addSbtModule(p, sbtZincPath, "compilerBridge212", compilerBridge)
|
||||||
def addSbtCompilerIvyIntegration(p: Project): Project =
|
|
||||||
addSbtModule(p, sbtZincPath, "zincIvyIntegration", compilerIvyIntegration)
|
|
||||||
def addSbtZinc(p: Project): Project = addSbtModule(p, sbtZincPath, "zinc", zinc)
|
def addSbtZinc(p: Project): Project = addSbtModule(p, sbtZincPath, "zinc", zinc)
|
||||||
def addSbtZincCompile(p: Project): Project =
|
def addSbtZincCompile(p: Project): Project =
|
||||||
addSbtModule(p, sbtZincPath, "zincCompile", zincCompile)
|
addSbtModule(p, sbtZincPath, "zincCompile", zincCompile)
|
||||||
|
def addSbtZincCompileCore(p: Project): Project =
|
||||||
|
addSbtModule(p, sbtZincPath, "zincCompileCore", zincCompileCore)
|
||||||
|
|
||||||
val sjsonNewScalaJson = Def.setting {
|
val sjsonNewScalaJson = Def.setting {
|
||||||
"com.eed3si9n" %% "sjson-new-scalajson" % contrabandSjsonNewVersion.value
|
"com.eed3si9n" %% "sjson-new-scalajson" % contrabandSjsonNewVersion.value
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* Zinc - The incremental compiler for Scala.
|
* sbt
|
||||||
* Copyright 2011 - 2017, Lightbend, Inc.
|
* Copyright 2011 - 2018, Lightbend, Inc.
|
||||||
* Copyright 2008 - 2010, Mark Harrah
|
* Copyright 2008 - 2010, Mark Harrah
|
||||||
* This software is released under the terms written in LICENSE.
|
* Licensed under Apache License 2.0 (see LICENSE)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package xsbti.compile;
|
package xsbti.compile;
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* Zinc - The incremental compiler for Scala.
|
* sbt
|
||||||
* Copyright 2011 - 2017, Lightbend, Inc.
|
* Copyright 2011 - 2018, Lightbend, Inc.
|
||||||
* Copyright 2008 - 2010, Mark Harrah
|
* Copyright 2008 - 2010, Mark Harrah
|
||||||
* This software is released under the terms written in LICENSE.
|
* Licensed under Apache License 2.0 (see LICENSE)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package sbt.internal.inc
|
package sbt.internal.inc
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* Zinc - The incremental compiler for Scala.
|
* sbt
|
||||||
* Copyright 2011 - 2017, Lightbend, Inc.
|
* Copyright 2011 - 2018, Lightbend, Inc.
|
||||||
* Copyright 2008 - 2010, Mark Harrah
|
* Copyright 2008 - 2010, Mark Harrah
|
||||||
* This software is released under the terms written in LICENSE.
|
* Licensed under Apache License 2.0 (see LICENSE)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package sbt.internal.inc
|
package sbt.internal.inc
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* Zinc - The incremental compiler for Scala.
|
* sbt
|
||||||
* Copyright 2011 - 2017, Lightbend, Inc.
|
* Copyright 2011 - 2018, Lightbend, Inc.
|
||||||
* Copyright 2008 - 2010, Mark Harrah
|
* Copyright 2008 - 2010, Mark Harrah
|
||||||
* This software is released under the terms written in LICENSE.
|
* Licensed under Apache License 2.0 (see LICENSE)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package sbt.internal.inc
|
package sbt.internal.inc
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* Zinc - The incremental compiler for Scala.
|
* sbt
|
||||||
* Copyright 2011 - 2017, Lightbend, Inc.
|
* Copyright 2011 - 2018, Lightbend, Inc.
|
||||||
* Copyright 2008 - 2010, Mark Harrah
|
* Copyright 2008 - 2010, Mark Harrah
|
||||||
* This software is released under the terms written in LICENSE.
|
* Licensed under Apache License 2.0 (see LICENSE)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package sbt
|
package sbt
|
||||||
|
|
@ -40,11 +40,14 @@ private[sbt] object ZincComponentCompiler {
|
||||||
private[sbt] def getDefaultBridgeModule(scalaVersion: String): ModuleID = {
|
private[sbt] def getDefaultBridgeModule(scalaVersion: String): ModuleID = {
|
||||||
def compilerBridgeId(scalaVersion: String) = {
|
def compilerBridgeId(scalaVersion: String) = {
|
||||||
scalaVersion match {
|
scalaVersion match {
|
||||||
case sc if (sc startsWith "2.10.") => "compiler-bridge_2.10"
|
case sc if (sc startsWith "2.10.") => "compiler-bridge_2.10"
|
||||||
case sc if (sc startsWith "2.11.") => "compiler-bridge_2.11"
|
case sc if (sc startsWith "2.11.") => "compiler-bridge_2.11"
|
||||||
case sc if (sc startsWith "2.12.") => "compiler-bridge_2.12"
|
case sc if (sc startsWith "2.12.") => "compiler-bridge_2.12"
|
||||||
case "2.13.0-M1" => "compiler-bridge_2.12"
|
case "2.13.0-M1" => "compiler-bridge_2.12"
|
||||||
case _ => "compiler-bridge_2.13"
|
case sc if (sc startsWith "2.13.0-pre-") => "compiler-bridge_2.13.0-M5"
|
||||||
|
case sc if (sc startsWith "2.13.0-M") => "compiler-bridge_2.13.0-M5"
|
||||||
|
case sc if (sc startsWith "2.13.0-RC") => "compiler-bridge_2.13.0-M5"
|
||||||
|
case _ => "compiler-bridge_2.13"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
import xsbti.ArtifactInfo.SbtOrganization
|
import xsbti.ArtifactInfo.SbtOrganization
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* Zinc - The incremental compiler for Scala.
|
* sbt
|
||||||
* Copyright 2011 - 2017, Lightbend, Inc.
|
* Copyright 2011 - 2018, Lightbend, Inc.
|
||||||
* Copyright 2008 - 2010, Mark Harrah
|
* Copyright 2008 - 2010, Mark Harrah
|
||||||
* This software is released under the terms written in LICENSE.
|
* Licensed under Apache License 2.0 (see LICENSE)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package sbt
|
package sbt
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* Zinc - The incremental compiler for Scala.
|
* sbt
|
||||||
* Copyright 2011 - 2017, Lightbend, Inc.
|
* Copyright 2011 - 2018, Lightbend, Inc.
|
||||||
* Copyright 2008 - 2010, Mark Harrah
|
* Copyright 2008 - 2010, Mark Harrah
|
||||||
* This software is released under the terms written in LICENSE.
|
* Licensed under Apache License 2.0 (see LICENSE)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package sbt.internal.inc
|
package sbt.internal.inc
|
||||||
|
|
@ -1,19 +1,28 @@
|
||||||
|
/*
|
||||||
|
* sbt
|
||||||
|
* Copyright 2011 - 2018, Lightbend, Inc.
|
||||||
|
* Copyright 2008 - 2010, Mark Harrah
|
||||||
|
* Licensed under Apache License 2.0 (see LICENSE)
|
||||||
|
*/
|
||||||
|
|
||||||
package sbt.internal.inc
|
package sbt.internal.inc
|
||||||
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
|
import sbt.io.IO
|
||||||
import sbt.io.syntax._
|
import sbt.io.syntax._
|
||||||
import sbt.librarymanagement._
|
import sbt.librarymanagement._
|
||||||
import sbt.librarymanagement.ivy._
|
import sbt.librarymanagement.ivy._
|
||||||
import sbt.util.Logger
|
import sbt.util.Logger
|
||||||
import xsbti.compile.CompilerBridgeProvider
|
import xsbti.compile.CompilerBridgeProvider
|
||||||
|
import org.scalatest._
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for test suites that must be able to fetch and compile the compiler bridge.
|
* Base class for test suites that must be able to fetch and compile the compiler bridge.
|
||||||
*
|
*
|
||||||
* This is a very good example on how to instantiate the compiler bridge provider.
|
* This is a very good example on how to instantiate the compiler bridge provider.
|
||||||
*/
|
*/
|
||||||
abstract class IvyBridgeProviderSpecification extends UnitSpec with AbstractBridgeProviderTestkit {
|
abstract class IvyBridgeProviderSpecification extends FlatSpec with Matchers {
|
||||||
def currentBase: File = new File(".")
|
def currentBase: File = new File(".")
|
||||||
def currentTarget: File = currentBase / "target" / "ivyhome"
|
def currentTarget: File = currentBase / "target" / "ivyhome"
|
||||||
def currentManaged: File = currentBase / "target" / "lib_managed"
|
def currentManaged: File = currentBase / "target" / "lib_managed"
|
||||||
|
|
@ -24,7 +33,8 @@ abstract class IvyBridgeProviderSpecification extends UnitSpec with AbstractBrid
|
||||||
MavenRepository("scala-integration",
|
MavenRepository("scala-integration",
|
||||||
"https://scala-ci.typesafe.com/artifactory/scala-integration/")
|
"https://scala-ci.typesafe.com/artifactory/scala-integration/")
|
||||||
)
|
)
|
||||||
private val ivyConfiguration =
|
|
||||||
|
private def ivyConfiguration(log: Logger) =
|
||||||
getDefaultConfiguration(currentBase, currentTarget, resolvers, log)
|
getDefaultConfiguration(currentBase, currentTarget, resolvers, log)
|
||||||
|
|
||||||
def secondaryCacheDirectory: File = {
|
def secondaryCacheDirectory: File = {
|
||||||
|
|
@ -32,13 +42,28 @@ abstract class IvyBridgeProviderSpecification extends UnitSpec with AbstractBrid
|
||||||
target / "zinc-components"
|
target / "zinc-components"
|
||||||
}
|
}
|
||||||
|
|
||||||
def getZincProvider(targetDir: File, log: Logger): CompilerBridgeProvider = {
|
def getZincProvider(bridge: ModuleID, targetDir: File, log: Logger): CompilerBridgeProvider = {
|
||||||
val lock = ZincComponentCompiler.getDefaultLock
|
val lock = ZincComponentCompiler.getDefaultLock
|
||||||
val secondaryCache = Some(secondaryCacheDirectory)
|
val secondaryCache = Some(secondaryCacheDirectory)
|
||||||
val componentProvider = ZincComponentCompiler.getDefaultComponentProvider(targetDir)
|
val componentProvider = ZincComponentCompiler.getDefaultComponentProvider(targetDir)
|
||||||
val manager = new ZincComponentManager(lock, componentProvider, secondaryCache, log)
|
val manager = new ZincComponentManager(lock, componentProvider, secondaryCache, log)
|
||||||
val dependencyResolution = IvyDependencyResolution(ivyConfiguration)
|
val dependencyResolution = IvyDependencyResolution(ivyConfiguration(log))
|
||||||
ZincComponentCompiler.interfaceProvider(manager, dependencyResolution, currentManaged)
|
ZincComponentCompiler.interfaceProvider(bridge, manager, dependencyResolution, currentManaged)
|
||||||
|
}
|
||||||
|
|
||||||
|
def getCompilerBridge(targetDir: File, log: Logger, scalaVersion: String): File = {
|
||||||
|
val bridge0 = ZincComponentCompiler.getDefaultBridgeModule(scalaVersion)
|
||||||
|
// redefine the compiler bridge version
|
||||||
|
// using the version of zinc used during testing
|
||||||
|
// this way when building with zinc as a source dependency
|
||||||
|
// these specs don't go looking for some SHA-suffixed compiler bridge
|
||||||
|
val bridge1 = bridge0.withRevision(ZincLmIntegrationBuildInfo.zincVersion)
|
||||||
|
val provider = getZincProvider(bridge1, targetDir, log)
|
||||||
|
val scalaInstance = provider.fetchScalaInstance(scalaVersion, log)
|
||||||
|
val bridge = provider.fetchCompiledBridge(scalaInstance, log)
|
||||||
|
val target = targetDir / s"target-bridge-$scalaVersion.jar"
|
||||||
|
IO.copyFile(bridge, target)
|
||||||
|
target
|
||||||
}
|
}
|
||||||
|
|
||||||
private def getDefaultConfiguration(baseDirectory: File,
|
private def getDefaultConfiguration(baseDirectory: File,
|
||||||
|
|
@ -1,3 +1,10 @@
|
||||||
|
/*
|
||||||
|
* sbt
|
||||||
|
* Copyright 2011 - 2018, Lightbend, Inc.
|
||||||
|
* Copyright 2008 - 2010, Mark Harrah
|
||||||
|
* Licensed under Apache License 2.0 (see LICENSE)
|
||||||
|
*/
|
||||||
|
|
||||||
package sbt.internal.inc
|
package sbt.internal.inc
|
||||||
|
|
||||||
import sbt.internal.util.ConsoleLogger
|
import sbt.internal.util.ConsoleLogger
|
||||||
|
|
@ -11,10 +18,13 @@ class ZincComponentCompilerSpec extends IvyBridgeProviderSpecification {
|
||||||
val scala2121 = "2.12.1"
|
val scala2121 = "2.12.1"
|
||||||
val scala2122 = "2.12.2"
|
val scala2122 = "2.12.2"
|
||||||
val scala2123 = "2.12.3"
|
val scala2123 = "2.12.3"
|
||||||
|
val scala2130M2 = "2.13.0-M2"
|
||||||
val scala2130RC1 = "2.13.0-RC1"
|
val scala2130RC1 = "2.13.0-RC1"
|
||||||
|
|
||||||
def isJava8: Boolean = sys.props("java.specification.version") == "1.8"
|
def isJava8: Boolean = sys.props("java.specification.version") == "1.8"
|
||||||
|
|
||||||
val logger = ConsoleLogger()
|
val logger = ConsoleLogger()
|
||||||
|
|
||||||
it should "compile the bridge for Scala 2.10.5 and 2.10.6" in {
|
it should "compile the bridge for Scala 2.10.5 and 2.10.6" in {
|
||||||
if (isJava8) {
|
if (isJava8) {
|
||||||
IO.withTemporaryDirectory(t => getCompilerBridge(t, logger, scala2105) should exist)
|
IO.withTemporaryDirectory(t => getCompilerBridge(t, logger, scala2105) should exist)
|
||||||
|
|
@ -35,6 +45,10 @@ class ZincComponentCompilerSpec extends IvyBridgeProviderSpecification {
|
||||||
IO.withTemporaryDirectory(t => getCompilerBridge(t, logger, scala2123) should exist)
|
IO.withTemporaryDirectory(t => getCompilerBridge(t, logger, scala2123) should exist)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
it should "compile the bridge for Scala 2.13.0-M2" in {
|
||||||
|
IO.withTemporaryDirectory(t => getCompilerBridge(t, logger, scala2130M2) should exist)
|
||||||
|
}
|
||||||
|
|
||||||
it should "compile the bridge for Scala 2.13.0-RC1" in {
|
it should "compile the bridge for Scala 2.13.0-RC1" in {
|
||||||
IO.withTemporaryDirectory(t => getCompilerBridge(t, logger, scala2130RC1) should exist)
|
IO.withTemporaryDirectory(t => getCompilerBridge(t, logger, scala2130RC1) should exist)
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue