2014-12-18 05:38:10 +01:00
|
|
|
import Util._
|
2014-12-18 13:57:05 +01:00
|
|
|
import Dependencies._
|
2014-12-18 05:38:10 +01:00
|
|
|
import Sxr.sxr
|
|
|
|
|
|
2015-02-06 19:48:12 +01:00
|
|
|
// ThisBuild settings take lower precedence,
|
|
|
|
|
// but can be shared across the multi projects.
|
2017-04-21 09:14:31 +02:00
|
|
|
def buildLevelSettings: Seq[Setting[_]] =
|
|
|
|
|
inThisBuild(
|
|
|
|
|
Seq(
|
|
|
|
|
organization := "org.scala-sbt",
|
|
|
|
|
version := "1.0.0-SNAPSHOT",
|
|
|
|
|
description := "sbt is an interactive build tool",
|
|
|
|
|
bintrayOrganization := Some("sbt"),
|
|
|
|
|
bintrayRepository := {
|
|
|
|
|
if (publishStatus.value == "releases") "maven-releases"
|
|
|
|
|
else "maven-snapshots"
|
|
|
|
|
},
|
|
|
|
|
bintrayPackage := "sbt",
|
|
|
|
|
bintrayReleaseOnPublish := false,
|
|
|
|
|
licenses := List("BSD New" -> url("https://github.com/sbt/sbt/blob/0.13/LICENSE")),
|
|
|
|
|
developers := List(
|
|
|
|
|
Developer("harrah", "Mark Harrah", "@harrah", url("https://github.com/harrah")),
|
|
|
|
|
Developer("eed3si9n", "Eugene Yokota", "@eed3si9n", url("https://github.com/eed3si9n")),
|
|
|
|
|
Developer("jsuereth", "Josh Suereth", "@jsuereth", url("https://github.com/jsuereth")),
|
|
|
|
|
Developer("dwijnand", "Dale Wijnand", "@dwijnand", url("https://github.com/dwijnand")),
|
|
|
|
|
Developer("gkossakowski",
|
|
|
|
|
"Grzegorz Kossakowski",
|
|
|
|
|
"@gkossakowski",
|
|
|
|
|
url("https://github.com/gkossakowski")),
|
|
|
|
|
Developer("Duhemm", "Martin Duhem", "@Duhemm", url("https://github.com/Duhemm"))
|
|
|
|
|
),
|
|
|
|
|
homepage := Some(url("https://github.com/sbt/sbt")),
|
|
|
|
|
scmInfo := Some(ScmInfo(url("https://github.com/sbt/sbt"), "git@github.com:sbt/sbt.git")),
|
|
|
|
|
resolvers += Resolver.mavenLocal
|
|
|
|
|
))
|
|
|
|
|
|
|
|
|
|
def commonSettings: Seq[Setting[_]] =
|
|
|
|
|
Seq[SettingsDefinition](
|
|
|
|
|
scalaVersion := baseScalaVersion,
|
|
|
|
|
componentID := None,
|
|
|
|
|
resolvers += Resolver.typesafeIvyRepo("releases"),
|
|
|
|
|
resolvers += Resolver.sonatypeRepo("snapshots"),
|
|
|
|
|
resolvers += "bintray-sbt-maven-releases" at "https://dl.bintray.com/sbt/maven-releases/",
|
|
|
|
|
concurrentRestrictions in Global += Util.testExclusiveRestriction,
|
|
|
|
|
testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"),
|
|
|
|
|
javacOptions in compile ++= Seq("-target", "6", "-source", "6", "-Xlint", "-Xlint:-serial"),
|
|
|
|
|
crossScalaVersions := Seq(baseScalaVersion),
|
|
|
|
|
bintrayPackage := (bintrayPackage in ThisBuild).value,
|
|
|
|
|
bintrayRepository := (bintrayRepository in ThisBuild).value,
|
|
|
|
|
publishArtifact in Test := false,
|
2017-05-03 16:52:36 +02:00
|
|
|
/*
|
2017-04-21 09:14:31 +02:00
|
|
|
mimaPreviousArtifacts := Set.empty, // Set(organization.value % moduleName.value % "1.0.0"),
|
2017-05-08 15:16:35 +02:00
|
|
|
mimaBinaryIssueFilters ++= {
|
|
|
|
|
import com.typesafe.tools.mima.core._, ProblemFilters._
|
|
|
|
|
Seq()
|
2017-05-03 00:59:51 +02:00
|
|
|
},
|
2017-05-03 16:52:36 +02:00
|
|
|
*/
|
2017-05-03 00:59:51 +02:00
|
|
|
fork in compile := true,
|
|
|
|
|
fork in run := true
|
2017-04-21 09:14:31 +02:00
|
|
|
) flatMap (_.settings)
|
2014-12-18 05:38:10 +01:00
|
|
|
|
|
|
|
|
def minimalSettings: Seq[Setting[_]] =
|
2015-02-15 04:29:24 +01:00
|
|
|
commonSettings ++ customCommands ++
|
2017-04-21 09:14:31 +02:00
|
|
|
publishPomSettings ++ Release.javaVersionCheckSettings
|
2014-12-18 05:38:10 +01:00
|
|
|
|
|
|
|
|
def baseSettings: Seq[Setting[_]] =
|
2017-04-20 01:56:35 +02:00
|
|
|
minimalSettings ++ Seq(projectComponent) ++ baseScalacOptions ++ Licensed.settings
|
2014-12-18 05:38:10 +01:00
|
|
|
|
|
|
|
|
def testedBaseSettings: Seq[Setting[_]] =
|
|
|
|
|
baseSettings ++ testDependencies
|
|
|
|
|
|
2017-04-21 09:14:31 +02:00
|
|
|
lazy val sbtRoot: Project = (project in file("."))
|
2017-05-03 16:52:36 +02:00
|
|
|
.enablePlugins(ScriptedPlugin) // , SiteScaladocPlugin, GhpagesPlugin)
|
2017-04-21 09:14:31 +02:00
|
|
|
.configs(Sxr.sxrConf)
|
2017-05-03 16:52:36 +02:00
|
|
|
.aggregateSeq(nonRoots)
|
2017-04-21 09:14:31 +02:00
|
|
|
.settings(
|
2015-03-27 00:22:24 +01:00
|
|
|
buildLevelSettings,
|
|
|
|
|
minimalSettings,
|
2017-05-08 15:34:41 +02:00
|
|
|
Util.baseScalacOptions,
|
|
|
|
|
Docs.settings,
|
|
|
|
|
Sxr.settings,
|
|
|
|
|
scalacOptions += "-Ymacro-expand:none", // for both sxr and doc
|
|
|
|
|
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,
|
|
|
|
|
Util.publishPomSettings,
|
|
|
|
|
otherRootSettings,
|
|
|
|
|
Transform.conscriptSettings(bundledLauncherProj),
|
2015-02-06 20:35:32 +01:00
|
|
|
publish := {},
|
2015-03-24 21:12:51 +01:00
|
|
|
publishLocal := {}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// This is used to configure an sbt-launcher for this version of sbt.
|
|
|
|
|
lazy val bundledLauncherProj =
|
2017-04-21 09:14:31 +02:00
|
|
|
(project in file("launch"))
|
|
|
|
|
.settings(
|
|
|
|
|
minimalSettings,
|
|
|
|
|
inConfig(Compile)(Transform.configSettings),
|
|
|
|
|
Release.launcherSettings(sbtLaunchJar)
|
|
|
|
|
)
|
|
|
|
|
.enablePlugins(SbtLauncherPlugin)
|
|
|
|
|
.settings(
|
|
|
|
|
name := "sbt-launch",
|
|
|
|
|
moduleName := "sbt-launch",
|
|
|
|
|
description := "sbt application launcher",
|
|
|
|
|
autoScalaLibrary := false,
|
|
|
|
|
crossPaths := false,
|
|
|
|
|
publish := Release.deployLauncher.value,
|
|
|
|
|
publishLauncher := Release.deployLauncher.value,
|
|
|
|
|
packageBin in Compile := sbtLaunchJar.value
|
|
|
|
|
)
|
2014-12-18 05:38:10 +01:00
|
|
|
|
2014-12-18 19:14:04 +01:00
|
|
|
/* ** subproject declarations ** */
|
2014-12-18 05:38:10 +01:00
|
|
|
|
|
|
|
|
/* **** Intermediate-level Modules **** */
|
|
|
|
|
|
|
|
|
|
// Runner for uniform test interface
|
2017-04-21 09:14:31 +02:00
|
|
|
lazy val testingProj = (project in file("testing"))
|
|
|
|
|
.enablePlugins(ContrabandPlugin, JsonCodecPlugin)
|
|
|
|
|
.dependsOn(testAgentProj)
|
|
|
|
|
.settings(
|
2015-03-27 00:22:24 +01:00
|
|
|
baseSettings,
|
2014-12-18 05:38:10 +01:00
|
|
|
name := "Testing",
|
2017-04-21 09:14:31 +02:00
|
|
|
libraryDependencies ++= Seq(testInterface, launcherInterface, sjsonNewScalaJson),
|
2017-04-19 07:50:18 +02:00
|
|
|
managedSourceDirectories in Compile +=
|
|
|
|
|
baseDirectory.value / "src" / "main" / "contraband-scala",
|
2017-04-01 23:19:45 +02:00
|
|
|
sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala",
|
|
|
|
|
contrabandFormatsForType in generateContrabands in Compile := ContrabandConfig.getFormats
|
2017-04-21 09:14:31 +02:00
|
|
|
)
|
|
|
|
|
.configure(addSbtIO, addSbtCompilerClasspath, addSbtUtilLogging)
|
2014-12-18 05:38:10 +01:00
|
|
|
|
|
|
|
|
// Testing agent for running tests in a separate process.
|
2017-04-21 09:14:31 +02:00
|
|
|
lazy val testAgentProj = (project in file("testing") / "agent").settings(
|
|
|
|
|
minimalSettings,
|
|
|
|
|
crossScalaVersions := Seq(baseScalaVersion),
|
|
|
|
|
crossPaths := false,
|
|
|
|
|
autoScalaLibrary := false,
|
|
|
|
|
name := "Test Agent",
|
|
|
|
|
libraryDependencies += testInterface
|
|
|
|
|
)
|
2014-12-18 05:38:10 +01:00
|
|
|
|
|
|
|
|
// Basic task engine
|
2017-04-21 09:14:31 +02:00
|
|
|
lazy val taskProj = (project in file("tasks"))
|
|
|
|
|
.settings(
|
2015-03-27 00:22:24 +01:00
|
|
|
testedBaseSettings,
|
2016-11-23 17:19:22 +01:00
|
|
|
name := "Tasks"
|
2017-04-21 09:14:31 +02:00
|
|
|
)
|
|
|
|
|
.configure(addSbtUtilControl, addSbtUtilCollection)
|
2014-12-18 05:38:10 +01:00
|
|
|
|
|
|
|
|
// Standard task system. This provides map, flatMap, join, and more on top of the basic task model.
|
2017-04-21 09:14:31 +02:00
|
|
|
lazy val stdTaskProj = (project in file("tasks-standard"))
|
|
|
|
|
.dependsOn(taskProj % "compile;test->test")
|
|
|
|
|
.settings(
|
2015-03-27 00:22:24 +01:00
|
|
|
testedBaseSettings,
|
2014-12-18 05:38:10 +01:00
|
|
|
name := "Task System",
|
2016-11-23 17:19:22 +01:00
|
|
|
testExclusive
|
2017-04-21 09:14:31 +02:00
|
|
|
)
|
|
|
|
|
.configure(addSbtUtilCollection, addSbtUtilLogging, addSbtUtilCache, addSbtIO)
|
2014-12-18 05:38:10 +01:00
|
|
|
|
|
|
|
|
// Embedded Scala code runner
|
2017-04-21 09:14:31 +02:00
|
|
|
lazy val runProj = (project in file("run"))
|
2017-05-12 00:33:12 +02:00
|
|
|
.enablePlugins(ContrabandPlugin)
|
2017-04-21 09:14:31 +02:00
|
|
|
.settings(
|
2015-03-27 00:22:24 +01:00
|
|
|
testedBaseSettings,
|
2017-05-12 00:33:12 +02:00
|
|
|
name := "Run",
|
|
|
|
|
managedSourceDirectories in Compile +=
|
|
|
|
|
baseDirectory.value / "src" / "main" / "contraband-scala",
|
|
|
|
|
sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala"
|
2017-04-21 09:14:31 +02:00
|
|
|
)
|
|
|
|
|
.configure(addSbtIO, addSbtUtilLogging, addSbtCompilerClasspath)
|
2014-12-18 05:38:10 +01:00
|
|
|
|
2017-04-21 09:14:31 +02:00
|
|
|
lazy val scriptedSbtProj = (project in scriptedPath / "sbt")
|
|
|
|
|
.dependsOn(commandProj)
|
|
|
|
|
.settings(
|
2015-03-27 00:22:24 +01:00
|
|
|
baseSettings,
|
2015-03-24 16:14:13 +01:00
|
|
|
name := "Scripted sbt",
|
2016-11-23 17:19:22 +01:00
|
|
|
libraryDependencies ++= Seq(launcherInterface % "provided")
|
2017-04-21 09:14:31 +02:00
|
|
|
)
|
|
|
|
|
.configure(addSbtIO, addSbtUtilLogging, addSbtCompilerInterface, addSbtUtilScripted)
|
2014-12-18 05:38:10 +01:00
|
|
|
|
2017-04-21 09:14:31 +02:00
|
|
|
lazy val scriptedPluginProj = (project in scriptedPath / "plugin")
|
|
|
|
|
.dependsOn(sbtProj)
|
|
|
|
|
.settings(
|
2015-03-27 00:22:24 +01:00
|
|
|
baseSettings,
|
2016-11-23 17:19:22 +01:00
|
|
|
name := "Scripted Plugin"
|
2017-04-21 09:14:31 +02:00
|
|
|
)
|
|
|
|
|
.configure(addSbtCompilerClasspath)
|
2014-12-18 05:38:10 +01:00
|
|
|
|
|
|
|
|
// Implementation and support code for defining actions.
|
2017-04-21 09:14:31 +02:00
|
|
|
lazy val actionsProj = (project in file("main-actions"))
|
|
|
|
|
.dependsOn(runProj, stdTaskProj, taskProj, testingProj)
|
|
|
|
|
.settings(
|
2015-03-27 00:22:24 +01:00
|
|
|
testedBaseSettings,
|
2016-11-30 14:42:51 +01:00
|
|
|
name := "Actions",
|
|
|
|
|
libraryDependencies += sjsonNewScalaJson
|
2017-04-21 09:14:31 +02:00
|
|
|
)
|
|
|
|
|
.configure(
|
|
|
|
|
addSbtCompilerClasspath,
|
|
|
|
|
addSbtUtilCompletion,
|
|
|
|
|
addSbtCompilerApiInfo,
|
|
|
|
|
addSbtZinc,
|
|
|
|
|
addSbtCompilerIvyIntegration,
|
|
|
|
|
addSbtCompilerInterface,
|
|
|
|
|
addSbtIO,
|
|
|
|
|
addSbtUtilLogging,
|
|
|
|
|
addSbtUtilRelation,
|
|
|
|
|
addSbtLm,
|
|
|
|
|
addSbtUtilTracking
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
lazy val protocolProj = (project in file("protocol"))
|
|
|
|
|
.enablePlugins(ContrabandPlugin, JsonCodecPlugin)
|
|
|
|
|
.settings(
|
2016-12-01 09:14:07 +01:00
|
|
|
testedBaseSettings,
|
|
|
|
|
name := "Protocol",
|
|
|
|
|
libraryDependencies ++= Seq(sjsonNewScalaJson),
|
2017-04-19 07:50:18 +02:00
|
|
|
managedSourceDirectories in Compile +=
|
|
|
|
|
baseDirectory.value / "src" / "main" / "contraband-scala",
|
2017-03-20 17:44:57 +01:00
|
|
|
sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala",
|
|
|
|
|
contrabandFormatsForType in generateContrabands in Compile := ContrabandConfig.getFormats
|
2017-04-21 09:14:31 +02:00
|
|
|
)
|
|
|
|
|
.configure(addSbtUtilLogging)
|
2016-12-01 09:14:07 +01:00
|
|
|
|
2014-12-18 05:38:10 +01:00
|
|
|
// General command support and core commands not specific to a build system
|
2017-04-21 09:14:31 +02:00
|
|
|
lazy val commandProj = (project in file("main-command"))
|
|
|
|
|
.enablePlugins(ContrabandPlugin, JsonCodecPlugin)
|
|
|
|
|
.dependsOn(protocolProj)
|
|
|
|
|
.settings(
|
2015-03-27 00:22:24 +01:00
|
|
|
testedBaseSettings,
|
2015-03-24 16:14:13 +01:00
|
|
|
name := "Command",
|
2016-10-13 02:06:10 +02:00
|
|
|
libraryDependencies ++= Seq(launcherInterface, sjsonNewScalaJson, templateResolverApi),
|
2017-04-19 07:50:18 +02:00
|
|
|
managedSourceDirectories in Compile +=
|
|
|
|
|
baseDirectory.value / "src" / "main" / "contraband-scala",
|
2016-11-30 14:42:51 +01:00
|
|
|
sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala",
|
|
|
|
|
contrabandFormatsForType in generateContrabands in Compile := ContrabandConfig.getFormats
|
2017-04-21 09:14:31 +02:00
|
|
|
)
|
|
|
|
|
.configure(addSbtCompilerInterface,
|
|
|
|
|
addSbtIO,
|
|
|
|
|
addSbtUtilLogging,
|
|
|
|
|
addSbtUtilCompletion,
|
|
|
|
|
addSbtCompilerClasspath,
|
|
|
|
|
addSbtLm)
|
2014-12-18 05:38:10 +01:00
|
|
|
|
|
|
|
|
// Fixes scope=Scope for Setting (core defined in collectionProj) to define the settings system used in build definitions
|
2017-04-21 09:14:31 +02:00
|
|
|
lazy val mainSettingsProj = (project in file("main-settings"))
|
|
|
|
|
.dependsOn(commandProj, stdTaskProj)
|
|
|
|
|
.settings(
|
2015-03-27 00:22:24 +01:00
|
|
|
testedBaseSettings,
|
2016-11-23 17:19:22 +01:00
|
|
|
name := "Main Settings"
|
2017-04-21 09:14:31 +02:00
|
|
|
)
|
|
|
|
|
.configure(
|
|
|
|
|
addSbtUtilCache,
|
|
|
|
|
addSbtUtilApplyMacro,
|
|
|
|
|
addSbtCompilerInterface,
|
|
|
|
|
addSbtUtilRelation,
|
|
|
|
|
addSbtUtilLogging,
|
|
|
|
|
addSbtIO,
|
|
|
|
|
addSbtUtilCompletion,
|
|
|
|
|
addSbtCompilerClasspath,
|
|
|
|
|
addSbtLm
|
|
|
|
|
)
|
2014-12-18 05:38:10 +01:00
|
|
|
|
2016-11-23 16:17:34 +01:00
|
|
|
// The main integration project for sbt. It brings all of the projects together, configures them, and provides for overriding conventions.
|
2017-04-21 09:14:31 +02:00
|
|
|
lazy val mainProj = (project in file("main"))
|
2017-05-13 14:01:51 +02:00
|
|
|
.enablePlugins(ContrabandPlugin)
|
2017-04-21 09:14:31 +02:00
|
|
|
.dependsOn(actionsProj, mainSettingsProj, runProj, commandProj)
|
|
|
|
|
.settings(
|
2015-03-27 00:22:24 +01:00
|
|
|
testedBaseSettings,
|
2014-12-18 05:38:10 +01:00
|
|
|
name := "Main",
|
2017-05-13 14:01:51 +02:00
|
|
|
libraryDependencies ++= scalaXml.value ++ Seq(launcherInterface),
|
|
|
|
|
managedSourceDirectories in Compile +=
|
|
|
|
|
baseDirectory.value / "src" / "main" / "contraband-scala",
|
|
|
|
|
sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-scala"
|
2017-04-21 09:14:31 +02:00
|
|
|
)
|
|
|
|
|
.configure(addSbtCompilerInterface,
|
|
|
|
|
addSbtIO,
|
|
|
|
|
addSbtUtilLogging,
|
|
|
|
|
addSbtUtilLogic,
|
|
|
|
|
addSbtLm,
|
|
|
|
|
addSbtZincCompile)
|
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)
|
2017-04-21 09:14:31 +02:00
|
|
|
lazy val sbtProj = (project in file("sbt"))
|
|
|
|
|
.dependsOn(mainProj, scriptedSbtProj % "test->test")
|
|
|
|
|
.settings(
|
2015-03-27 00:22:24 +01:00
|
|
|
baseSettings,
|
2014-12-18 05:38:10 +01:00
|
|
|
name := "sbt",
|
2015-09-14 09:27:22 +02:00
|
|
|
normalizedName := "sbt",
|
2017-01-15 07:44:05 +01:00
|
|
|
crossScalaVersions := Seq(baseScalaVersion),
|
2016-11-23 17:19:22 +01:00
|
|
|
crossPaths := false
|
2017-04-21 09:14:31 +02:00
|
|
|
)
|
|
|
|
|
.configure(addSbtCompilerBridge)
|
2014-12-18 05:38:10 +01:00
|
|
|
|
2015-07-10 11:53:48 +02:00
|
|
|
def scriptedTask: Def.Initialize[InputTask[Unit]] = Def.inputTask {
|
2016-03-31 05:48:20 +02:00
|
|
|
val result = scriptedSource(dir => (s: State) => Scripted.scriptedParser(dir)).parsed
|
2017-05-03 16:52:36 +02:00
|
|
|
// publishLocalBinAll.value // TODO: Restore scripted needing only binary jars.
|
|
|
|
|
publishAll.value
|
2016-04-24 20:23:48 +02:00
|
|
|
// These two projects need to be visible in a repo even if the default
|
|
|
|
|
// local repository is hidden, so we publish them to an alternate location and add
|
|
|
|
|
// that alternate repo to the running scripted test (in Scripted.scriptedpreScripted).
|
|
|
|
|
// (altLocalPublish in interfaceProj).value
|
|
|
|
|
// (altLocalPublish in compileInterfaceProj).value
|
2017-04-21 09:14:31 +02:00
|
|
|
Scripted.doScripted(
|
|
|
|
|
(sbtLaunchJar in bundledLauncherProj).value,
|
|
|
|
|
(fullClasspath in scriptedSbtProj in Test).value,
|
2016-03-31 05:48:20 +02:00
|
|
|
(scalaInstance in scriptedSbtProj).value,
|
2017-04-21 09:14:31 +02:00
|
|
|
scriptedSource.value,
|
|
|
|
|
scriptedBufferLog.value,
|
|
|
|
|
result,
|
|
|
|
|
scriptedPrescripted.value,
|
|
|
|
|
scriptedLaunchOpts.value
|
|
|
|
|
)
|
2014-12-18 05:38:10 +01:00
|
|
|
}
|
|
|
|
|
|
2015-07-10 11:53:48 +02:00
|
|
|
def scriptedUnpublishedTask: Def.Initialize[InputTask[Unit]] = Def.inputTask {
|
2016-03-31 05:48:20 +02:00
|
|
|
val result = scriptedSource(dir => (s: State) => Scripted.scriptedParser(dir)).parsed
|
2017-04-21 09:14:31 +02:00
|
|
|
Scripted.doScripted(
|
|
|
|
|
(sbtLaunchJar in bundledLauncherProj).value,
|
|
|
|
|
(fullClasspath in scriptedSbtProj in Test).value,
|
2016-03-31 05:48:20 +02:00
|
|
|
(scalaInstance in scriptedSbtProj).value,
|
2017-04-21 09:14:31 +02:00
|
|
|
scriptedSource.value,
|
|
|
|
|
scriptedBufferLog.value,
|
|
|
|
|
result,
|
|
|
|
|
scriptedPrescripted.value,
|
|
|
|
|
scriptedLaunchOpts.value
|
|
|
|
|
)
|
2014-12-18 05:38:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lazy val publishLauncher = TaskKey[Unit]("publish-launcher")
|
|
|
|
|
|
2017-04-21 09:14:31 +02:00
|
|
|
def allProjects =
|
|
|
|
|
Seq(
|
|
|
|
|
testingProj,
|
|
|
|
|
testAgentProj,
|
|
|
|
|
taskProj,
|
|
|
|
|
stdTaskProj,
|
|
|
|
|
runProj,
|
|
|
|
|
scriptedSbtProj,
|
|
|
|
|
scriptedPluginProj,
|
|
|
|
|
protocolProj,
|
|
|
|
|
actionsProj,
|
|
|
|
|
commandProj,
|
|
|
|
|
mainSettingsProj,
|
|
|
|
|
mainProj,
|
|
|
|
|
sbtProj,
|
|
|
|
|
bundledLauncherProj
|
|
|
|
|
)
|
2015-02-03 04:44:02 +01:00
|
|
|
|
2017-05-08 15:08:40 +02:00
|
|
|
lazy val nonRoots = allProjects.map(p => LocalProject(p.id))
|
2014-12-18 05:38:10 +01:00
|
|
|
|
2017-04-21 09:14:31 +02:00
|
|
|
def otherRootSettings =
|
|
|
|
|
Seq(
|
|
|
|
|
scripted := scriptedTask.evaluated,
|
|
|
|
|
scriptedUnpublished := scriptedUnpublishedTask.evaluated,
|
|
|
|
|
scriptedSource := (sourceDirectory in sbtProj).value / "sbt-test",
|
|
|
|
|
// scriptedPrescripted := { addSbtAlternateResolver _ },
|
2017-05-03 00:59:51 +02:00
|
|
|
scriptedLaunchOpts := List("-Xmx1500M", "-Xms512M", "-server"),
|
2017-04-21 09:14:31 +02:00
|
|
|
publishAll := { val _ = (publishLocal).all(ScopeFilter(inAnyProject)).value },
|
|
|
|
|
publishLocalBinAll := { val _ = (publishLocalBin).all(ScopeFilter(inAnyProject)).value },
|
|
|
|
|
aggregate in bintrayRelease := false
|
|
|
|
|
) ++ inConfig(Scripted.RepoOverrideTest)(
|
|
|
|
|
Seq(
|
|
|
|
|
scriptedPrescripted := { _ =>
|
|
|
|
|
()
|
|
|
|
|
},
|
|
|
|
|
scriptedLaunchOpts := {
|
2017-05-03 00:59:51 +02:00
|
|
|
List("-Xmx1500M",
|
2017-05-02 13:05:27 +02:00
|
|
|
"-Xms512M",
|
2017-05-03 00:59:51 +02:00
|
|
|
"-server",
|
2017-04-21 09:14:31 +02:00
|
|
|
"-Dsbt.override.build.repos=true",
|
|
|
|
|
s"""-Dsbt.repository.config=${scriptedSource.value / "repo.config"}""")
|
|
|
|
|
},
|
|
|
|
|
scripted := scriptedTask.evaluated,
|
|
|
|
|
scriptedUnpublished := scriptedUnpublishedTask.evaluated,
|
|
|
|
|
scriptedSource := (sourceDirectory in sbtProj).value / "repo-override-test"
|
|
|
|
|
))
|
2016-04-24 20:23:48 +02:00
|
|
|
|
|
|
|
|
// def addSbtAlternateResolver(scriptedRoot: File) = {
|
|
|
|
|
// val resolver = scriptedRoot / "project" / "AddResolverPlugin.scala"
|
|
|
|
|
// if (!resolver.exists) {
|
|
|
|
|
// IO.write(resolver, s"""import sbt._
|
|
|
|
|
// |import Keys._
|
|
|
|
|
// |
|
|
|
|
|
// |object AddResolverPlugin extends AutoPlugin {
|
|
|
|
|
// | override def requires = sbt.plugins.JvmPlugin
|
|
|
|
|
// | override def trigger = allRequirements
|
|
|
|
|
// |
|
|
|
|
|
// | override lazy val projectSettings = Seq(resolvers += alternativeLocalResolver)
|
|
|
|
|
// | lazy val alternativeLocalResolver = Resolver.file("$altLocalRepoName", file("$altLocalRepoPath"))(Resolver.ivyStylePatterns)
|
|
|
|
|
// |}
|
|
|
|
|
// |""".stripMargin)
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
2014-12-18 19:14:04 +01:00
|
|
|
lazy val docProjects: ScopeFilter = ScopeFilter(
|
2016-04-29 08:39:34 +02:00
|
|
|
inAnyProject -- inProjects(sbtRoot, sbtProj, scriptedSbtProj, scriptedPluginProj),
|
2014-12-18 19:14:04 +01:00
|
|
|
inConfigurations(Compile)
|
2014-12-18 05:38:10 +01:00
|
|
|
)
|
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(
|
2017-04-21 09:14:31 +02:00
|
|
|
inProjects(mainSettingsProj, mainProj, actionsProj, runProj, stdTaskProj),
|
2014-12-18 23:40:20 +01:00
|
|
|
inConfigurations(Test)
|
|
|
|
|
)
|
2015-06-20 20:21:16 +02:00
|
|
|
lazy val otherUnitTests = taskKey[Unit]("Unit test other projects")
|
|
|
|
|
lazy val otherProjects: ScopeFilter = ScopeFilter(
|
2017-04-21 09:14:31 +02:00
|
|
|
inProjects(testingProj,
|
|
|
|
|
testAgentProj,
|
|
|
|
|
taskProj,
|
|
|
|
|
scriptedSbtProj,
|
|
|
|
|
scriptedPluginProj,
|
|
|
|
|
commandProj,
|
|
|
|
|
mainSettingsProj,
|
|
|
|
|
mainProj,
|
|
|
|
|
sbtProj),
|
2015-06-20 20:21:16 +02:00
|
|
|
inConfigurations(Test)
|
|
|
|
|
)
|
2014-12-18 23:40:20 +01:00
|
|
|
|
|
|
|
|
def customCommands: Seq[Setting[_]] = Seq(
|
2017-01-15 07:44:05 +01:00
|
|
|
commands += Command.command("setupBuildScala212") { state =>
|
|
|
|
|
s"""set scalaVersion in ThisBuild := "$scala212" """ ::
|
2014-12-18 23:40:20 +01:00
|
|
|
state
|
|
|
|
|
},
|
|
|
|
|
safeUnitTests := {
|
|
|
|
|
test.all(safeProjects).value
|
|
|
|
|
},
|
2015-06-20 20:21:16 +02:00
|
|
|
otherUnitTests := {
|
2016-02-24 16:02:22 +01:00
|
|
|
test.all(otherProjects).value
|
2015-06-20 20:42:26 +02:00
|
|
|
},
|
2017-04-20 02:23:40 +02:00
|
|
|
commands += Command.command("scalafmtCheck") { state =>
|
|
|
|
|
sys.process.Process("git diff --name-only --exit-code").! match {
|
|
|
|
|
case 0 => // ok
|
|
|
|
|
case x => sys.error("git diff detected! Did you compile before committing?")
|
|
|
|
|
}
|
|
|
|
|
state
|
|
|
|
|
},
|
2014-12-18 23:40:20 +01:00
|
|
|
commands += Command.command("release-sbt-local") { state =>
|
2015-02-25 18:31:21 +01:00
|
|
|
"clean" ::
|
2017-04-21 09:14:31 +02:00
|
|
|
"so compile" ::
|
|
|
|
|
"so publishLocal" ::
|
|
|
|
|
"reload" ::
|
|
|
|
|
state
|
2014-12-18 23:40:20 +01:00
|
|
|
},
|
2015-02-17 19:33:54 +01:00
|
|
|
/** There are several complications with sbt's build.
|
|
|
|
|
* First is the fact that interface project is a Java-only project
|
2015-12-14 11:26:34 +01:00
|
|
|
* that uses source generator from datatype subproject in Scala 2.10.6.
|
2015-02-17 19:33:54 +01:00
|
|
|
*
|
2015-07-16 13:53:10 +02:00
|
|
|
* Second is the fact that all subprojects are released with crossPaths
|
2015-12-14 11:26:34 +01:00
|
|
|
* turned off for the sbt's Scala version 2.10.6, but some of them are also
|
2015-02-17 19:33:54 +01:00
|
|
|
* cross published against 2.11.1 with crossPaths turned on.
|
|
|
|
|
*
|
2015-07-16 13:53:10 +02:00
|
|
|
* `so compile` handles 2.10.x/2.11.x cross building.
|
2015-02-17 19:33:54 +01:00
|
|
|
*/
|
2014-12-18 23:40:20 +01:00
|
|
|
commands += Command.command("release-sbt") { state =>
|
|
|
|
|
// TODO - Any sort of validation
|
2015-02-25 18:31:21 +01:00
|
|
|
"clean" ::
|
|
|
|
|
"conscript-configs" ::
|
2014-12-18 23:40:20 +01:00
|
|
|
"so compile" ::
|
|
|
|
|
"so publishSigned" ::
|
2015-03-24 23:32:56 +01:00
|
|
|
"bundledLauncherProj/publishLauncher" ::
|
2015-02-21 03:09:43 +01:00
|
|
|
state
|
|
|
|
|
},
|
2015-02-25 18:31:21 +01:00
|
|
|
// stamp-version doesn't work with ++ or "so".
|
2015-02-21 03:09:43 +01:00
|
|
|
commands += Command.command("release-nightly") { state =>
|
|
|
|
|
"stamp-version" ::
|
2015-02-25 18:31:21 +01:00
|
|
|
"clean" ::
|
|
|
|
|
"compile" ::
|
|
|
|
|
"publish" ::
|
2015-04-22 06:28:47 +02:00
|
|
|
"bintrayRelease" ::
|
2014-12-18 23:40:20 +01:00
|
|
|
state
|
|
|
|
|
}
|
|
|
|
|
)
|