Make use of the nicer Project settings syntax in 0.13.8.

This commit is contained in:
Dale Wijnand 2015-03-26 23:22:24 +00:00
parent bb111fdac4
commit 5c2ec63fa6
2 changed files with 68 additions and 56 deletions

120
build.sbt
View File

@ -42,9 +42,10 @@ def testedBaseSettings: Seq[Setting[_]] =
lazy val root: Project = (project in file(".")).
configs(Sxr.sxrConf).
aggregate(nonRoots: _*).
settings(buildLevelSettings: _*).
settings(minimalSettings ++ rootSettings: _*).
settings(
buildLevelSettings,
minimalSettings,
rootSettings,
publish := {},
publishLocal := {}
)
@ -52,27 +53,30 @@ lazy val root: Project = (project in file(".")).
// This is used to configure an sbt-launcher for this version of sbt.
lazy val bundledLauncherProj =
(project in file("launch")).
settings(minimalSettings:_*).
settings(inConfig(Compile)(Transform.configSettings):_*).
settings(Release.launcherSettings(sbtLaunchJar):_*).
settings(
minimalSettings,
inConfig(Compile)(Transform.configSettings),
Release.launcherSettings(sbtLaunchJar)
).
enablePlugins(SbtLauncherPlugin).
settings(
name := "sbt-launch",
moduleName := "sbt-launch",
description := "sbt application launcher",
publishArtifact in packageSrc := false,
autoScalaLibrary := false,
publish := Release.deployLauncher.value,
publishLauncher := Release.deployLauncher.value,
packageBin in Compile := sbtLaunchJar.value
name := "sbt-launch",
moduleName := "sbt-launch",
description := "sbt application launcher",
publishArtifact in packageSrc := false,
autoScalaLibrary := false,
publish := Release.deployLauncher.value,
publishLauncher := Release.deployLauncher.value,
packageBin in Compile := sbtLaunchJar.value
)
// This is used only for command aggregation
lazy val allPrecompiled: Project = (project in file("all-precompiled")).
aggregate(precompiled282, precompiled292, precompiled293).
settings(buildLevelSettings ++ minimalSettings: _*).
settings(
buildLevelSettings,
minimalSettings,
publish := {},
publishLocal := {}
)
@ -83,8 +87,9 @@ lazy val allPrecompiled: Project = (project in file("all-precompiled")).
// the analysis compiler phases and passed back to sbt. The API structures are defined in a simple
// format from which Java sources are generated by the datatype generator Projproject
lazy val interfaceProj = (project in file("interface")).
settings(minimalSettings ++ javaOnlySettings: _*).
settings(
minimalSettings,
javaOnlySettings,
name := "Interface",
projectComponent,
exportJars := true,
@ -105,31 +110,34 @@ lazy val interfaceProj = (project in file("interface")).
// and discovery of Projclasses and annotations
lazy val apiProj = (project in compilePath / "api").
dependsOn(interfaceProj).
settings(testedBaseSettings: _*).
settings(
testedBaseSettings,
name := "API"
)
/* **** Utilities **** */
lazy val controlProj = (project in utilPath / "control").
settings(baseSettings ++ Util.crossBuild: _*).
settings(
baseSettings,
Util.crossBuild,
name := "Control",
crossScalaVersions := Seq(scala210, scala211)
)
lazy val collectionProj = (project in utilPath / "collection").
settings(testedBaseSettings ++ Util.keywordsSettings ++ Util.crossBuild: _*).
settings(
testedBaseSettings,
Util.keywordsSettings,
Util.crossBuild,
name := "Collections",
crossScalaVersions := Seq(scala210, scala211)
)
lazy val applyMacroProj = (project in utilPath / "appmacro").
dependsOn(collectionProj).
settings(testedBaseSettings: _*).
settings(
testedBaseSettings,
name := "Apply Macro",
libraryDependencies += scalaCompiler.value
)
@ -137,8 +145,8 @@ lazy val applyMacroProj = (project in utilPath / "appmacro").
// The API for forking, combining, and doing I/O with system processes
lazy val processProj = (project in utilPath / "process").
dependsOn(ioProj % "test->test").
settings(baseSettings: _*).
settings(
baseSettings,
name := "Process",
libraryDependencies ++= scalaXml.value
)
@ -146,8 +154,9 @@ lazy val processProj = (project in utilPath / "process").
// Path, IO (formerly FileUtilities), NameFilter and other I/O utility classes
lazy val ioProj = (project in utilPath / "io").
dependsOn(controlProj).
settings(testedBaseSettings ++ Util.crossBuild: _*).
settings(
testedBaseSettings,
Util.crossBuild,
name := "IO",
libraryDependencies += scalaCompiler.value % Test,
crossScalaVersions := Seq(scala210, scala211)
@ -156,8 +165,8 @@ lazy val ioProj = (project in utilPath / "io").
// Utilities related to reflection, managing Scala versions, and custom class loaders
lazy val classpathProj = (project in utilPath / "classpath").
dependsOn(interfaceProj, ioProj).
settings(testedBaseSettings: _*).
settings(
testedBaseSettings,
name := "Classpath",
libraryDependencies ++= Seq(scalaCompiler.value,Dependencies.launcherInterface)
)
@ -165,8 +174,9 @@ lazy val classpathProj = (project in utilPath / "classpath").
// Command line-related utilities.
lazy val completeProj = (project in utilPath / "complete").
dependsOn(collectionProj, controlProj, ioProj).
settings(testedBaseSettings ++ Util.crossBuild: _*).
settings(
testedBaseSettings,
Util.crossBuild,
name := "Completion",
libraryDependencies += jline,
crossScalaVersions := Seq(scala210, scala211)
@ -175,8 +185,8 @@ lazy val completeProj = (project in utilPath / "complete").
// logging
lazy val logProj = (project in utilPath / "log").
dependsOn(interfaceProj, processProj).
settings(testedBaseSettings: _*).
settings(
testedBaseSettings,
name := "Logging",
libraryDependencies += jline
)
@ -184,40 +194,40 @@ lazy val logProj = (project in utilPath / "log").
// Relation
lazy val relationProj = (project in utilPath / "relation").
dependsOn(interfaceProj, processProj).
settings(testedBaseSettings: _*).
settings(
testedBaseSettings,
name := "Relation"
)
// class file reader and analyzer
lazy val classfileProj = (project in utilPath / "classfile").
dependsOn(ioProj, interfaceProj, logProj).
settings(testedBaseSettings: _*).
settings(
testedBaseSettings,
name := "Classfile"
)
// generates immutable or mutable Java data types according to a simple input format
lazy val datatypeProj = (project in utilPath / "datatype").
dependsOn(ioProj).
settings(baseSettings: _*).
settings(
baseSettings,
name := "Datatype Generator"
)
// cross versioning
lazy val crossProj = (project in utilPath / "cross").
settings(baseSettings: _*).
settings(inConfig(Compile)(Transform.crossGenSettings): _*).
settings(
baseSettings,
inConfig(Compile)(Transform.crossGenSettings),
name := "Cross"
)
// A logic with restricted negation as failure for a unique, stable model
lazy val logicProj = (project in utilPath / "logic").
dependsOn(collectionProj, relationProj).
settings(testedBaseSettings: _*).
settings(
testedBaseSettings,
name := "Logic"
)
@ -226,8 +236,8 @@ lazy val logicProj = (project in utilPath / "logic").
// Apache Ivy integration
lazy val ivyProj = (project in file("ivy")).
dependsOn(interfaceProj, crossProj, logProj % "compile;test->test", ioProj % "compile;test->test", /*launchProj % "test->test",*/ collectionProj).
settings(baseSettings: _*).
settings(
baseSettings,
name := "Ivy",
libraryDependencies ++= Seq(ivy, jsch, sbtSerialization, launcherInterface),
testExclusive)
@ -235,16 +245,16 @@ lazy val ivyProj = (project in file("ivy")).
// Runner for uniform test interface
lazy val testingProj = (project in file("testing")).
dependsOn(ioProj, classpathProj, logProj, testAgentProj).
settings(baseSettings: _*).
settings(
baseSettings,
name := "Testing",
libraryDependencies ++= Seq(testInterface,launcherInterface)
)
// Testing agent for running tests in a separate process.
lazy val testAgentProj = (project in file("testing") / "agent").
settings(minimalSettings: _*).
settings(
minimalSettings,
name := "Test Agent",
libraryDependencies += testInterface
)
@ -252,16 +262,16 @@ lazy val testAgentProj = (project in file("testing") / "agent").
// Basic task engine
lazy val taskProj = (project in tasksPath).
dependsOn(controlProj, collectionProj).
settings(testedBaseSettings: _*).
settings(
testedBaseSettings,
name := "Tasks"
)
// Standard task system. This provides map, flatMap, join, and more on top of the basic task model.
lazy val stdTaskProj = (project in tasksPath / "standard").
dependsOn (taskProj % "compile;test->test", collectionProj, logProj, ioProj, processProj).
settings(testedBaseSettings: _*).
settings(
testedBaseSettings,
name := "Task System",
testExclusive
)
@ -269,8 +279,8 @@ lazy val stdTaskProj = (project in tasksPath / "standard").
// Persisted caching based on SBinary
lazy val cacheProj = (project in cachePath).
dependsOn (ioProj, collectionProj).
settings(baseSettings: _*).
settings(
baseSettings,
name := "Cache",
libraryDependencies ++= Seq(sbinary, sbtSerialization) ++ scalaXml.value
)
@ -278,16 +288,16 @@ lazy val cacheProj = (project in cachePath).
// Builds on cache to provide caching for filesystem-related operations
lazy val trackingProj = (project in cachePath / "tracking").
dependsOn(cacheProj, ioProj).
settings(baseSettings: _*).
settings(
baseSettings,
name := "Tracking"
)
// Embedded Scala code runner
lazy val runProj = (project in file("run")).
dependsOn (ioProj, logProj % "compile;test->test", classpathProj, processProj % "compile;test->test").
settings(testedBaseSettings: _*).
settings(
testedBaseSettings,
name := "Run"
)
@ -295,8 +305,9 @@ lazy val runProj = (project in file("run")).
// Includes API and Analyzer phases that extract source API and relationships.
lazy val compileInterfaceProj = (project in compilePath / "interface").
dependsOn(interfaceProj % "compile;test->test", ioProj % "test->test", logProj % "test->test", /*launchProj % "test->test",*/ apiProj % "test->test").
settings(baseSettings ++ precompiledSettings: _*).
settings(
baseSettings,
precompiledSettings,
name := "Compiler Interface",
exportJars := true,
// we need to fork because in unit tests we set usejavacp = true which means
@ -317,16 +328,16 @@ lazy val precompiled293 = precompiled(scala293)
// Defines the data structures for representing file fingerprints and relationships and the overall source analysis
lazy val compileIncrementalProj = (project in compilePath / "inc").
dependsOn (apiProj, ioProj, logProj, classpathProj, relationProj).
settings(testedBaseSettings: _*).
settings(
testedBaseSettings,
name := "Incremental Compiler"
)
// Persists the incremental data structures using SBinary
lazy val compilePersistProj = (project in compilePath / "persist").
dependsOn(compileIncrementalProj, apiProj, compileIncrementalProj % "test->test").
settings(testedBaseSettings: _*).
settings(
testedBaseSettings,
name := "Persist",
libraryDependencies += sbinary
)
@ -335,8 +346,8 @@ lazy val compilePersistProj = (project in compilePath / "persist").
lazy val compilerProj = (project in compilePath).
dependsOn(interfaceProj % "compile;test->test", logProj, ioProj, classpathProj, apiProj, classfileProj,
logProj % "test->test" /*,launchProj % "test->test" */).
settings(testedBaseSettings: _*).
settings(
testedBaseSettings,
name := "Compile",
libraryDependencies ++= Seq(scalaCompiler.value % Test, launcherInterface),
unmanagedJars in Test <<= (packageSrc in compileInterfaceProj in Compile).map(x => Seq(x).classpath)
@ -344,38 +355,38 @@ lazy val compilerProj = (project in compilePath).
lazy val compilerIntegrationProj = (project in (compilePath / "integration")).
dependsOn(compileIncrementalProj, compilerProj, compilePersistProj, apiProj, classfileProj).
settings(baseSettings: _*).
settings(
baseSettings,
name := "Compiler Integration"
)
lazy val compilerIvyProj = (project in compilePath / "ivy").
dependsOn (ivyProj, compilerProj).
settings(baseSettings: _*).
settings(
baseSettings,
name := "Compiler Ivy Integration"
)
lazy val scriptedBaseProj = (project in scriptedPath / "base").
dependsOn (ioProj, processProj).
settings(testedBaseSettings: _*).
settings(
testedBaseSettings,
name := "Scripted Framework",
libraryDependencies ++= scalaParsers.value
)
lazy val scriptedSbtProj = (project in scriptedPath / "sbt").
dependsOn (ioProj, logProj, processProj, scriptedBaseProj).
settings(baseSettings: _*).
settings(
baseSettings,
name := "Scripted sbt",
libraryDependencies += launcherInterface % "provided"
)
lazy val scriptedPluginProj = (project in scriptedPath / "plugin").
dependsOn (sbtProj, classpathProj).
settings(baseSettings: _*).
settings(
baseSettings,
name := "Scripted Plugin"
)
@ -384,16 +395,16 @@ lazy val actionsProj = (project in mainPath / "actions").
dependsOn (classpathProj, completeProj, apiProj, compilerIntegrationProj, compilerIvyProj,
interfaceProj, ioProj, ivyProj, logProj, processProj, runProj, relationProj, stdTaskProj,
taskProj, trackingProj, testingProj).
settings(testedBaseSettings: _*).
settings(
testedBaseSettings,
name := "Actions"
)
// General command support and core commands not specific to a build system
lazy val commandProj = (project in mainPath / "command").
dependsOn(interfaceProj, ioProj, logProj, completeProj, classpathProj, crossProj).
settings(testedBaseSettings: _*).
settings(
testedBaseSettings,
name := "Command",
libraryDependencies += launcherInterface
)
@ -402,8 +413,8 @@ lazy val commandProj = (project in mainPath / "command").
lazy val mainSettingsProj = (project in mainPath / "settings").
dependsOn (applyMacroProj, interfaceProj, ivyProj, relationProj, logProj, ioProj, commandProj,
completeProj, classpathProj, stdTaskProj, processProj).
settings(testedBaseSettings: _*).
settings(
testedBaseSettings,
name := "Main Settings",
libraryDependencies += sbinary
)
@ -411,8 +422,8 @@ lazy val mainSettingsProj = (project in mainPath / "settings").
// The main integration project for sbt. It brings all of the Projsystems together, configures them, and provides for overriding conventions.
lazy val mainProj = (project in mainPath).
dependsOn (actionsProj, mainSettingsProj, interfaceProj, ioProj, ivyProj, logProj, logicProj, processProj, runProj, commandProj).
settings(testedBaseSettings: _*).
settings(
testedBaseSettings,
name := "Main",
libraryDependencies ++= scalaXml.value ++ Seq(launcherInterface)
)
@ -422,16 +433,16 @@ lazy val mainProj = (project in mainPath).
// with the sole purpose of providing certain identifiers without qualification (with a package object)
lazy val sbtProj = (project in sbtPath).
dependsOn(mainProj, compileInterfaceProj, precompiled282, precompiled292, precompiled293, scriptedSbtProj % "test->test").
settings(baseSettings: _*).
settings(
baseSettings,
name := "sbt",
normalizedName := "sbt"
)
lazy val mavenResolverPluginProj = (project in file("sbt-maven-resolver")).
dependsOn(sbtProj, ivyProj % "test->test").
settings(baseSettings: _*).
settings(
baseSettings,
name := "sbt-maven-resolver",
libraryDependencies ++= aetherLibs,
sbtPlugin := true
@ -532,8 +543,9 @@ def precompiledSettings = Seq(
def precompiled(scalav: String): Project = Project(id = normalize("Precompiled " + scalav.replace('.', '_')), base = compilePath / "interface").
dependsOn(interfaceProj).
settings(baseSettings ++ precompiledSettings: _*).
settings(
baseSettings,
precompiledSettings,
name := "Precompiled " + scalav.replace('.', '_'),
scalaHome := None,
scalaVersion <<= (scalaVersion in ThisBuild) { sbtScalaV =>

View File

@ -45,12 +45,12 @@ object Build {
def defaultID(base: File, prefix: String = "default"): String = prefix + "-" + Hash.trimHashString(base.getAbsolutePath, 6)
@deprecated("Explicitly specify the ID", "0.13.0")
def defaultProject(base: File): Project = defaultProject(defaultID(base), base)
def defaultProject(id: String, base: File): Project = Project(id, base).settings(defaultProjectSettings: _*)
def defaultProject(id: String, base: File): Project = Project(id, base).settings(defaultProjectSettings)
def defaultAggregatedProject(id: String, base: File, agg: Seq[ProjectRef]): Project =
defaultProject(id, base).aggregate(agg: _*)
private[sbt] def generatedRootWithoutIvyPlugin(id: String, base: File, agg: Seq[ProjectRef]): Project =
Project.mkGeneratedRoot(id, base, agg).settings(defaultProjectSettings: _*)
Project.mkGeneratedRoot(id, base, agg).settings(defaultProjectSettings)
private[sbt] def defaultProjectSettings: Seq[Setting[_]] = Seq(
// TODO - Can we move this somewhere else? ordering of settings is causing this to get borked.
// if the user has overridden the name, use the normal organization that is derived from the name.