mirror of https://github.com/sbt/sbt.git
Upgrade util/lm/zinc & config build for util modules
Welcome back home!
This commit is contained in:
parent
7322acc571
commit
9494967e05
75
build.sbt
75
build.sbt
|
|
@ -124,6 +124,34 @@ lazy val bundledLauncherProj =
|
|||
|
||||
/* ** subproject declarations ** */
|
||||
|
||||
val collectionProj = (project in file("internal") / "util-collection")
|
||||
.settings(
|
||||
testedBaseSettings,
|
||||
Util.keywordsSettings,
|
||||
name := "Collections",
|
||||
libraryDependencies ++= Seq(sjsonNewScalaJson.value)
|
||||
)
|
||||
.configure(addSbtUtilPosition)
|
||||
|
||||
// Command line-related utilities.
|
||||
val completeProj = (project in file("internal") / "util-complete")
|
||||
.dependsOn(collectionProj)
|
||||
.settings(
|
||||
testedBaseSettings,
|
||||
name := "Completion",
|
||||
libraryDependencies += jline
|
||||
)
|
||||
.configure(addSbtIO, addSbtUtilControl)
|
||||
|
||||
// A logic with restricted negation as failure for a unique, stable model
|
||||
val logicProj = (project in file("internal") / "util-logic")
|
||||
.dependsOn(collectionProj)
|
||||
.settings(
|
||||
testedBaseSettings,
|
||||
name := "Logic"
|
||||
)
|
||||
.configure(addSbtUtilRelation)
|
||||
|
||||
/* **** Intermediate-level Modules **** */
|
||||
|
||||
// Runner for uniform test interface
|
||||
|
|
@ -154,21 +182,23 @@ lazy val testAgentProj = (project in file("testing") / "agent")
|
|||
|
||||
// Basic task engine
|
||||
lazy val taskProj = (project in file("tasks"))
|
||||
.dependsOn(collectionProj)
|
||||
.settings(
|
||||
testedBaseSettings,
|
||||
name := "Tasks"
|
||||
)
|
||||
.configure(addSbtUtilControl, addSbtUtilCollection)
|
||||
.configure(addSbtUtilControl)
|
||||
|
||||
// Standard task system. This provides map, flatMap, join, and more on top of the basic task model.
|
||||
lazy val stdTaskProj = (project in file("tasks-standard"))
|
||||
.dependsOn(collectionProj)
|
||||
.dependsOn(taskProj % "compile;test->test")
|
||||
.settings(
|
||||
testedBaseSettings,
|
||||
name := "Task System",
|
||||
testExclusive
|
||||
)
|
||||
.configure(addSbtUtilCollection, addSbtUtilLogging, addSbtUtilCache, addSbtIO)
|
||||
.configure(addSbtIO, addSbtUtilLogging, addSbtUtilCache)
|
||||
|
||||
// Embedded Scala code runner
|
||||
lazy val runProj = (project in file("run"))
|
||||
|
|
@ -201,24 +231,23 @@ lazy val scriptedPluginProj = (project in scriptedPath / "plugin")
|
|||
|
||||
// Implementation and support code for defining actions.
|
||||
lazy val actionsProj = (project in file("main-actions"))
|
||||
.dependsOn(runProj, stdTaskProj, taskProj, testingProj)
|
||||
.dependsOn(completeProj, runProj, stdTaskProj, taskProj, testingProj)
|
||||
.settings(
|
||||
testedBaseSettings,
|
||||
name := "Actions",
|
||||
libraryDependencies += sjsonNewScalaJson.value
|
||||
)
|
||||
.configure(
|
||||
addSbtCompilerClasspath,
|
||||
addSbtUtilCompletion,
|
||||
addSbtCompilerApiInfo,
|
||||
addSbtZinc,
|
||||
addSbtCompilerIvyIntegration,
|
||||
addSbtCompilerInterface,
|
||||
addSbtIO,
|
||||
addSbtUtilLogging,
|
||||
addSbtUtilRelation,
|
||||
addSbtCompilerInterface,
|
||||
addSbtCompilerClasspath,
|
||||
addSbtCompilerApiInfo,
|
||||
addSbtUtilTracking,
|
||||
addSbtLm,
|
||||
addSbtUtilTracking
|
||||
addSbtCompilerIvyIntegration,
|
||||
addSbtZinc
|
||||
)
|
||||
|
||||
lazy val protocolProj = (project in file("protocol"))
|
||||
|
|
@ -237,7 +266,7 @@ lazy val protocolProj = (project in file("protocol"))
|
|||
// General command support and core commands not specific to a build system
|
||||
lazy val commandProj = (project in file("main-command"))
|
||||
.enablePlugins(ContrabandPlugin, JsonCodecPlugin)
|
||||
.dependsOn(protocolProj)
|
||||
.dependsOn(protocolProj, completeProj)
|
||||
.settings(
|
||||
testedBaseSettings,
|
||||
name := "Command",
|
||||
|
|
@ -248,10 +277,9 @@ lazy val commandProj = (project in file("main-command"))
|
|||
contrabandFormatsForType in generateContrabands in Compile := ContrabandConfig.getFormats
|
||||
)
|
||||
.configure(
|
||||
addSbtCompilerInterface,
|
||||
addSbtIO,
|
||||
addSbtUtilLogging,
|
||||
addSbtUtilCompletion,
|
||||
addSbtCompilerInterface,
|
||||
addSbtCompilerClasspath,
|
||||
addSbtLm
|
||||
)
|
||||
|
|
@ -259,12 +287,12 @@ lazy val commandProj = (project in file("main-command"))
|
|||
// The core macro project defines the main logic of the DSL, abstracted
|
||||
// away from several sbt implementators (tasks, settings, et cetera).
|
||||
lazy val coreMacrosProj = (project in file("core-macros"))
|
||||
.dependsOn(collectionProj)
|
||||
.settings(
|
||||
commonSettings,
|
||||
name := "Core Macros",
|
||||
libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value
|
||||
)
|
||||
.configure(addSbtUtilCollection)
|
||||
|
||||
/* Write all the compile-time dependencies of the spores macro to a file,
|
||||
* in order to read it from the created Toolbox to run the neg tests. */
|
||||
|
|
@ -288,19 +316,18 @@ lazy val generateToolboxClasspath = Def.task {
|
|||
|
||||
// Fixes scope=Scope for Setting (core defined in collectionProj) to define the settings system used in build definitions
|
||||
lazy val mainSettingsProj = (project in file("main-settings"))
|
||||
.dependsOn(commandProj, stdTaskProj, coreMacrosProj)
|
||||
.dependsOn(completeProj, commandProj, stdTaskProj, coreMacrosProj)
|
||||
.settings(
|
||||
testedBaseSettings,
|
||||
name := "Main Settings",
|
||||
resourceGenerators in Compile += generateToolboxClasspath.taskValue
|
||||
)
|
||||
.configure(
|
||||
addSbtUtilCache,
|
||||
addSbtCompilerInterface,
|
||||
addSbtUtilRelation,
|
||||
addSbtUtilLogging,
|
||||
addSbtIO,
|
||||
addSbtUtilCompletion,
|
||||
addSbtUtilLogging,
|
||||
addSbtUtilCache,
|
||||
addSbtUtilRelation,
|
||||
addSbtCompilerInterface,
|
||||
addSbtCompilerClasspath,
|
||||
addSbtLm
|
||||
)
|
||||
|
|
@ -308,7 +335,7 @@ lazy val mainSettingsProj = (project in file("main-settings"))
|
|||
// 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"))
|
||||
.enablePlugins(ContrabandPlugin)
|
||||
.dependsOn(actionsProj, mainSettingsProj, runProj, commandProj)
|
||||
.dependsOn(logicProj, actionsProj, mainSettingsProj, runProj, commandProj)
|
||||
.settings(
|
||||
testedBaseSettings,
|
||||
name := "Main",
|
||||
|
|
@ -318,10 +345,9 @@ lazy val mainProj = (project in file("main"))
|
|||
sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala"
|
||||
)
|
||||
.configure(
|
||||
addSbtCompilerInterface,
|
||||
addSbtIO,
|
||||
addSbtUtilLogging,
|
||||
addSbtUtilLogic,
|
||||
addSbtCompilerInterface,
|
||||
addSbtLm,
|
||||
addSbtZincCompile
|
||||
)
|
||||
|
|
@ -379,6 +405,9 @@ lazy val publishLauncher = TaskKey[Unit]("publish-launcher")
|
|||
|
||||
def allProjects =
|
||||
Seq(
|
||||
collectionProj,
|
||||
logicProj,
|
||||
completeProj,
|
||||
testingProj,
|
||||
testAgentProj,
|
||||
taskProj,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
package sbt.internal.util
|
||||
|
||||
import org.scalatest._
|
||||
|
||||
abstract class UnitSpec extends FlatSpec with Matchers
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
package sbt.internal.util
|
||||
|
||||
import org.scalatest._
|
||||
|
||||
abstract class UnitSpec extends FlatSpec with Matchers
|
||||
|
|
@ -16,6 +16,7 @@ import sbt.util.Logger
|
|||
|
||||
import sbt.util.{ CacheStoreFactory, FilesInfo, ModifiedFileInfo, PlainFileInfo }
|
||||
import sbt.internal.util.HNil
|
||||
import sbt.internal.util.HListFormats._
|
||||
import sbt.util.FileInfo.{ exists, lastModified }
|
||||
import sbt.util.CacheImplicits._
|
||||
import sbt.util.Tracked.inputChanged
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import sbt.io.syntax._
|
|||
import sbt.io.IO
|
||||
|
||||
import sbt.internal.util.Types.:+:
|
||||
import sbt.internal.util.HListFormats._
|
||||
import sbt.util.CacheImplicits._
|
||||
import sbt.util.Tracked.inputChanged
|
||||
import sbt.util.{ CacheStoreFactory, FilesInfo, HashFileInfo, ModifiedFileInfo, PlainFileInfo }
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package sbt.internal
|
|||
import sbt.internal.librarymanagement._
|
||||
import sbt.internal.util.Types._
|
||||
import sbt.internal.util.{ HList, HNil }
|
||||
import sbt.internal.util.HListFormats._
|
||||
import sbt.io.{ Hash, IO }
|
||||
import sbt.librarymanagement._
|
||||
import sbt.util.CacheImplicits._
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import java.io.File
|
|||
import sbt.internal.librarymanagement._
|
||||
import sbt.internal.util.HNil
|
||||
import sbt.internal.util.Types._
|
||||
import sbt.internal.util.HListFormats._
|
||||
import sbt.librarymanagement._
|
||||
import sbt.librarymanagement.syntax._
|
||||
import sbt.util.CacheImplicits._
|
||||
|
|
|
|||
|
|
@ -13,22 +13,19 @@ object Dependencies {
|
|||
|
||||
// sbt modules
|
||||
private val ioVersion = "1.0.0-M12"
|
||||
private val utilVersion = "1.0.0-M25"
|
||||
private val lmVersion = "1.0.0-X16"
|
||||
private val zincVersion = "1.0.0-X17"
|
||||
private val utilVersion = "1.0.0-M26"
|
||||
private val lmVersion = "1.0.0-X17"
|
||||
private val zincVersion = "1.0.0-X18"
|
||||
|
||||
private val sbtIO = "org.scala-sbt" %% "io" % ioVersion
|
||||
|
||||
private val utilCache = "org.scala-sbt" %% "util-cache" % utilVersion
|
||||
private val utilCollection = "org.scala-sbt" %% "util-collection" % utilVersion
|
||||
private val utilCompletion = "org.scala-sbt" %% "util-completion" % utilVersion
|
||||
private val utilControl = "org.scala-sbt" %% "util-control" % utilVersion
|
||||
private val utilPosition = "org.scala-sbt" %% "util-position" % utilVersion
|
||||
private val utilLogging = "org.scala-sbt" %% "util-logging" % utilVersion
|
||||
private val utilLogic = "org.scala-sbt" %% "util-logic" % utilVersion
|
||||
private val utilCache = "org.scala-sbt" %% "util-cache" % utilVersion
|
||||
private val utilControl = "org.scala-sbt" %% "util-control" % utilVersion
|
||||
private val utilRelation = "org.scala-sbt" %% "util-relation" % utilVersion
|
||||
private val utilScripted = "org.scala-sbt" %% "util-scripted" % utilVersion
|
||||
private val utilTesting = "org.scala-sbt" %% "util-testing" % utilVersion
|
||||
private val utilTracking = "org.scala-sbt" %% "util-tracking" % utilVersion
|
||||
private val utilScripted = "org.scala-sbt" %% "util-scripted" % utilVersion
|
||||
|
||||
private val libraryManagement = "org.scala-sbt" %% "librarymanagement" % lmVersion
|
||||
|
||||
|
|
@ -36,10 +33,10 @@ object Dependencies {
|
|||
val rawLauncher = "org.scala-sbt" % "launcher" % "1.0.0"
|
||||
val testInterface = "org.scala-sbt" % "test-interface" % "1.0"
|
||||
|
||||
private val compilerInterface = "org.scala-sbt" % "compiler-interface" % zincVersion
|
||||
private val compilerClasspath = "org.scala-sbt" %% "zinc-classpath" % zincVersion
|
||||
private val compilerApiInfo = "org.scala-sbt" %% "zinc-apiinfo" % zincVersion
|
||||
private val compilerBridge = "org.scala-sbt" %% "compiler-bridge" % zincVersion
|
||||
private val compilerClasspath = "org.scala-sbt" %% "zinc-classpath" % zincVersion
|
||||
private val compilerInterface = "org.scala-sbt" % "compiler-interface" % zincVersion
|
||||
private val compilerIvyIntegration = "org.scala-sbt" %% "zinc-ivy-integration" % zincVersion
|
||||
private val zinc = "org.scala-sbt" %% "zinc" % zincVersion
|
||||
private val zincCompile = "org.scala-sbt" %% "zinc-compile" % zincVersion
|
||||
|
|
@ -57,51 +54,39 @@ object Dependencies {
|
|||
lazy val sbtLmPath = getSbtModulePath("sbtlm.path", "sbt/lm")
|
||||
lazy val sbtZincPath = getSbtModulePath("sbtzinc.path", "sbt/zinc")
|
||||
|
||||
def addSbtModule(
|
||||
p: Project,
|
||||
path: Option[String],
|
||||
projectName: String,
|
||||
m: ModuleID,
|
||||
c: Option[Configuration] = None
|
||||
) =
|
||||
def addSbtModule(p: Project, path: Option[String], projectName: String, m: ModuleID) =
|
||||
path match {
|
||||
case Some(f) =>
|
||||
p dependsOn c.fold[ClasspathDep[ProjectReference]](ProjectRef(file(f), projectName))(
|
||||
ProjectRef(file(f), projectName) % _)
|
||||
case None => p settings (libraryDependencies += c.fold(m)(m % _))
|
||||
case Some(f) => p dependsOn ProjectRef(file(f), projectName)
|
||||
case None => p settings (libraryDependencies += m)
|
||||
}
|
||||
|
||||
def addSbtIO(p: Project): Project = addSbtModule(p, sbtIoPath, "io", sbtIO)
|
||||
|
||||
def addSbtUtilCache(p: Project): Project = addSbtModule(p, sbtUtilPath, "utilCache", utilCache)
|
||||
def addSbtUtilCollection(p: Project): Project =
|
||||
addSbtModule(p, sbtUtilPath, "utilCollection", utilCollection)
|
||||
def addSbtUtilCompletion(p: Project): Project =
|
||||
addSbtModule(p, sbtUtilPath, "utilComplete", utilCompletion)
|
||||
def addSbtUtilControl(p: Project): Project =
|
||||
addSbtModule(p, sbtUtilPath, "utilControl", utilControl)
|
||||
def addSbtUtilPosition(p: Project): Project =
|
||||
addSbtModule(p, sbtUtilPath, "utilPosition", utilPosition)
|
||||
def addSbtUtilLogging(p: Project): Project =
|
||||
addSbtModule(p, sbtUtilPath, "utilLogging", utilLogging)
|
||||
def addSbtUtilLogic(p: Project): Project = addSbtModule(p, sbtUtilPath, "utilLogic", utilLogic)
|
||||
def addSbtUtilCache(p: Project): Project =
|
||||
addSbtModule(p, sbtUtilPath, "utilCache", utilCache)
|
||||
def addSbtUtilControl(p: Project): Project =
|
||||
addSbtModule(p, sbtUtilPath, "utilControl", utilControl)
|
||||
def addSbtUtilRelation(p: Project): Project =
|
||||
addSbtModule(p, sbtUtilPath, "utilRelation", utilRelation)
|
||||
def addSbtUtilScripted(p: Project): Project =
|
||||
addSbtModule(p, sbtUtilPath, "utilScripted", utilScripted)
|
||||
def addSbtUtilTesting(p: Project): Project =
|
||||
addSbtModule(p, sbtUtilPath, "utilTesting", utilTesting, Some(Test))
|
||||
def addSbtUtilTracking(p: Project): Project =
|
||||
addSbtModule(p, sbtUtilPath, "utilTracking", utilTracking)
|
||||
def addSbtUtilScripted(p: Project): Project =
|
||||
addSbtModule(p, sbtUtilPath, "utilScripted", utilScripted)
|
||||
|
||||
def addSbtLm(p: Project): Project = addSbtModule(p, sbtLmPath, "lm", libraryManagement)
|
||||
|
||||
def addSbtCompilerInterface(p: Project): Project =
|
||||
addSbtModule(p, sbtZincPath, "compilerInterface", compilerInterface)
|
||||
def addSbtCompilerClasspath(p: Project): Project =
|
||||
addSbtModule(p, sbtZincPath, "zincClasspath", compilerClasspath)
|
||||
def addSbtCompilerApiInfo(p: Project): Project =
|
||||
addSbtModule(p, sbtZincPath, "zincApiInfo", compilerApiInfo)
|
||||
def addSbtCompilerBridge(p: Project): Project =
|
||||
addSbtModule(p, sbtZincPath, "compilerBridge", compilerBridge)
|
||||
def addSbtCompilerClasspath(p: Project): Project =
|
||||
addSbtModule(p, sbtZincPath, "zincClasspath", compilerClasspath)
|
||||
def addSbtCompilerInterface(p: Project): Project =
|
||||
addSbtModule(p, sbtZincPath, "compilerInterface", compilerInterface)
|
||||
def addSbtCompilerIvyIntegration(p: Project): Project =
|
||||
addSbtModule(p, sbtZincPath, "zincIvyIntegration", compilerIvyIntegration)
|
||||
def addSbtZinc(p: Project): Project = addSbtModule(p, sbtZincPath, "zinc", zinc)
|
||||
|
|
@ -109,6 +94,8 @@ object Dependencies {
|
|||
addSbtModule(p, sbtZincPath, "zincCompile", zincCompile)
|
||||
|
||||
val sjsonNewScalaJson = Def.setting { "com.eed3si9n" %% "sjson-new-scalajson" % contrabandSjsonNewVersion.value }
|
||||
|
||||
val jline = "jline" % "jline" % "2.14.4"
|
||||
val scalatest = "org.scalatest" %% "scalatest" % "3.0.1"
|
||||
val scalaCheck = "org.scalacheck" %% "scalacheck" % "1.13.4"
|
||||
val specs2 = "org.specs2" %% "specs2" % "2.4.17"
|
||||
|
|
|
|||
|
|
@ -162,13 +162,14 @@ object Util {
|
|||
def writeScalaKeywords(base: File, keywords: Set[String]): File = {
|
||||
val init = keywords.map(tn => '"' + tn + '"').mkString("Set(", ", ", ")")
|
||||
val ObjectName = "ScalaKeywords"
|
||||
val PackageName = "sbt"
|
||||
val keywordsSrc =
|
||||
"""package %s
|
||||
object %s {
|
||||
val values = %s
|
||||
}""".format(PackageName, ObjectName, init)
|
||||
val out = base / PackageName.replace('.', '/') / (ObjectName + ".scala")
|
||||
val PackageName = "sbt.internal.util"
|
||||
val keywordsSrc = s"""
|
||||
|package $PackageName
|
||||
|object $ObjectName {
|
||||
| val values = $init
|
||||
|}
|
||||
""".trim.stripMargin
|
||||
val out = base / PackageName.replace('.', '/') / s"$ObjectName.scala"
|
||||
IO.write(out, keywordsSrc)
|
||||
out
|
||||
}
|
||||
|
|
@ -179,7 +180,8 @@ object %s {
|
|||
scalaKeywords := getScalaKeywords,
|
||||
generateKeywords := writeScalaKeywords(sourceManaged.value, scalaKeywords.value),
|
||||
sourceGenerators += Def.task(Seq(generateKeywords.value)).taskValue
|
||||
))
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
object Licensed {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ lazy val root = (project in file("."))
|
|||
type In = IvyConfiguration :+: ModuleSettings :+: UpdateConfiguration :+: HNil
|
||||
|
||||
import sbt.util.CacheImplicits._
|
||||
import sbt.internal.util.HListFormats._
|
||||
import sbt.internal.AltLibraryManagementCodec._
|
||||
|
||||
val f: In => Unit =
|
||||
|
|
|
|||
Loading…
Reference in New Issue