mirror of https://github.com/sbt/sbt.git
Bump plugins
This commit is contained in:
parent
5645f8fe6d
commit
ce2a01af40
17
build.sbt
17
build.sbt
|
|
@ -143,11 +143,10 @@ lazy val extra = project
|
||||||
|
|
||||||
lazy val cli = project
|
lazy val cli = project
|
||||||
.dependsOn(coreJvm, cache, extra)
|
.dependsOn(coreJvm, cache, extra)
|
||||||
|
.enablePlugins(PackPlugin, SbtProguard)
|
||||||
.settings(
|
.settings(
|
||||||
shared,
|
shared,
|
||||||
dontPublishIn("2.10", "2.12"),
|
dontPublishIn("2.10", "2.12"),
|
||||||
generatePack,
|
|
||||||
proguard,
|
|
||||||
coursierPrefix,
|
coursierPrefix,
|
||||||
libs ++= {
|
libs ++= {
|
||||||
if (scalaBinaryVersion.value == "2.11")
|
if (scalaBinaryVersion.value == "2.11")
|
||||||
|
|
@ -250,10 +249,10 @@ lazy val `sbt-shading` = project
|
||||||
)
|
)
|
||||||
|
|
||||||
lazy val `sbt-launcher` = project
|
lazy val `sbt-launcher` = project
|
||||||
|
.enablePlugins(PackPlugin)
|
||||||
.dependsOn(cache)
|
.dependsOn(cache)
|
||||||
.settings(
|
.settings(
|
||||||
shared,
|
shared,
|
||||||
generatePack,
|
|
||||||
dontPublishIn("2.10", "2.12"),
|
dontPublishIn("2.10", "2.12"),
|
||||||
libs ++= {
|
libs ++= {
|
||||||
if (scalaBinaryVersion.value == "2.11")
|
if (scalaBinaryVersion.value == "2.11")
|
||||||
|
|
@ -268,9 +267,9 @@ lazy val `sbt-launcher` = project
|
||||||
)
|
)
|
||||||
|
|
||||||
lazy val `http-server` = project
|
lazy val `http-server` = project
|
||||||
|
.enablePlugins(PackPlugin)
|
||||||
.settings(
|
.settings(
|
||||||
shared,
|
shared,
|
||||||
generatePack,
|
|
||||||
dontPublishIn("2.10", "2.11"),
|
dontPublishIn("2.10", "2.11"),
|
||||||
libs ++= {
|
libs ++= {
|
||||||
if (scalaBinaryVersion.value == "2.12")
|
if (scalaBinaryVersion.value == "2.12")
|
||||||
|
|
@ -406,7 +405,7 @@ lazy val addBootstrapInProguardedJar = {
|
||||||
import java.nio.charset.StandardCharsets
|
import java.nio.charset.StandardCharsets
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
|
|
||||||
ProguardKeys.proguard.in(Proguard) := {
|
proguard.in(Proguard) := {
|
||||||
val bootstrapJar = packageBin.in(bootstrap).in(Compile).value
|
val bootstrapJar = packageBin.in(bootstrap).in(Compile).value
|
||||||
val source = proguardedJar.value
|
val source = proguardedJar.value
|
||||||
|
|
||||||
|
|
@ -439,15 +438,15 @@ lazy val addBootstrapInProguardedJar = {
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy val proguardedCli = Seq(
|
lazy val proguardedCli = Seq(
|
||||||
ProguardKeys.proguardVersion.in(Proguard) := SharedVersions.proguard,
|
proguardVersion.in(Proguard) := SharedVersions.proguard,
|
||||||
ProguardKeys.options.in(Proguard) ++= Seq(
|
proguardOptions.in(Proguard) ++= Seq(
|
||||||
"-dontwarn",
|
"-dontwarn",
|
||||||
"-keep class coursier.cli.Coursier {\n public static void main(java.lang.String[]);\n}",
|
"-keep class coursier.cli.Coursier {\n public static void main(java.lang.String[]);\n}",
|
||||||
"-keep class coursier.cli.IsolatedClassLoader {\n public java.lang.String[] getIsolationTargets();\n}",
|
"-keep class coursier.cli.IsolatedClassLoader {\n public java.lang.String[] getIsolationTargets();\n}",
|
||||||
"-adaptresourcefilenames **.properties"
|
"-adaptresourcefilenames **.properties"
|
||||||
),
|
),
|
||||||
javaOptions.in(Proguard, ProguardKeys.proguard) := Seq("-Xmx3172M"),
|
javaOptions.in(Proguard, proguard) := Seq("-Xmx3172M"),
|
||||||
artifactPath.in(Proguard) := ProguardKeys.proguardDirectory.in(Proguard).value / "coursier-standalone.jar",
|
artifactPath.in(Proguard) := proguardDirectory.in(Proguard).value / "coursier-standalone.jar",
|
||||||
artifacts ++= {
|
artifacts ++= {
|
||||||
if (scalaBinaryVersion.value == "2.11")
|
if (scalaBinaryVersion.value == "2.11")
|
||||||
Seq(proguardedArtifact.value)
|
Seq(proguardedArtifact.value)
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,6 @@ import sbt.Defaults.itSettings
|
||||||
import sbt.Keys._
|
import sbt.Keys._
|
||||||
import sbt.ScriptedPlugin.{scriptedConf, scriptedLaunchConf, scriptedSbt, scriptedSettings}
|
import sbt.ScriptedPlugin.{scriptedConf, scriptedLaunchConf, scriptedSbt, scriptedSettings}
|
||||||
|
|
||||||
import com.typesafe.sbt.SbtProguard.proguardSettings
|
|
||||||
|
|
||||||
object Aliases {
|
object Aliases {
|
||||||
|
|
||||||
def libs = libraryDependencies
|
def libs = libraryDependencies
|
||||||
|
|
@ -31,8 +29,6 @@ object Aliases {
|
||||||
|
|
||||||
def hasITs = itSettings
|
def hasITs = itSettings
|
||||||
|
|
||||||
def proguard = proguardSettings
|
|
||||||
|
|
||||||
def ShadingPlugin = coursier.ShadingPlugin
|
def ShadingPlugin = coursier.ShadingPlugin
|
||||||
|
|
||||||
def root = file(".")
|
def root = file(".")
|
||||||
|
|
|
||||||
|
|
@ -3,16 +3,25 @@ import java.nio.file.Files
|
||||||
import java.util.regex.Pattern
|
import java.util.regex.Pattern
|
||||||
|
|
||||||
import com.typesafe.sbt.pgp.PgpKeys
|
import com.typesafe.sbt.pgp.PgpKeys
|
||||||
import sbt._
|
import sbt.{ProcessLogger => _, _}
|
||||||
import sbt.Keys._
|
import sbt.Keys._
|
||||||
import sbt.Package.ManifestAttributes
|
import sbt.Package.ManifestAttributes
|
||||||
import sbtrelease.ReleasePlugin.autoImport._
|
import sbtrelease.ReleasePlugin.autoImport._
|
||||||
import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._
|
import sbtrelease.ReleasePlugin.autoImport.ReleaseTransformations._
|
||||||
|
|
||||||
import scala.io._
|
import scala.io._
|
||||||
|
import scala.sys.process.ProcessLogger
|
||||||
|
|
||||||
object Release {
|
object Release {
|
||||||
|
|
||||||
|
// adapted from https://github.com/sbt/sbt-release/blob/eccd4cb7b9818b2a731380fe31c399dc9cb7375b/src/main/scala/ReleaseExtra.scala#L239-L243
|
||||||
|
private def toProcessLogger(st: State): ProcessLogger =
|
||||||
|
new ProcessLogger {
|
||||||
|
def err(s: => String) = st.log.info(s)
|
||||||
|
def out(s: => String) = st.log.info(s)
|
||||||
|
def buffer[T](f: => T) = st.log.buffer(f)
|
||||||
|
}
|
||||||
|
|
||||||
implicit final class StateOps(val state: State) extends AnyVal {
|
implicit final class StateOps(val state: State) extends AnyVal {
|
||||||
def vcs: sbtrelease.Vcs =
|
def vcs: sbtrelease.Vcs =
|
||||||
Project.extract(state).get(releaseVcs).getOrElse {
|
Project.extract(state).get(releaseVcs).getOrElse {
|
||||||
|
|
@ -112,9 +121,11 @@ object Release {
|
||||||
|
|
||||||
val vcs = state.vcs
|
val vcs = state.vcs
|
||||||
|
|
||||||
|
val log = toProcessLogger(state)
|
||||||
|
|
||||||
for (f <- scriptFiles) {
|
for (f <- scriptFiles) {
|
||||||
updateVersionInScript(f, releaseVer)
|
updateVersionInScript(f, releaseVer)
|
||||||
vcs.add(f.getAbsolutePath).!!(state.log)
|
vcs.add(f.getAbsolutePath).!!(log)
|
||||||
}
|
}
|
||||||
|
|
||||||
state
|
state
|
||||||
|
|
@ -130,10 +141,11 @@ object Release {
|
||||||
)
|
)
|
||||||
|
|
||||||
val vcs = state.vcs
|
val vcs = state.vcs
|
||||||
|
val log = toProcessLogger(state)
|
||||||
|
|
||||||
for ((f, output) <- scriptFiles) {
|
for ((f, output) <- scriptFiles) {
|
||||||
sbt.Process(Seq(f.getAbsolutePath, "-f")).!!(state.log)
|
sbt.Process(Seq(f.getAbsolutePath, "-f")).!!(state.log)
|
||||||
vcs.add(output.getAbsolutePath).!!(state.log)
|
vcs.add(output.getAbsolutePath).!!(log)
|
||||||
}
|
}
|
||||||
|
|
||||||
state
|
state
|
||||||
|
|
@ -163,6 +175,8 @@ object Release {
|
||||||
|
|
||||||
val updateTutReadme = ReleaseStep { state =>
|
val updateTutReadme = ReleaseStep { state =>
|
||||||
|
|
||||||
|
val log = toProcessLogger(state)
|
||||||
|
|
||||||
val previousVer = state.get(previousReleaseVersion).getOrElse {
|
val previousVer = state.get(previousReleaseVersion).getOrElse {
|
||||||
sys.error(s"${previousReleaseVersion.label} key not set")
|
sys.error(s"${previousReleaseVersion.label} key not set")
|
||||||
}
|
}
|
||||||
|
|
@ -177,17 +191,19 @@ object Release {
|
||||||
val newContent = pattern.replaceAllIn(content, releaseVer)
|
val newContent = pattern.replaceAllIn(content, releaseVer)
|
||||||
Files.write(readmeFile.toPath, newContent.getBytes(StandardCharsets.UTF_8))
|
Files.write(readmeFile.toPath, newContent.getBytes(StandardCharsets.UTF_8))
|
||||||
|
|
||||||
state.vcs.add(readmeFile.getAbsolutePath).!!(state.log)
|
state.vcs.add(readmeFile.getAbsolutePath).!!(log)
|
||||||
|
|
||||||
state
|
state
|
||||||
}
|
}
|
||||||
|
|
||||||
val stageReadme = ReleaseStep { state =>
|
val stageReadme = ReleaseStep { state =>
|
||||||
|
|
||||||
|
val log = toProcessLogger(state)
|
||||||
|
|
||||||
val baseDir = Project.extract(state).get(baseDirectory.in(ThisBuild))
|
val baseDir = Project.extract(state).get(baseDirectory.in(ThisBuild))
|
||||||
val processedReadmeFile = baseDir / "README.md"
|
val processedReadmeFile = baseDir / "README.md"
|
||||||
|
|
||||||
state.vcs.add(processedReadmeFile.getAbsolutePath).!!(state.log)
|
state.vcs.add(processedReadmeFile.getAbsolutePath).!!(log)
|
||||||
|
|
||||||
state
|
state
|
||||||
}
|
}
|
||||||
|
|
@ -198,6 +214,7 @@ object Release {
|
||||||
val updatePluginsSbt = ReleaseStep { state =>
|
val updatePluginsSbt = ReleaseStep { state =>
|
||||||
|
|
||||||
val vcs = state.vcs
|
val vcs = state.vcs
|
||||||
|
val log = toProcessLogger(state)
|
||||||
|
|
||||||
val (releaseVer, _) = state.get(ReleaseKeys.versions).getOrElse {
|
val (releaseVer, _) = state.get(ReleaseKeys.versions).getOrElse {
|
||||||
sys.error(s"${ReleaseKeys.versions.label} key not set")
|
sys.error(s"${ReleaseKeys.versions.label} key not set")
|
||||||
|
|
@ -221,7 +238,7 @@ object Release {
|
||||||
|
|
||||||
val newContent = coursierVersionPattern.replaceAllIn(content, "def coursierVersion0 = \"" + releaseVer + "\"")
|
val newContent = coursierVersionPattern.replaceAllIn(content, "def coursierVersion0 = \"" + releaseVer + "\"")
|
||||||
Files.write(f.toPath, newContent.getBytes(StandardCharsets.UTF_8))
|
Files.write(f.toPath, newContent.getBytes(StandardCharsets.UTF_8))
|
||||||
vcs.add(f.getAbsolutePath).!!(state.log)
|
vcs.add(f.getAbsolutePath).!!(log)
|
||||||
}
|
}
|
||||||
|
|
||||||
state
|
state
|
||||||
|
|
@ -232,6 +249,7 @@ object Release {
|
||||||
val updateMimaVersions = ReleaseStep { state =>
|
val updateMimaVersions = ReleaseStep { state =>
|
||||||
|
|
||||||
val vcs = state.vcs
|
val vcs = state.vcs
|
||||||
|
val log = toProcessLogger(state)
|
||||||
|
|
||||||
val (releaseVer, _) = state.get(ReleaseKeys.versions).getOrElse {
|
val (releaseVer, _) = state.get(ReleaseKeys.versions).getOrElse {
|
||||||
sys.error(s"${ReleaseKeys.versions.label} key not set")
|
sys.error(s"${ReleaseKeys.versions.label} key not set")
|
||||||
|
|
@ -258,7 +276,7 @@ object Release {
|
||||||
)
|
)
|
||||||
|
|
||||||
Files.write(mimaScalaFile.toPath, newContent.getBytes(StandardCharsets.UTF_8))
|
Files.write(mimaScalaFile.toPath, newContent.getBytes(StandardCharsets.UTF_8))
|
||||||
vcs.add(mimaScalaFile.getAbsolutePath).!!(state.log)
|
vcs.add(mimaScalaFile.getAbsolutePath).!!(log)
|
||||||
|
|
||||||
state
|
state
|
||||||
}
|
}
|
||||||
|
|
@ -266,11 +284,13 @@ object Release {
|
||||||
val commitUpdates = ReleaseStep(
|
val commitUpdates = ReleaseStep(
|
||||||
action = { state =>
|
action = { state =>
|
||||||
|
|
||||||
|
val log = toProcessLogger(state)
|
||||||
|
|
||||||
val (releaseVer, _) = state.get(ReleaseKeys.versions).getOrElse {
|
val (releaseVer, _) = state.get(ReleaseKeys.versions).getOrElse {
|
||||||
sys.error(s"${ReleaseKeys.versions.label} key not set")
|
sys.error(s"${ReleaseKeys.versions.label} key not set")
|
||||||
}
|
}
|
||||||
|
|
||||||
state.vcs.commit(s"Updates for $releaseVer", sign = true).!(state.log)
|
state.vcs.commit(s"Updates for $releaseVer", sign = true).!(log)
|
||||||
|
|
||||||
state
|
state
|
||||||
},
|
},
|
||||||
|
|
@ -311,6 +331,8 @@ object Release {
|
||||||
// tagRelease from sbt-release seem to use the next version (snapshot one typically) rather than the released one :/
|
// tagRelease from sbt-release seem to use the next version (snapshot one typically) rather than the released one :/
|
||||||
val reallyTagRelease = ReleaseStep { state =>
|
val reallyTagRelease = ReleaseStep { state =>
|
||||||
|
|
||||||
|
val log = toProcessLogger(state)
|
||||||
|
|
||||||
val (releaseVer, _) = state.get(ReleaseKeys.versions).getOrElse {
|
val (releaseVer, _) = state.get(ReleaseKeys.versions).getOrElse {
|
||||||
sys.error(s"${ReleaseKeys.versions.label} key not set")
|
sys.error(s"${ReleaseKeys.versions.label} key not set")
|
||||||
}
|
}
|
||||||
|
|
@ -319,7 +341,7 @@ object Release {
|
||||||
|
|
||||||
val tag = "v" + releaseVer
|
val tag = "v" + releaseVer
|
||||||
|
|
||||||
state.vcs.tag(tag, s"Releasing $tag", sign).!(state.log)
|
state.vcs.tag(tag, s"Releasing $tag", sign).!(log)
|
||||||
|
|
||||||
state
|
state
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,10 @@ import sbt._
|
||||||
import sbt.Keys._
|
import sbt.Keys._
|
||||||
import sbt.ScriptedPlugin._
|
import sbt.ScriptedPlugin._
|
||||||
|
|
||||||
|
import com.lightbend.sbt.SbtProguard.autoImport._
|
||||||
import com.typesafe.sbt.pgp._
|
import com.typesafe.sbt.pgp._
|
||||||
import com.typesafe.sbt.SbtProguard._
|
|
||||||
import coursier.ShadingPlugin.autoImport._
|
import coursier.ShadingPlugin.autoImport._
|
||||||
|
|
||||||
import xerial.sbt.Pack.{packAutoSettings, packExcludeArtifactTypes}
|
|
||||||
|
|
||||||
import Aliases._
|
import Aliases._
|
||||||
|
|
||||||
object Settings {
|
object Settings {
|
||||||
|
|
@ -225,10 +223,6 @@ object Settings {
|
||||||
PgpKeys.publishLocalSigned := PgpKeys.publishLocalSigned.in(Shading).value
|
PgpKeys.publishLocalSigned := PgpKeys.publishLocalSigned.in(Shading).value
|
||||||
)
|
)
|
||||||
|
|
||||||
lazy val generatePack = packAutoSettings :+ {
|
|
||||||
packExcludeArtifactTypes += "pom"
|
|
||||||
}
|
|
||||||
|
|
||||||
lazy val proguardedArtifact = Def.setting {
|
lazy val proguardedArtifact = Def.setting {
|
||||||
Artifact(
|
Artifact(
|
||||||
moduleName.value,
|
moduleName.value,
|
||||||
|
|
@ -240,7 +234,7 @@ object Settings {
|
||||||
|
|
||||||
lazy val proguardedJar = Def.task {
|
lazy val proguardedJar = Def.task {
|
||||||
|
|
||||||
val results = ProguardKeys.proguard.in(Proguard).value
|
val results = proguard.in(Proguard).value
|
||||||
|
|
||||||
results match {
|
results match {
|
||||||
case Seq(f) => f
|
case Seq(f) => f
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
|
|
||||||
plugins_(
|
plugins_(
|
||||||
"io.get-coursier" % "sbt-coursier" % coursierVersion,
|
"io.get-coursier" % "sbt-coursier" % coursierVersion,
|
||||||
"com.typesafe" % "sbt-mima-plugin" % "0.1.15",
|
"com.typesafe" % "sbt-mima-plugin" % "0.1.18",
|
||||||
"org.xerial.sbt" % "sbt-pack" % "0.8.2",
|
"org.xerial.sbt" % "sbt-pack" % "0.9.1",
|
||||||
"com.jsuereth" % "sbt-pgp" % "1.0.1",
|
"com.jsuereth" % "sbt-pgp" % "1.1.0",
|
||||||
"com.typesafe.sbt" % "sbt-proguard" % "0.2.3",
|
"com.lightbend.sbt" % "sbt-proguard" % "0.3.0",
|
||||||
"com.github.gseitz" % "sbt-release" % "1.0.5",
|
"com.github.gseitz" % "sbt-release" % "1.0.6",
|
||||||
"org.scala-js" % "sbt-scalajs" % "0.6.19",
|
"org.scala-js" % "sbt-scalajs" % "0.6.20",
|
||||||
"io.get-coursier" % "sbt-shading" % coursierVersion,
|
"io.get-coursier" % "sbt-shading" % coursierVersion,
|
||||||
"org.xerial.sbt" % "sbt-sonatype" % "1.1",
|
"org.xerial.sbt" % "sbt-sonatype" % "2.0",
|
||||||
"com.timushev.sbt" % "sbt-updates" % "0.3.0",
|
"com.timushev.sbt" % "sbt-updates" % "0.3.3",
|
||||||
"org.tpolecat" % "tut-plugin" % "0.5.2"
|
"org.tpolecat" % "tut-plugin" % "0.5.5"
|
||||||
)
|
)
|
||||||
|
|
||||||
libs ++= Seq(
|
libs ++= Seq(
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
addSbtCoursier
|
addSbtCoursier
|
||||||
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.3.0")
|
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.3.3")
|
||||||
|
|
||||||
// required for just released things
|
// required for just released things
|
||||||
resolvers += Resolver.sonatypeRepo("releases")
|
resolvers += Resolver.sonatypeRepo("releases")
|
||||||
|
|
|
||||||
|
|
@ -129,6 +129,17 @@ checkBinaryCompatibility() {
|
||||||
|
|
||||||
testLauncherJava6() {
|
testLauncherJava6() {
|
||||||
sbt ++${SCALA_VERSION} cli/pack
|
sbt ++${SCALA_VERSION} cli/pack
|
||||||
|
|
||||||
|
# Via docker, getting errors like
|
||||||
|
# standard_init_linux.go:178: exec user process caused "exec format error"
|
||||||
|
# because of the initial empty line in the sbt-pack launchers.
|
||||||
|
# Required until something like https://github.com/xerial/sbt-pack/pull/120
|
||||||
|
# gets merged.
|
||||||
|
local DIR="cli/target/pack/bin"
|
||||||
|
mv "$DIR/coursier" "$DIR/coursier.orig"
|
||||||
|
sed '1{/^$/d}' < "$DIR/coursier.orig" > "$DIR/coursier"
|
||||||
|
chmod +x "$DIR/coursier"
|
||||||
|
|
||||||
docker run -it --rm \
|
docker run -it --rm \
|
||||||
-v $(pwd)/cli/target/pack:/opt/coursier \
|
-v $(pwd)/cli/target/pack:/opt/coursier \
|
||||||
-e CI=true \
|
-e CI=true \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue