mirror of https://github.com/sbt/sbt.git
ci: Use slash syntax in build.sbt
This commit is contained in:
parent
08469d8b8c
commit
5bdb08ea23
|
|
@ -82,8 +82,8 @@ val x86LinuxImageName = s"sbtn-$x86LinuxPlatform"
|
||||||
val aarch64LinuxImageName = s"sbtn-$aarch64LinuxPlatform"
|
val aarch64LinuxImageName = s"sbtn-$aarch64LinuxPlatform"
|
||||||
val x86WindowsImageName = s"sbtn-$x86WindowsPlatform.exe"
|
val x86WindowsImageName = s"sbtn-$x86WindowsPlatform.exe"
|
||||||
|
|
||||||
organization in ThisBuild := "org.scala-sbt"
|
ThisBuild / organization := "org.scala-sbt"
|
||||||
version in ThisBuild := "0.1.0"
|
ThisBuild / version := "0.1.0"
|
||||||
|
|
||||||
// This build creates a SBT plugin with handy features *and* bundles the SBT script for distribution.
|
// This build creates a SBT plugin with handy features *and* bundles the SBT script for distribution.
|
||||||
val root = (project in file(".")).
|
val root = (project in file(".")).
|
||||||
|
|
@ -94,7 +94,7 @@ val root = (project in file(".")).
|
||||||
packageName := "sbt",
|
packageName := "sbt",
|
||||||
crossTarget := target.value,
|
crossTarget := target.value,
|
||||||
clean := {
|
clean := {
|
||||||
val _ = (clean in dist).value
|
val _ = (dist / clean).value
|
||||||
clean.value
|
clean.value
|
||||||
},
|
},
|
||||||
credentials ++= {
|
credentials ++= {
|
||||||
|
|
@ -261,30 +261,30 @@ val root = (project in file(".")).
|
||||||
|
|
||||||
// DEBIAN SPECIFIC
|
// DEBIAN SPECIFIC
|
||||||
debianBuildId := sys.props.getOrElse("sbt.build.patch", sys.env.getOrElse("DIST_PATCHVER", "0")).toInt,
|
debianBuildId := sys.props.getOrElse("sbt.build.patch", sys.env.getOrElse("DIST_PATCHVER", "0")).toInt,
|
||||||
version in Debian := {
|
Debian / version := {
|
||||||
if (debianBuildId.value == 0) sbtVersionToRelease
|
if (debianBuildId.value == 0) sbtVersionToRelease
|
||||||
else sbtVersionToRelease + "." + debianBuildId.value
|
else sbtVersionToRelease + "." + debianBuildId.value
|
||||||
},
|
},
|
||||||
// Used to have "openjdk-8-jdk" but that doesn't work on Ubuntu 14.04 https://github.com/sbt/sbt/issues/3105
|
// Used to have "openjdk-8-jdk" but that doesn't work on Ubuntu 14.04 https://github.com/sbt/sbt/issues/3105
|
||||||
// before that we had java6-runtime-headless" and that was pulling in JDK9 on Ubuntu 16.04 https://github.com/sbt/sbt/issues/2931
|
// before that we had java6-runtime-headless" and that was pulling in JDK9 on Ubuntu 16.04 https://github.com/sbt/sbt/issues/2931
|
||||||
debianPackageDependencies in Debian ++= Seq("bash (>= 3.2)"),
|
Debian / debianPackageDependencies ++= Seq("bash (>= 3.2)", "curl | wget"),
|
||||||
debianPackageRecommends in Debian += "git",
|
Debian / debianPackageRecommends += "git",
|
||||||
linuxPackageMappings in Debian += {
|
Debian / linuxPackageMappings += {
|
||||||
val bd = sourceDirectory.value
|
val bd = sourceDirectory.value
|
||||||
(packageMapping(
|
(packageMapping(
|
||||||
(bd / "debian" / "changelog") -> "/usr/share/doc/sbt/changelog.gz"
|
(bd / "debian" / "changelog") -> "/usr/share/doc/sbt/changelog.gz"
|
||||||
) withUser "root" withGroup "root" withPerms "0644" gzipped) asDocs()
|
) withUser "root" withGroup "root" withPerms "0644" gzipped) asDocs()
|
||||||
},
|
},
|
||||||
debianChangelog in Debian := { Some(sourceDirectory.value / "debian" / "changelog") },
|
Debian / debianChangelog := { Some(sourceDirectory.value / "debian" / "changelog") },
|
||||||
addPackage(Debian, packageBin in Debian, "deb"),
|
addPackage(Debian, (Debian / packageBin), "deb"),
|
||||||
debianNativeBuildOptions in Debian := Seq("-Zgzip", "-z3"),
|
Debian / debianNativeBuildOptions := Seq("-Zgzip", "-z3"),
|
||||||
|
|
||||||
// use the following instead of DebianDeployPlugin to skip changelog
|
// use the following instead of DebianDeployPlugin to skip changelog
|
||||||
makeDeploymentSettings(Debian, packageBin in Debian, "deb"),
|
makeDeploymentSettings(Debian, (Debian / packageBin), "deb"),
|
||||||
|
|
||||||
// RPM SPECIFIC
|
// RPM SPECIFIC
|
||||||
rpmRelease := debianBuildId.value.toString,
|
rpmRelease := debianBuildId.value.toString,
|
||||||
version in Rpm := {
|
Rpm / version := {
|
||||||
val stable0 = (sbtVersionToRelease split "[^\\d]" filterNot (_.isEmpty) mkString ".")
|
val stable0 = (sbtVersionToRelease split "[^\\d]" filterNot (_.isEmpty) mkString ".")
|
||||||
val stable = if (rpmRelease.value == "0") stable0
|
val stable = if (rpmRelease.value == "0") stable0
|
||||||
else stable0 + "." + rpmRelease.value
|
else stable0 + "." + rpmRelease.value
|
||||||
|
|
@ -294,8 +294,8 @@ val root = (project in file(".")).
|
||||||
else stable
|
else stable
|
||||||
},
|
},
|
||||||
// remove sbtn from RPM because it complains about it being noarch
|
// remove sbtn from RPM because it complains about it being noarch
|
||||||
linuxPackageMappings in Rpm := {
|
Rpm / linuxPackageMappings := {
|
||||||
val orig = (linuxPackageMappings in Rpm).value
|
val orig = ((Rpm / linuxPackageMappings)).value
|
||||||
val nativeMappings = sbtnJarsMappings.value
|
val nativeMappings = sbtnJarsMappings.value
|
||||||
orig.map(o => o.copy(mappings = o.mappings.toList filterNot {
|
orig.map(o => o.copy(mappings = o.mappings.toList filterNot {
|
||||||
case (x, p) => p.contains("sbtn-x86_64") || p.contains("sbtn-aarch64")
|
case (x, p) => p.contains("sbtn-x86_64") || p.contains("sbtn-aarch64")
|
||||||
|
|
@ -313,7 +313,7 @@ val root = (project in file(".")).
|
||||||
|
|
||||||
// WINDOWS SPECIFIC
|
// WINDOWS SPECIFIC
|
||||||
windowsBuildId := 0,
|
windowsBuildId := 0,
|
||||||
version in Windows := {
|
Windows / version := {
|
||||||
val bid = windowsBuildId.value
|
val bid = windowsBuildId.value
|
||||||
val sv = sbtVersionToRelease
|
val sv = sbtVersionToRelease
|
||||||
(sv split "[^\\d]" filterNot (_.isEmpty)) match {
|
(sv split "[^\\d]" filterNot (_.isEmpty)) match {
|
||||||
|
|
@ -323,26 +323,26 @@ val root = (project in file(".")).
|
||||||
case Array(major) => Seq(major, "0", "0", bid.toString) mkString "."
|
case Array(major) => Seq(major, "0", "0", bid.toString) mkString "."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
maintainer in Windows := "Scala Center",
|
Windows / maintainer := "Scala Center",
|
||||||
packageSummary in Windows := "sbt " + (version in Windows).value,
|
Windows / packageSummary := "sbt " + (Windows / version).value,
|
||||||
packageDescription in Windows := "The interactive build tool.",
|
Windows / packageDescription := "The interactive build tool.",
|
||||||
wixProductId := "ce07be71-510d-414a-92d4-dff47631848a",
|
wixProductId := "ce07be71-510d-414a-92d4-dff47631848a",
|
||||||
wixProductUpgradeId := Hash.toHex(Hash((version in Windows).value)).take(32),
|
wixProductUpgradeId := Hash.toHex(Hash((Windows / version).value)).take(32),
|
||||||
javacOptions := Seq("-source", "1.8", "-target", "1.8"),
|
javacOptions := Seq("-source", "1.8", "-target", "1.8"),
|
||||||
|
|
||||||
// Universal ZIP download install.
|
// Universal ZIP download install.
|
||||||
packageName in Universal := packageName.value, // needs to be set explicitly due to a bug in native-packager
|
Universal / packageName := packageName.value, // needs to be set explicitly due to a bug in native-packager
|
||||||
name in Windows := packageName.value,
|
Windows / name := packageName.value,
|
||||||
packageName in Windows := packageName.value,
|
Windows / packageName := packageName.value,
|
||||||
version in Universal := sbtVersionToRelease,
|
Universal / version := sbtVersionToRelease,
|
||||||
|
|
||||||
mappings in Universal += {
|
Universal / mappings += {
|
||||||
(baseDirectory.value.getParentFile / "sbt") -> ("bin" + java.io.File.separator + "sbt")
|
(baseDirectory.value.getParentFile / "sbt") -> ("bin" + java.io.File.separator + "sbt")
|
||||||
},
|
},
|
||||||
|
|
||||||
mappings in Universal := {
|
Universal / mappings := {
|
||||||
val t = (target in Universal).value
|
val t = (Universal / target).value
|
||||||
val prev = (mappings in Universal).value
|
val prev = (Universal / mappings).value
|
||||||
val BinSbt = "bin" + java.io.File.separator + "sbt"
|
val BinSbt = "bin" + java.io.File.separator + "sbt"
|
||||||
val BinBat = BinSbt + ".bat"
|
val BinBat = BinSbt + ".bat"
|
||||||
prev.toList map {
|
prev.toList map {
|
||||||
|
|
@ -368,7 +368,7 @@ val root = (project in file(".")).
|
||||||
case (k, v) => (k, v)
|
case (k, v) => (k, v)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mappings in Universal ++= (Def.taskDyn {
|
Universal / mappings ++= (Def.taskDyn {
|
||||||
if (sbtIncludeSbtLaunch)
|
if (sbtIncludeSbtLaunch)
|
||||||
Def.task {
|
Def.task {
|
||||||
Seq(
|
Seq(
|
||||||
|
|
@ -377,40 +377,40 @@ val root = (project in file(".")).
|
||||||
}
|
}
|
||||||
else Def.task { Seq[(File, String)]() }
|
else Def.task { Seq[(File, String)]() }
|
||||||
}).value,
|
}).value,
|
||||||
mappings in Universal ++= sbtnJarsMappings.value,
|
Universal / mappings ++= sbtnJarsMappings.value,
|
||||||
mappings in Universal ++= (Def.taskDyn {
|
Universal / mappings ++= (Def.taskDyn {
|
||||||
if (sbtOfflineInstall && sbtVersionToRelease.startsWith("1."))
|
if (sbtOfflineInstall && sbtVersionToRelease.startsWith("1."))
|
||||||
Def.task {
|
Def.task {
|
||||||
val _ = (exportRepoUsingCoursier in dist).value
|
val _ = ((dist / exportRepoUsingCoursier)).value
|
||||||
directory((target in dist).value / "lib")
|
directory(((dist / target)).value / "lib")
|
||||||
}
|
}
|
||||||
else if (sbtOfflineInstall)
|
else if (sbtOfflineInstall)
|
||||||
Def.task {
|
Def.task {
|
||||||
val _ = (exportRepo in dist).value
|
val _ = ((dist / exportRepo)).value
|
||||||
directory((target in dist).value / "lib")
|
directory(((dist / target)).value / "lib")
|
||||||
}
|
}
|
||||||
else Def.task { Seq[(File, String)]() }
|
else Def.task { Seq[(File, String)]() }
|
||||||
}).value,
|
}).value,
|
||||||
mappings in Universal ++= {
|
Universal / mappings ++= {
|
||||||
val base = baseDirectory.value
|
val base = baseDirectory.value
|
||||||
if (sbtVersionToRelease startsWith "0.13.") Nil
|
if (sbtVersionToRelease startsWith "0.13.") Nil
|
||||||
else Seq[(File, String)](base.getParentFile / "LICENSE" -> "LICENSE", base / "NOTICE" -> "NOTICE")
|
else Seq[(File, String)](base.getParentFile / "LICENSE" -> "LICENSE", base / "NOTICE" -> "NOTICE")
|
||||||
},
|
},
|
||||||
|
|
||||||
// Miscellaneous publishing stuff...
|
// Miscellaneous publishing stuff...
|
||||||
(Debian / projectID) := {
|
Debian / projectID := {
|
||||||
val m = moduleID.value
|
val m = moduleID.value
|
||||||
m.withRevision((Debian / version).value)
|
m.withRevision((Debian / version).value)
|
||||||
},
|
},
|
||||||
(Windows / projectID) := {
|
Windows / projectID := {
|
||||||
val m = moduleID.value
|
val m = moduleID.value
|
||||||
m.withRevision((Windows / version).value)
|
m.withRevision((Windows / version).value)
|
||||||
},
|
},
|
||||||
(Rpm / projectID) := {
|
Rpm / projectID := {
|
||||||
val m = moduleID.value
|
val m = moduleID.value
|
||||||
m.withRevision((Rpm / version).value)
|
m.withRevision((Rpm / version).value)
|
||||||
},
|
},
|
||||||
(Universal / projectID) := {
|
Universal / projectID := {
|
||||||
val m = moduleID.value
|
val m = moduleID.value
|
||||||
m.withRevision((Universal / version).value)
|
m.withRevision((Universal / version).value)
|
||||||
}
|
}
|
||||||
|
|
@ -426,16 +426,21 @@ lazy val integrationTest = (project in file("integration-test"))
|
||||||
"org.scala-sbt" %% "io" % "1.10.5" % Test
|
"org.scala-sbt" %% "io" % "1.10.5" % Test
|
||||||
),
|
),
|
||||||
testFrameworks += new TestFramework("minitest.runner.Framework"),
|
testFrameworks += new TestFramework("minitest.runner.Framework"),
|
||||||
test in Test := {
|
Test / test := {
|
||||||
(test in Test).dependsOn(((packageBin in Universal) in LocalRootProject).dependsOn(((stage in (Universal) in LocalRootProject)))).value
|
(Test / test)
|
||||||
|
.dependsOn(LocalRootProject / Universal / packageBin)
|
||||||
|
.dependsOn(LocalRootProject / Universal / stage).value
|
||||||
},
|
},
|
||||||
testOnly in Test := {
|
Test / testOnly := {
|
||||||
(testOnly in Test).dependsOn(((packageBin in Universal) in LocalRootProject).dependsOn(((stage in (Universal) in LocalRootProject)))).evaluated
|
(Test / testOnly)
|
||||||
|
.dependsOn(LocalRootProject / Universal / packageBin)
|
||||||
|
.dependsOn(LocalRootProject / Universal / stage)
|
||||||
|
.evaluated
|
||||||
},
|
},
|
||||||
parallelExecution in Test := false
|
Test / parallelExecution := false
|
||||||
)
|
)
|
||||||
|
|
||||||
def downloadUrlForVersion(v: String) = (v split "[^\\d]" flatMap (i => catching(classOf[Exception]) opt (i.toInt))) match {
|
def downloadUrlForVersion(v: String) = (v.split("[^\\d]") flatMap (i => catching(classOf[Exception]) opt (i.toInt))) match {
|
||||||
case Array(0, 11, 3, _*) => "https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/0.11.3-2/sbt-launch.jar"
|
case Array(0, 11, 3, _*) => "https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/0.11.3-2/sbt-launch.jar"
|
||||||
case Array(0, 11, x, _*) if x >= 3 => "https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/"+v+"/sbt-launch.jar"
|
case Array(0, 11, x, _*) if x >= 3 => "https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/"+v+"/sbt-launch.jar"
|
||||||
case Array(0, y, _*) if y >= 12 => "https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/"+v+"/sbt-launch.jar"
|
case Array(0, y, _*) if y >= 12 => "https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt-launch/"+v+"/sbt-launch.jar"
|
||||||
|
|
@ -525,8 +530,8 @@ lazy val dist = (project in file("dist"))
|
||||||
exportRepoUsingCoursier := {
|
exportRepoUsingCoursier := {
|
||||||
val outDirectory = exportRepoCsrDirectory.value
|
val outDirectory = exportRepoCsrDirectory.value
|
||||||
val csr =
|
val csr =
|
||||||
if (isWindows) (baseDirectory in LocalRootProject).value / "bin" / "coursier.bat"
|
if (isWindows) (LocalRootProject / baseDirectory).value / "bin" / "coursier.bat"
|
||||||
else (baseDirectory in LocalRootProject).value / "bin" / "coursier"
|
else (LocalRootProject / baseDirectory).value / "bin" / "coursier"
|
||||||
val cache = target.value / "coursier"
|
val cache = target.value / "coursier"
|
||||||
IO.delete(cache)
|
IO.delete(cache)
|
||||||
val v = sbtVersionToRelease
|
val v = sbtVersionToRelease
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue