Merge branch 'master' into wip/sbtopts-crlf

This commit is contained in:
eugene yokota 2017-09-18 12:55:40 -04:00 committed by GitHub
commit 206ccb675a
5 changed files with 46 additions and 26 deletions

View File

@ -82,12 +82,13 @@ val root = (project in file(".")).
if !(link.destination endsWith "sbt-launch.jar")
} yield link
},
// DEBIAN SPECIFIC
debianBuildId := 0,
version in Debian := {
if (debianBuildId.value == 0) sbtVersionToRelease
else sbtVersionToRelease + "." + debianBuildId.value
},
debianBuildId := 3, // 0
// 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
debianPackageDependencies in Debian ++= Seq("bash (>= 3.2)"),
@ -100,10 +101,9 @@ val root = (project in file(".")).
},
debianChangelog in Debian := { Some(sourceDirectory.value / "debian" / "changelog") },
addPackage(Debian, packageBin in Debian, "deb"),
maintainerScripts in Debian := maintainerScriptsAppend((maintainerScripts in Debian).value)(
Postinst -> s"/usr/share/sbt/bin/sbt about"
),
// RPM SPECIFIC
rpmRelease := "0",
version in Rpm := {
val stable0 = (sbtVersionToRelease split "[^\\d]" filterNot (_.isEmpty) mkString ".")
val stable = if (rpmRelease.value == "0") stable0
@ -113,7 +113,6 @@ val root = (project in file(".")).
})
else stable
},
rpmRelease := "3",
rpmVendor := "lightbend",
rpmUrl := Some("http://github.com/sbt/sbt-launcher-package"),
rpmLicense := Some("BSD"),
@ -123,9 +122,6 @@ val root = (project in file(".")).
// https://github.com/elastic/logstash/issues/6275#issuecomment-261359933
rpmRequirements := Seq(),
rpmProvides := Seq("sbt"),
maintainerScripts in Rpm := maintainerScriptsAppend((maintainerScripts in Rpm).value)(
RpmConstants.Post -> s"/usr/share/sbt/bin/sbt about"
),
// WINDOWS SPECIFIC
windowsBuildId := 0,
@ -149,6 +145,29 @@ val root = (project in file(".")).
// Universal ZIP download install.
packageName in Universal := packageName.value, // needs to be set explicitly due to a bug in native-packager
version in Universal := sbtVersionToRelease,
mappings in Universal := {
val t = (target in Universal).value
val prev = (mappings in Universal).value
val BinBash = "bin" + java.io.File.separator + "sbt-launch-lib.bash"
val BinBat = "bin" + java.io.File.separator + "sbt.bat"
prev.toList map {
case (k, BinBash) =>
val x = IO.read(k)
IO.write(t / "sbt-launch-lib.bash", x.replaceAllLiterally(
"declare init_sbt_version=_to_be_replaced",
s"""declare init_sbt_version="$sbtVersionToRelease""""))
(t / "sbt-launch-lib.bash", BinBash)
case (k, BinBat) =>
val x = IO.read(k)
IO.write(t / "sbt.bat", x.replaceAllLiterally(
"set INIT_SBT_VERSION=_TO_BE_REPLACED",
s"""set INIT_SBT_VERSION="$sbtVersionToRelease""""))
(t / "sbt.bat", BinBat)
case (k, v) => (k, v)
}
},
mappings in Universal ++= {
val launchJar = sbtLaunchJar.value
val rtExportJar = (packageBin in Compile in java9rtexport).value
@ -162,17 +181,6 @@ val root = (project in file(".")).
}
else Def.task { Seq[(File, String)]() }
}).value,
stage in Universal := {
val old = (stage in Universal).value
val sd = (stagingDirectory in Universal).value
val x = IO.read(sd / "bin" / "sbt-launch-lib.bash")
IO.write(sd / "bin" / "sbt-launch-lib.bash", x.replaceAllLiterally(
"declare init_sbt_version=_to_be_replaced", s"declare init_sbt_version=$sbtVersionToRelease"))
val y = IO.read(sd / "bin" / "sbt.bat")
IO.write(sd / "bin" / "sbt.bat", y.replaceAllLiterally(
"set INIT_SBT_VERSION=_TO_BE_REPLACED", s"set INIT_SBT_VERSION=$sbtVersionToRelease"))
old
},
// Misccelaneous publishing stuff...
projectID in Debian := {

View File

@ -1,4 +1,4 @@
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.2.0-M8")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.2.0-M9")
libraryDependencies += "net.databinder" %% "dispatch-http" % "0.8.10"
addSbtPlugin("me.lessis" % "bintray-sbt" % "0.3.0")
addSbtPlugin("com.eed3si9n" % "sbt-export-repo" % "0.1.0")

View File

@ -1,3 +1,10 @@
sbt (1.0.0) stable; urgency=low
* sbt 1.0 uses Scala 2.12 for build definitions and plugins. This also requires JDK 8.
* See http://www.scala-sbt.org/1.x/docs/sbt-1.0-Release-Notes.html for the full list of changes.
-- Eugene Yokota <eed3si9n@gmail.com> Fri, 11 Aug 2017 00:00:00 +0000
sbt (0.13.15) stable; urgency=low
* sbt 0.13.15 removes the Maven version range when possible.

View File

@ -63,7 +63,8 @@ cygwinpath() {
declare -r noshare_opts="-Dsbt.global.base=project/.sbtboot -Dsbt.boot.directory=project/.boot -Dsbt.ivy.home=project/.ivy"
declare -r sbt_opts_file=".sbtopts"
declare -r etc_sbt_opts_file="${sbt_home}/conf/sbtopts"
declare -r etc_sbt_opts_file="/etc/sbt/sbtopts"
declare -r dist_sbt_opts_file="${sbt_home}/conf/sbtopts"
declare -r win_sbt_opts_file="${sbt_home}/conf/sbtconfig.txt"
usage() {
@ -135,11 +136,15 @@ process_my_args () {
}
loadConfigFile() {
cat "$1" | sed '/^\#/d;s/\r$//' | while read line; do
# Make sure the last line is read even if it doesn't have a terminating \n
cat "$1" | sed '/^\#/d;s/\r$//' | while read -r line || [[ -n "$line" ]]; do
eval echo $line
done
}
# Here we pull in the default settings configuration.
[[ -f "$dist_sbt_opts_file" ]] && set -- $(loadConfigFile "$dist_sbt_opts_file") "$@"
# Here we pull in the global settings configuration.
[[ -f "$etc_sbt_opts_file" ]] && set -- $(loadConfigFile "$etc_sbt_opts_file") "$@"

View File

@ -157,7 +157,7 @@ process_args () {
*) addResidual "$1" && shift ;;
esac
done
is_function_defined process_my_args && {
myargs=("${residual_args[@]}")
residual_args=()
@ -165,7 +165,7 @@ process_args () {
}
## parses 1.7, 1.8, 9, etc out of java version "1.8.0_91"
java_version=$("$java_cmd" -Xmx512M -version 2>&1 | sed 's/.*version "\([0-9]*\)\(\.[0-9]*\)\{0,1\}\(.*\)*"/\1\2/; 1q')
java_version=$("$java_cmd" -Xmx512M -version 2>&1 | grep ' version "' | sed 's/.*version "\([0-9]*\)\(\.[0-9]*\)\{0,1\}\(.*\)*"/\1\2/; 1q')
vlog "[process_args] java_version = '$java_version'"
}
@ -265,8 +265,8 @@ run() {
${java_args[@]} \
-jar "$sbt_jar" \
"${sbt_commands[@]}" \
"${residual_args[@]}"
"${residual_args[@]}"
exit_code=$?
# Clean up the terminal from cygwin hacks.