2014-12-18 05:38:10 +01:00
|
|
|
import Project.Initialize
|
|
|
|
|
import Util._
|
2014-12-18 13:57:05 +01:00
|
|
|
import Dependencies._
|
2014-12-18 05:38:10 +01:00
|
|
|
import Licensed._
|
|
|
|
|
import Scope.ThisScope
|
|
|
|
|
import LaunchProguard.{ proguard, Proguard }
|
|
|
|
|
import Scripted._
|
|
|
|
|
import StringUtilities.normalize
|
|
|
|
|
import Sxr.sxr
|
|
|
|
|
|
2015-02-06 19:48:12 +01:00
|
|
|
// ThisBuild settings take lower precedence,
|
|
|
|
|
// but can be shared across the multi projects.
|
|
|
|
|
def buildLevelSettings: Seq[Setting[_]] = Seq(
|
|
|
|
|
organization in ThisBuild := "org.scala-sbt",
|
|
|
|
|
version in ThisBuild := "0.13.8-SNAPSHOT"
|
|
|
|
|
)
|
|
|
|
|
|
2014-12-18 05:38:10 +01:00
|
|
|
def commonSettings: Seq[Setting[_]] = Seq(
|
2015-02-03 04:44:02 +01:00
|
|
|
scalaVersion := "2.10.4",
|
2014-12-18 05:38:10 +01:00
|
|
|
publishArtifact in packageDoc := false,
|
|
|
|
|
publishMavenStyle := false,
|
|
|
|
|
componentID := None,
|
|
|
|
|
crossPaths := false,
|
|
|
|
|
resolvers += Resolver.typesafeIvyRepo("releases"),
|
|
|
|
|
concurrentRestrictions in Global += Util.testExclusiveRestriction,
|
|
|
|
|
testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"),
|
|
|
|
|
javacOptions in compile ++= Seq("-target", "6", "-source", "6", "-Xlint", "-Xlint:-serial"),
|
2015-02-03 04:44:02 +01:00
|
|
|
incOptions := incOptions.value.withNameHashing(true),
|
|
|
|
|
crossScalaVersions := Seq(scala210)
|
2014-12-18 05:38:10 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
def minimalSettings: Seq[Setting[_]] =
|
2014-12-18 23:40:20 +01:00
|
|
|
commonSettings ++ customCommands ++ Status.settings ++
|
|
|
|
|
publishPomSettings ++ Release.javaVersionCheckSettings
|
2014-12-18 05:38:10 +01:00
|
|
|
|
|
|
|
|
def baseSettings: Seq[Setting[_]] =
|
|
|
|
|
minimalSettings ++ Seq(projectComponent) ++ baseScalacOptions ++ Licensed.settings ++ Formatting.settings
|
|
|
|
|
|
|
|
|
|
def testedBaseSettings: Seq[Setting[_]] =
|
|
|
|
|
baseSettings ++ testDependencies
|
|
|
|
|
|
|
|
|
|
lazy val root: Project = (project in file(".")).
|
|
|
|
|
configs(Sxr.sxrConf, Proguard).
|
|
|
|
|
aggregate(nonRoots: _*).
|
2015-02-06 19:48:12 +01:00
|
|
|
settings(buildLevelSettings: _*).
|
2014-12-18 05:38:10 +01:00
|
|
|
settings(minimalSettings ++ rootSettings: _*)
|
|
|
|
|
|
2014-12-18 19:14:04 +01:00
|
|
|
/* ** subproject declarations ** */
|
2014-12-18 05:38:10 +01:00
|
|
|
|
|
|
|
|
// defines the Java interfaces through which the launcher and the launched application communicate
|
|
|
|
|
lazy val launchInterfaceProj = (project in launchPath / "interface").
|
|
|
|
|
settings(minimalSettings ++ javaOnlySettings: _*).
|
|
|
|
|
settings(
|
|
|
|
|
name := "Launcher Interface"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// the launcher. Retrieves, loads, and runs applications based on a configuration file.
|
|
|
|
|
lazy val launchProj = (project in launchPath).
|
|
|
|
|
dependsOn(ioProj % "test->test", interfaceProj % Test, launchInterfaceProj).
|
|
|
|
|
settings(testedBaseSettings: _*).
|
|
|
|
|
settings(
|
|
|
|
|
name := "Launcher",
|
2014-12-18 13:57:05 +01:00
|
|
|
libraryDependencies += ivy,
|
2014-12-18 05:38:10 +01:00
|
|
|
compile in Test <<= compile in Test dependsOn (publishLocal in interfaceProj, publishLocal in testSamples, publishLocal in launchInterfaceProj)
|
|
|
|
|
).
|
|
|
|
|
settings(inConfig(Compile)(Transform.configSettings): _*).
|
|
|
|
|
settings(inConfig(Compile)(Transform.transSourceSettings ++ Seq(
|
|
|
|
|
Transform.inputSourceDirectory <<= (sourceDirectory in crossProj) / "input_sources",
|
|
|
|
|
Transform.sourceProperties := Map("cross.package0" -> "xsbt", "cross.package1" -> "boot")
|
|
|
|
|
)): _*)
|
|
|
|
|
|
|
|
|
|
// used to test the retrieving and loading of an application: sample app is packaged and published to the local repository
|
|
|
|
|
lazy val testSamples = (project in launchPath / "test-sample").
|
|
|
|
|
dependsOn(interfaceProj, launchInterfaceProj).
|
|
|
|
|
settings(baseSettings ++ noPublishSettings: _*).
|
2014-12-18 13:57:05 +01:00
|
|
|
settings(
|
2014-12-19 02:09:06 +01:00
|
|
|
name := "Launch Test",
|
2014-12-18 13:57:05 +01:00
|
|
|
libraryDependencies += scalaCompiler.value
|
|
|
|
|
)
|
2014-12-18 05:38:10 +01:00
|
|
|
|
|
|
|
|
// defines Java structures used across Scala versions, such as the API structures and relationships extracted by
|
|
|
|
|
// 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(
|
|
|
|
|
name := "Interface",
|
|
|
|
|
projectComponent,
|
|
|
|
|
exportJars := true,
|
|
|
|
|
componentID := Some("xsbti"),
|
|
|
|
|
watchSources <++= apiDefinitions,
|
|
|
|
|
resourceGenerators in Compile <+= (version, resourceManaged, streams, compile in Compile) map generateVersionFile,
|
|
|
|
|
apiDefinitions <<= baseDirectory map { base => (base / "definition") :: (base / "other") :: (base / "type") :: Nil },
|
2015-02-03 04:44:02 +01:00
|
|
|
sourceGenerators in Compile <+= (cacheDirectory,
|
|
|
|
|
apiDefinitions,
|
|
|
|
|
fullClasspath in Compile in datatypeProj,
|
|
|
|
|
sourceManaged in Compile,
|
|
|
|
|
mainClass in datatypeProj in Compile,
|
|
|
|
|
runner,
|
|
|
|
|
streams) map generateAPICached
|
2014-12-18 05:38:10 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// defines operations on the API of a source, including determining whether it has changed and converting it to a string
|
|
|
|
|
// and discovery of Projclasses and annotations
|
|
|
|
|
lazy val apiProj = (project in compilePath / "api").
|
|
|
|
|
dependsOn(interfaceProj).
|
|
|
|
|
settings(testedBaseSettings: _*).
|
|
|
|
|
settings(
|
|
|
|
|
name := "API"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
/* **** Utilities **** */
|
|
|
|
|
|
|
|
|
|
lazy val controlProj = (project in utilPath / "control").
|
|
|
|
|
settings(baseSettings ++ Util.crossBuild: _*).
|
|
|
|
|
settings(
|
2015-02-03 06:40:19 +01:00
|
|
|
name := "Control",
|
|
|
|
|
crossScalaVersions := Seq(scala210, scala211)
|
2014-12-18 05:38:10 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
lazy val collectionProj = (project in utilPath / "collection").
|
|
|
|
|
settings(testedBaseSettings ++ Util.keywordsSettings ++ Util.crossBuild: _*).
|
|
|
|
|
settings(
|
2015-02-03 06:40:19 +01:00
|
|
|
name := "Collections",
|
|
|
|
|
crossScalaVersions := Seq(scala210, scala211)
|
2014-12-18 05:38:10 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
lazy val applyMacroProj = (project in utilPath / "appmacro").
|
|
|
|
|
dependsOn(collectionProj).
|
|
|
|
|
settings(testedBaseSettings: _*).
|
|
|
|
|
settings(
|
|
|
|
|
name := "Apply Macro",
|
2014-12-18 13:57:05 +01:00
|
|
|
libraryDependencies += scalaCompiler.value
|
2014-12-18 05:38:10 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// 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(
|
|
|
|
|
name := "Process",
|
2014-12-18 13:57:05 +01:00
|
|
|
libraryDependencies ++= scalaXml.value
|
2014-12-18 05:38:10 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// 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(
|
|
|
|
|
name := "IO",
|
2015-02-03 06:40:19 +01:00
|
|
|
libraryDependencies += scalaCompiler.value % Test,
|
|
|
|
|
crossScalaVersions := Seq(scala210, scala211)
|
2014-12-18 05:38:10 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Utilities related to reflection, managing Scala versions, and custom class loaders
|
|
|
|
|
lazy val classpathProj = (project in utilPath / "classpath").
|
|
|
|
|
dependsOn(launchInterfaceProj, interfaceProj, ioProj).
|
|
|
|
|
settings(testedBaseSettings: _*).
|
|
|
|
|
settings(
|
|
|
|
|
name := "Classpath",
|
2014-12-18 13:57:05 +01:00
|
|
|
libraryDependencies += scalaCompiler.value
|
2014-12-18 05:38:10 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Command line-related utilities.
|
|
|
|
|
lazy val completeProj = (project in utilPath / "complete").
|
|
|
|
|
dependsOn(collectionProj, controlProj, ioProj).
|
|
|
|
|
settings(testedBaseSettings ++ Util.crossBuild: _*).
|
|
|
|
|
settings(
|
|
|
|
|
name := "Completion",
|
2015-02-03 06:40:19 +01:00
|
|
|
libraryDependencies += jline,
|
|
|
|
|
crossScalaVersions := Seq(scala210, scala211)
|
2014-12-18 05:38:10 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// logging
|
|
|
|
|
lazy val logProj = (project in utilPath / "log").
|
|
|
|
|
dependsOn(interfaceProj, processProj).
|
|
|
|
|
settings(testedBaseSettings: _*).
|
|
|
|
|
settings(
|
|
|
|
|
name := "Logging",
|
2014-12-18 13:57:05 +01:00
|
|
|
libraryDependencies += jline
|
2014-12-18 05:38:10 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Relation
|
|
|
|
|
lazy val relationProj = (project in utilPath / "relation").
|
|
|
|
|
dependsOn(interfaceProj, processProj).
|
|
|
|
|
settings(testedBaseSettings: _*).
|
|
|
|
|
settings(
|
|
|
|
|
name := "Relation"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// class file reader and analyzer
|
|
|
|
|
lazy val classfileProj = (project in utilPath / "classfile").
|
|
|
|
|
dependsOn(ioProj, interfaceProj, logProj).
|
|
|
|
|
settings(testedBaseSettings: _*).
|
|
|
|
|
settings(
|
|
|
|
|
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(
|
|
|
|
|
name := "Datatype Generator"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// cross versioning
|
|
|
|
|
lazy val crossProj = (project in utilPath / "cross").
|
|
|
|
|
settings(baseSettings: _*).
|
|
|
|
|
settings(inConfig(Compile)(Transform.crossGenSettings): _*).
|
|
|
|
|
settings(
|
|
|
|
|
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(
|
|
|
|
|
name := "Logic"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
/* **** Intermediate-level Modules **** */
|
|
|
|
|
|
|
|
|
|
// Apache Ivy integration
|
|
|
|
|
lazy val ivyProj = (project in file("ivy")).
|
|
|
|
|
dependsOn(interfaceProj, launchInterfaceProj, crossProj, logProj % "compile;test->test", ioProj % "compile;test->test", launchProj % "test->test", collectionProj).
|
|
|
|
|
settings(baseSettings: _*).
|
|
|
|
|
settings(
|
|
|
|
|
name := "Ivy",
|
2015-01-09 00:02:59 +01:00
|
|
|
libraryDependencies ++= Seq(ivy, jsch, json4sNative, jawnParser, jawnJson4s),
|
2014-12-18 13:57:05 +01:00
|
|
|
testExclusive)
|
2014-12-18 05:38:10 +01:00
|
|
|
|
|
|
|
|
// Runner for uniform test interface
|
|
|
|
|
lazy val testingProj = (project in file("testing")).
|
|
|
|
|
dependsOn(ioProj, classpathProj, logProj, launchInterfaceProj, testAgentProj).
|
|
|
|
|
settings(baseSettings: _*).
|
|
|
|
|
settings(
|
|
|
|
|
name := "Testing",
|
2014-12-18 13:57:05 +01:00
|
|
|
libraryDependencies += testInterface
|
2014-12-18 05:38:10 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Testing agent for running tests in a separate process.
|
|
|
|
|
lazy val testAgentProj = (project in file("testing") / "agent").
|
|
|
|
|
settings(minimalSettings: _*).
|
|
|
|
|
settings(
|
|
|
|
|
name := "Test Agent",
|
2014-12-18 13:57:05 +01:00
|
|
|
libraryDependencies += testInterface
|
2014-12-18 05:38:10 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Basic task engine
|
|
|
|
|
lazy val taskProj = (project in tasksPath).
|
|
|
|
|
dependsOn(controlProj, collectionProj).
|
|
|
|
|
settings(testedBaseSettings: _*).
|
|
|
|
|
settings(
|
|
|
|
|
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(
|
|
|
|
|
name := "Task System",
|
|
|
|
|
testExclusive
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Persisted caching based on SBinary
|
|
|
|
|
lazy val cacheProj = (project in cachePath).
|
|
|
|
|
dependsOn (ioProj, collectionProj).
|
|
|
|
|
settings(baseSettings: _*).
|
|
|
|
|
settings(
|
|
|
|
|
name := "Cache",
|
2014-12-18 13:57:05 +01:00
|
|
|
libraryDependencies ++= Seq(sbinary) ++ scalaXml.value
|
2014-12-18 05:38:10 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Builds on cache to provide caching for filesystem-related operations
|
|
|
|
|
lazy val trackingProj = (project in cachePath / "tracking").
|
|
|
|
|
dependsOn(cacheProj, ioProj).
|
|
|
|
|
settings(baseSettings: _*).
|
|
|
|
|
settings(
|
|
|
|
|
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(
|
|
|
|
|
name := "Run"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Compiler-side interface to compiler that is compiled against the compiler being used either in advance or on the fly.
|
|
|
|
|
// 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(
|
|
|
|
|
name := "Compiler Interface",
|
|
|
|
|
exportJars := true,
|
|
|
|
|
// we need to fork because in unit tests we set usejavacp = true which means
|
|
|
|
|
// we are expecting all of our dependencies to be on classpath so Scala compiler
|
|
|
|
|
// can use them while constructing its own classpath for compilation
|
|
|
|
|
fork in Test := true,
|
|
|
|
|
// needed because we fork tests and tests are ran in parallel so we have multiple Scala
|
|
|
|
|
// compiler instances that are memory hungry
|
|
|
|
|
javaOptions in Test += "-Xmx1G",
|
|
|
|
|
artifact in (Compile, packageSrc) := Artifact(srcID).copy(configurations = Compile :: Nil).extra("e:component" -> srcID)
|
|
|
|
|
)
|
|
|
|
|
|
2015-02-04 01:36:45 +01:00
|
|
|
def precompiledSettings = Seq(
|
|
|
|
|
artifact in packageBin <<= (appConfiguration, scalaVersion) { (app, sv) =>
|
|
|
|
|
val launcher = app.provider.scalaProvider.launcher
|
|
|
|
|
val bincID = binID + "_" + ScalaInstance(sv, launcher).actualVersion
|
|
|
|
|
Artifact(binID) extra ("e:component" -> bincID)
|
|
|
|
|
},
|
|
|
|
|
target <<= (target, scalaVersion) { (base, sv) => base / ("precompiled_" + sv) },
|
|
|
|
|
scalacOptions := Nil,
|
|
|
|
|
ivyScala ~= { _.map(_.copy(checkExplicit = false, overrideScalaVersion = false)) },
|
|
|
|
|
exportedProducts in Compile := Nil,
|
|
|
|
|
libraryDependencies += scalaCompiler.value % "provided"
|
|
|
|
|
)
|
2014-12-18 05:38:10 +01:00
|
|
|
|
|
|
|
|
// Implements the core functionality of detecting and propagating changes incrementally.
|
|
|
|
|
// 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(
|
|
|
|
|
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(
|
|
|
|
|
name := "Persist",
|
2014-12-18 13:57:05 +01:00
|
|
|
libraryDependencies += sbinary
|
2014-12-18 05:38:10 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// sbt-side interface to compiler. Calls compiler-side interface reflectively
|
|
|
|
|
lazy val compilerProj = (project in compilePath).
|
|
|
|
|
dependsOn(launchInterfaceProj, interfaceProj % "compile;test->test", logProj, ioProj, classpathProj, apiProj, classfileProj,
|
|
|
|
|
logProj % "test->test", launchProj % "test->test").
|
|
|
|
|
settings(testedBaseSettings: _*).
|
|
|
|
|
settings(
|
|
|
|
|
name := "Compile",
|
2014-12-18 13:57:05 +01:00
|
|
|
libraryDependencies += scalaCompiler.value % Test,
|
2014-12-18 05:38:10 +01:00
|
|
|
unmanagedJars in Test <<= (packageSrc in compileInterfaceProj in Compile).map(x => Seq(x).classpath)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
lazy val compilerIntegrationProj = (project in (compilePath / "integration")).
|
|
|
|
|
dependsOn(compileIncrementalProj, compilerProj, compilePersistProj, apiProj, classfileProj).
|
|
|
|
|
settings(baseSettings: _*).
|
|
|
|
|
settings(
|
|
|
|
|
name := "Compiler Integration"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
lazy val compilerIvyProj = (project in compilePath / "ivy").
|
|
|
|
|
dependsOn (ivyProj, compilerProj).
|
|
|
|
|
settings(baseSettings: _*).
|
|
|
|
|
settings(
|
|
|
|
|
name := "Compiler Ivy Integration"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
lazy val scriptedBaseProj = (project in scriptedPath / "base").
|
|
|
|
|
dependsOn (ioProj, processProj).
|
|
|
|
|
settings(testedBaseSettings: _*).
|
|
|
|
|
settings(
|
|
|
|
|
name := "Scripted Framework",
|
2014-12-18 13:57:05 +01:00
|
|
|
libraryDependencies ++= scalaParsers.value
|
2014-12-18 05:38:10 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
lazy val scriptedSbtProj = (project in scriptedPath / "sbt").
|
|
|
|
|
dependsOn (ioProj, logProj, processProj, scriptedBaseProj, launchInterfaceProj % "provided").
|
|
|
|
|
settings(baseSettings: _*).
|
|
|
|
|
settings(
|
|
|
|
|
name := "Scripted sbt"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
lazy val scriptedPluginProj = (project in scriptedPath / "plugin").
|
|
|
|
|
dependsOn (sbtProj, classpathProj).
|
|
|
|
|
settings(baseSettings: _*).
|
|
|
|
|
settings(
|
|
|
|
|
name := "Scripted Plugin"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Implementation and support code for defining actions.
|
|
|
|
|
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(
|
|
|
|
|
name := "Actions"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// General command support and core commands not specific to a build system
|
|
|
|
|
lazy val commandProj = (project in mainPath / "command").
|
|
|
|
|
dependsOn(interfaceProj, ioProj, launchInterfaceProj, logProj, completeProj, classpathProj, crossProj).
|
|
|
|
|
settings(testedBaseSettings: _*).
|
|
|
|
|
settings(
|
|
|
|
|
name := "Command"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Fixes scope=Scope for Setting (core defined in collectionProj) to define the settings system used in build definitions
|
|
|
|
|
lazy val mainSettingsProj = (project in mainPath / "settings").
|
|
|
|
|
dependsOn (applyMacroProj, interfaceProj, ivyProj, relationProj, logProj, ioProj, commandProj,
|
|
|
|
|
completeProj, classpathProj, stdTaskProj, processProj).
|
|
|
|
|
settings(testedBaseSettings: _*).
|
|
|
|
|
settings(
|
|
|
|
|
name := "Main Settings",
|
2014-12-18 13:57:05 +01:00
|
|
|
libraryDependencies += sbinary
|
2014-12-18 05:38:10 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// 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, launchInterfaceProj, logProj, logicProj, processProj, runProj, commandProj).
|
|
|
|
|
settings(testedBaseSettings: _*).
|
|
|
|
|
settings(
|
|
|
|
|
name := "Main",
|
2014-12-18 13:57:05 +01:00
|
|
|
libraryDependencies ++= scalaXml.value
|
2014-12-18 05:38:10 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// Strictly for bringing implicits and aliases from subsystems into the top-level sbt namespace through a single package object
|
|
|
|
|
// technically, we need a dependency on all of mainProj's dependencies, but we don't do that since this is strictly an integration project
|
|
|
|
|
// with the sole purpose of providing certain identifiers without qualification (with a package object)
|
|
|
|
|
lazy val sbtProj = (project in sbtPath).
|
2015-02-04 01:36:45 +01:00
|
|
|
dependsOn(mainProj, compileInterfaceProj, scriptedSbtProj % "test->test").
|
2014-12-18 05:38:10 +01:00
|
|
|
settings(baseSettings: _*).
|
|
|
|
|
settings(
|
|
|
|
|
name := "sbt",
|
|
|
|
|
normalizedName := "sbt"
|
|
|
|
|
)
|
|
|
|
|
|
2015-01-09 00:02:59 +01:00
|
|
|
lazy val mavenResolverPluginProj = (project in file("sbt-maven-resolver")).
|
2015-01-11 04:55:50 +01:00
|
|
|
dependsOn(sbtProj, ivyProj % "test->test").
|
2015-01-09 00:02:59 +01:00
|
|
|
settings(baseSettings: _*).
|
|
|
|
|
settings(
|
|
|
|
|
name := "sbt-maven-resolver",
|
|
|
|
|
libraryDependencies ++= aetherLibs,
|
|
|
|
|
sbtPlugin := true
|
|
|
|
|
)
|
|
|
|
|
|
2015-01-13 04:01:16 +01:00
|
|
|
def scriptedTask: Initialize[InputTask[Unit]] = Def.inputTask {
|
|
|
|
|
val result = scriptedSource(dir => (s: State) => scriptedParser(dir)).parsed
|
|
|
|
|
publishAll.value
|
|
|
|
|
doScripted((proguard in Proguard).value, (fullClasspath in scriptedSbtProj in Test).value,
|
|
|
|
|
(scalaInstance in scriptedSbtProj).value, scriptedSource.value, result, scriptedPrescripted.value)
|
2014-12-18 05:38:10 +01:00
|
|
|
}
|
|
|
|
|
|
2015-01-13 04:01:16 +01:00
|
|
|
def scriptedUnpublishedTask: Initialize[InputTask[Unit]] = Def.inputTask {
|
|
|
|
|
val result = scriptedSource(dir => (s: State) => scriptedParser(dir)).parsed
|
|
|
|
|
doScripted((proguard in Proguard).value, (fullClasspath in scriptedSbtProj in Test).value,
|
|
|
|
|
(scalaInstance in scriptedSbtProj).value, scriptedSource.value, result, scriptedPrescripted.value)
|
2014-12-18 05:38:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lazy val publishAll = TaskKey[Unit]("publish-all")
|
|
|
|
|
lazy val publishLauncher = TaskKey[Unit]("publish-launcher")
|
|
|
|
|
|
|
|
|
|
lazy val myProvided = config("provided") intransitive
|
|
|
|
|
|
|
|
|
|
def allProjects = Seq(launchInterfaceProj, launchProj, testSamples, interfaceProj, apiProj,
|
|
|
|
|
controlProj, collectionProj, applyMacroProj, processProj, ioProj, classpathProj, completeProj,
|
|
|
|
|
logProj, relationProj, classfileProj, datatypeProj, crossProj, logicProj, ivyProj,
|
|
|
|
|
testingProj, testAgentProj, taskProj, stdTaskProj, cacheProj, trackingProj, runProj,
|
|
|
|
|
compileInterfaceProj, compileIncrementalProj, compilePersistProj, compilerProj,
|
|
|
|
|
compilerIntegrationProj, compilerIvyProj,
|
|
|
|
|
scriptedBaseProj, scriptedSbtProj, scriptedPluginProj,
|
2015-01-09 00:02:59 +01:00
|
|
|
actionsProj, commandProj, mainSettingsProj, mainProj, sbtProj, mavenResolverPluginProj)
|
2015-02-03 04:44:02 +01:00
|
|
|
|
2014-12-18 05:38:10 +01:00
|
|
|
def projectsWithMyProvided = allProjects.map(p => p.copy(configurations = (p.configurations.filter(_ != Provided)) :+ myProvided))
|
|
|
|
|
lazy val nonRoots = projectsWithMyProvided.map(p => LocalProject(p.id))
|
|
|
|
|
|
|
|
|
|
def releaseSettings = Release.settings(nonRoots, proguard in Proguard)
|
|
|
|
|
def rootSettings = releaseSettings ++ fullDocSettings ++ LaunchProguard.settings ++ LaunchProguard.specific(launchProj) ++
|
|
|
|
|
Util.publishPomSettings ++ otherRootSettings ++ proguardedLauncherSettings ++ Formatting.sbtFilesSettings ++
|
|
|
|
|
Transform.conscriptSettings(launchProj)
|
|
|
|
|
def otherRootSettings = Seq(
|
2015-01-13 04:01:16 +01:00
|
|
|
Scripted.scriptedPrescripted := { _ => },
|
2014-12-18 05:38:10 +01:00
|
|
|
Scripted.scripted <<= scriptedTask,
|
|
|
|
|
Scripted.scriptedUnpublished <<= scriptedUnpublishedTask,
|
|
|
|
|
Scripted.scriptedSource <<= (sourceDirectory in sbtProj) / "sbt-test",
|
2014-12-18 19:14:04 +01:00
|
|
|
publishAll := {
|
2015-02-03 04:44:02 +01:00
|
|
|
val _ = (publishLocal).all(ScopeFilter(inAnyProject)).value
|
2014-12-18 19:14:04 +01:00
|
|
|
}
|
2015-01-13 04:01:16 +01:00
|
|
|
) ++ inConfig(Scripted.MavenResolverPluginTest)(Seq(
|
|
|
|
|
Scripted.scripted <<= scriptedTask,
|
|
|
|
|
Scripted.scriptedUnpublished <<= scriptedUnpublishedTask,
|
|
|
|
|
Scripted.scriptedPrescripted := { f =>
|
|
|
|
|
val inj = f / "project" / "maven.sbt"
|
|
|
|
|
if (!inj.exists) {
|
2015-02-02 20:57:25 +01:00
|
|
|
IO.write(inj, "addMavenResolverPlugin")
|
2015-01-13 04:01:16 +01:00
|
|
|
// sLog.value.info(s"""Injected project/maven.sbt to $f""")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
))
|
2014-12-18 19:14:04 +01:00
|
|
|
lazy val docProjects: ScopeFilter = ScopeFilter(
|
|
|
|
|
inAnyProject -- inProjects(root, sbtProj, scriptedBaseProj, scriptedSbtProj, scriptedPluginProj),
|
|
|
|
|
inConfigurations(Compile)
|
2014-12-18 05:38:10 +01:00
|
|
|
)
|
|
|
|
|
def fullDocSettings = Util.baseScalacOptions ++ Docs.settings ++ Sxr.settings ++ Seq(
|
|
|
|
|
scalacOptions += "-Ymacro-no-expand", // for both sxr and doc
|
2014-12-18 19:14:04 +01:00
|
|
|
sources in sxr := {
|
|
|
|
|
val allSources = (sources ?? Nil).all(docProjects).value
|
|
|
|
|
allSources.flatten.distinct
|
|
|
|
|
}, //sxr
|
|
|
|
|
sources in (Compile, doc) := (sources in sxr).value, // doc
|
|
|
|
|
Sxr.sourceDirectories := {
|
|
|
|
|
val allSourceDirectories = (sourceDirectories ?? Nil).all(docProjects).value
|
|
|
|
|
allSourceDirectories.flatten
|
|
|
|
|
},
|
|
|
|
|
fullClasspath in sxr := (externalDependencyClasspath in Compile in sbtProj).value,
|
|
|
|
|
dependencyClasspath in (Compile, doc) := (fullClasspath in sxr).value
|
2014-12-18 05:38:10 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// the launcher is published with metadata so that the scripted plugin can pull it in
|
|
|
|
|
// being proguarded, it shouldn't ever be on a classpath with other jars, however
|
|
|
|
|
def proguardedLauncherSettings = Seq(
|
|
|
|
|
publishArtifact in packageSrc := false,
|
|
|
|
|
moduleName := "sbt-launch",
|
|
|
|
|
autoScalaLibrary := false,
|
|
|
|
|
description := "sbt application launcher",
|
|
|
|
|
publishLauncher <<= Release.deployLauncher,
|
|
|
|
|
packageBin in Compile <<= proguard in Proguard
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
/* Nested Projproject paths */
|
|
|
|
|
def sbtPath = file("sbt")
|
|
|
|
|
def cachePath = file("cache")
|
|
|
|
|
def tasksPath = file("tasks")
|
|
|
|
|
def launchPath = file("launch")
|
|
|
|
|
def utilPath = file("util")
|
|
|
|
|
def compilePath = file("compile")
|
|
|
|
|
def mainPath = file("main")
|
|
|
|
|
|
2014-12-18 23:40:20 +01:00
|
|
|
lazy val safeUnitTests = taskKey[Unit]("Known working tests (for both 2.10 and 2.11)")
|
|
|
|
|
lazy val safeProjects: ScopeFilter = ScopeFilter(
|
|
|
|
|
inProjects(launchProj, mainSettingsProj, mainProj, ivyProj, completeProj,
|
|
|
|
|
actionsProj, classpathProj, collectionProj, compileIncrementalProj,
|
|
|
|
|
logProj, runProj, stdTaskProj),
|
|
|
|
|
inConfigurations(Test)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
def customCommands: Seq[Setting[_]] = Seq(
|
|
|
|
|
commands += Command.command("setupBuildScala211") { state =>
|
|
|
|
|
s"""set scalaVersion in ThisBuild := "$scala211" """ ::
|
|
|
|
|
state
|
|
|
|
|
},
|
|
|
|
|
// This is invoked by Travis
|
|
|
|
|
commands += Command.command("checkBuildScala211") { state =>
|
|
|
|
|
s"++ $scala211" ::
|
|
|
|
|
// First compile everything before attempting to test
|
|
|
|
|
"all compile test:compile" ::
|
|
|
|
|
// Now run known working tests.
|
|
|
|
|
safeUnitTests.key.label ::
|
|
|
|
|
state
|
|
|
|
|
},
|
|
|
|
|
safeUnitTests := {
|
|
|
|
|
test.all(safeProjects).value
|
|
|
|
|
},
|
|
|
|
|
commands += Command.command("release-sbt-local") { state =>
|
|
|
|
|
"clean" ::
|
|
|
|
|
"so compile" ::
|
|
|
|
|
"so publishLocal" ::
|
|
|
|
|
"reload" ::
|
|
|
|
|
state
|
|
|
|
|
},
|
|
|
|
|
commands += Command.command("release-sbt") { state =>
|
|
|
|
|
// TODO - Any sort of validation
|
|
|
|
|
"clean" ::
|
|
|
|
|
"checkCredentials" ::
|
|
|
|
|
"conscript-configs" ::
|
|
|
|
|
"so compile" ::
|
|
|
|
|
"so publishSigned" ::
|
|
|
|
|
"publishLauncher" ::
|
|
|
|
|
state
|
|
|
|
|
}
|
|
|
|
|
)
|