summaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
Diffstat (limited to 'project')
-rw-r--r--project/PartestUtil.scala2
-rw-r--r--project/ScriptCommands.scala128
-rw-r--r--project/VersionUtil.scala4
-rw-r--r--project/plugins.sbt4
4 files changed, 110 insertions, 28 deletions
diff --git a/project/PartestUtil.scala b/project/PartestUtil.scala
index 8793e9c0a5..99b978515c 100644
--- a/project/PartestUtil.scala
+++ b/project/PartestUtil.scala
@@ -29,7 +29,7 @@ object PartestUtil {
val knownUnaryOptions = List(
"--pos", "--neg", "--run", "--jvm", "--res", "--ant", "--scalap", "--specialized",
"--scalacheck", "--instrumented", "--presentation", "--failed", "--update-check",
- "--show-diff", "--verbose", "--terse", "--debug", "--version", "--self-test", "--help")
+ "--show-diff", "--show-log", "--verbose", "--terse", "--debug", "--version", "--self-test", "--help")
val srcPathOption = "--srcpath"
val grepOption = "--grep"
diff --git a/project/ScriptCommands.scala b/project/ScriptCommands.scala
index 0bf43b18e8..8d5d09943a 100644
--- a/project/ScriptCommands.scala
+++ b/project/ScriptCommands.scala
@@ -4,30 +4,112 @@ import BuildSettings.autoImport._
/** Custom commands for use by the Jenkins scripts. This keeps the surface area and call syntax small. */
object ScriptCommands {
- def all = Seq(setupPublishCore, setupValidateTest)
-
- /** Set up the environment for `validate/publish-core`. The argument is the Artifactory snapshot repository URL. */
- def setupPublishCore = Command.single("setupPublishCore") { case (state, url) =>
- Project.extract(state).append(Seq(
- baseVersionSuffix in Global := "SHA-SNAPSHOT",
- // Append build.timestamp to Artifactory URL to get consistent build numbers (see https://github.com/sbt/sbt/issues/2088):
- publishTo in Global := Some("scala-pr" at url.replaceAll("/$", "") + ";build.timestamp=" + System.currentTimeMillis),
- publishArtifact in (Compile, packageDoc) in ThisBuild := false,
- scalacOptions in Compile in ThisBuild += "-opt:l:classpath",
- logLevel in ThisBuild := Level.Info,
- logLevel in update in ThisBuild := Level.Warn
- ), state)
- }
+ def all = Seq(
+ setupPublishCore,
+ setupValidateTest,
+ setupBootstrapStarr, setupBootstrapLocker, setupBootstrapQuick, setupBootstrapPublish
+ )
+
+ /** Set up the environment for `validate/publish-core`.
+ * The optional argument is the Artifactory snapshot repository URL. */
+ def setupPublishCore = setup("setupPublishCore") { args =>
+ Seq(
+ baseVersionSuffix in Global := "SHA-SNAPSHOT"
+ ) ++ (args match {
+ case Seq(url) => publishTarget(url)
+ case Nil => Nil
+ }) ++ noDocs ++ enableOptimizer
+ }
- /** Set up the environment for `validate/test`. The argument is the Artifactory snapshot repository URL. */
- def setupValidateTest = Command.single("setupValidateTest") { case (state, url) =>
- //TODO When ant is gone, pass starr version as an argument to this command instead of using version.properties
- Project.extract(state).append(Seq(
+ /** Set up the environment for `validate/test`.
+ * The optional argument is the Artifactory snapshot repository URL. */
+ def setupValidateTest = setup("setupValidateTest") { args =>
+ Seq(
+ testOptions in IntegrationTest in LocalProject("test") ++= Seq(Tests.Argument("--show-log"), Tests.Argument("--show-diff"))
+ ) ++ (args match {
+ case Seq(url) => Seq(resolvers in Global += "scala-pr" at url)
+ case Nil => Nil
+ }) ++ enableOptimizer
+ }
+
+ /** Set up the environment for building STARR in `validate/bootstrap`. The arguments are:
+ * - Repository URL for publishing
+ * - Version number to publish */
+ def setupBootstrapStarr = setup("setupBootstrapStarr") { case Seq(url, ver) =>
+ Seq(
+ baseVersion in Global := ver,
+ baseVersionSuffix in Global := "SPLIT"
+ ) ++ publishTarget(url) ++ noDocs ++ enableOptimizer
+ }
+
+ /** Set up the environment for building locker in `validate/bootstrap`. The arguments are:
+ * - Repository URL for publishing locker and resolving STARR
+ * - Version number to publish */
+ def setupBootstrapLocker = setup("setupBootstrapLocker") { case Seq(url, ver) =>
+ Seq(
+ baseVersion in Global := ver,
+ baseVersionSuffix in Global := "SPLIT",
+ resolvers in Global += "scala-pr" at url
+ ) ++ publishTarget(url) ++ noDocs ++ enableOptimizer
+ }
+
+ /** Set up the environment for building quick in `validate/bootstrap`. The arguments are:
+ * - Repository URL for publishing
+ * - Version number to publish */
+ def setupBootstrapQuick = setup("setupBootstrapQuick") { case Seq(url, ver) =>
+ Seq(
+ baseVersion in Global := ver,
+ baseVersionSuffix in Global := "SPLIT",
resolvers in Global += "scala-pr" at url,
- scalacOptions in Compile in ThisBuild += "-opt:l:classpath",
- testOptions in IntegrationTest in LocalProject("test") ++= Seq(Tests.Argument("--show-log"), Tests.Argument("--show-diff")),
- logLevel in ThisBuild := Level.Info,
- logLevel in update in ThisBuild := Level.Warn
- ), state)
+ testOptions in IntegrationTest in LocalProject("test") ++= Seq(Tests.Argument("--show-log"), Tests.Argument("--show-diff"))
+ ) ++ publishTarget(url) ++ enableOptimizer
+ }
+
+ /** Set up the environment for publishing in `validate/bootstrap`. The arguments are:
+ * - Temporary bootstrap repository URL for resolving modules
+ * - Version number to publish
+ * All artifacts are published to Sonatype. */
+ def setupBootstrapPublish = setup("setupBootstrapPublish") { case Seq(url, ver) =>
+ // Define a copy of the setting key here in case the plugin is not part of the build
+ val pgpPassphrase = SettingKey[Option[Array[Char]]]("pgp-passphrase", "The passphrase associated with the secret used to sign artifacts.", KeyRanks.BSetting)
+ Seq(
+ baseVersion in Global := ver,
+ baseVersionSuffix in Global := "SPLIT",
+ resolvers in Global += "scala-pr" at url,
+ publishTo in Global := Some("sonatype-releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2"),
+ credentials in Global += Credentials(Path.userHome / ".credentials-sonatype"),
+ pgpPassphrase in Global := Some(Array.empty)
+ ) ++ enableOptimizer
+ }
+
+ private[this] def setup(name: String)(f: Seq[String] => Seq[Setting[_]]) =
+ Command.args(name, name) { case (state, seq) => Project.extract(state).append(f(seq) ++ resetLogLevels, state) }
+
+ private[this] val resetLogLevels = Seq(
+ logLevel in ThisBuild := Level.Info,
+ logLevel in update in ThisBuild := Level.Warn
+ )
+
+ private[this] val enableOptimizer = Seq(
+ scalacOptions in Compile in ThisBuild += "-opt:l:classpath"
+ )
+
+ private[this] val noDocs = Seq(
+ publishArtifact in (Compile, packageDoc) in ThisBuild := false
+ )
+
+ private[this] def publishTarget(url: String) = {
+ // Append build.timestamp to Artifactory URL to get consistent build numbers (see https://github.com/sbt/sbt/issues/2088):
+ val url2 = if(url.startsWith("file:")) url else url.replaceAll("/$", "") + ";build.timestamp=" + System.currentTimeMillis
+ Seq(publishTo in Global := Some("scala-pr-publish" at url2))
+ }
+
+ /** Like `Def.sequential` but accumulate all results */
+ def sequence[B](tasks: List[Def.Initialize[Task[B]]]): Def.Initialize[Task[List[B]]] = tasks match {
+ case Nil => Def.task { Nil }
+ case x :: xs => Def.taskDyn {
+ val v = x.value
+ sequence(xs).apply((t: Task[List[B]]) => t.map(l => v :: l))
+ }
}
}
diff --git a/project/VersionUtil.scala b/project/VersionUtil.scala
index 4705bbb6ce..6fe2b004f7 100644
--- a/project/VersionUtil.scala
+++ b/project/VersionUtil.scala
@@ -61,7 +61,7 @@ object VersionUtil {
val (base, suffix) = {
val (b, s) = (baseVersion.value, baseVersionSuffix.value)
if(s == "SPLIT") {
- val split = """([\w+\.]+)(-[\w+\.]+)??""".r
+ val split = """([\w+\.]+)(-[\w+\.-]+)??""".r
val split(b2, sOrNull) = b
(b2, Option(sOrNull).map(_.drop(1)).getOrElse(""))
} else (b, s)
@@ -94,7 +94,7 @@ object VersionUtil {
}
private lazy val generateBuildCharacterPropertiesFileImpl: Def.Initialize[Task[File]] = Def.task {
- writeProps(versionProperties.value.toMap, (baseDirectory in ThisBuild).value / "buildcharacter.properties")
+ writeProps(versionProperties.value.toMap ++ versionProps, (baseDirectory in ThisBuild).value / "buildcharacter.properties")
}
private def writeProps(m: Map[String, String], propFile: File): File = {
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 98ec8f16ed..0a5b8f3dd4 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -11,9 +11,9 @@ enablePlugins(BuildInfoPlugin)
// configure sbt-buildinfo to send the externalDependencyClasspath to the main build, which allows using it for the IntelliJ project config
-lazy val buildClasspath = taskKey[String]("Colon-separated list of entries on the sbt build classpath.")
+lazy val buildClasspath = taskKey[String]("Colon-separated (or semicolon-separated in case of Windows) list of entries on the sbt build classpath.")
-buildClasspath := (externalDependencyClasspath in Compile).value.map(_.data).mkString(":")
+buildClasspath := (externalDependencyClasspath in Compile).value.map(_.data).mkString(java.io.File.pathSeparator)
buildInfoKeys := Seq[BuildInfoKey](buildClasspath)