Switch remaining uses of ant over to sbt
- Modify `tools/scaladoc-diff` to use sbt instead of ant. - Move `stability-test.sh` from `tools` to `scripts`. With the new build process without separate `locker` and `strap` stages, it doesn’t make sense to call this script without first setting up the proper test environment in a CI build. - Replace the use of `build.number` in `bootstrap` with a new `SHA-NIGHTLY` mode for `baseVersionSuffix`. - Make `partest` call sbt instead of ant for initializing the classpath and use the new classpath location (`quick` instead of `pack`).
This commit is contained in:
parent
74702078b1
commit
e2b6c7b608
10
build.sbt
10
build.sbt
|
@ -102,12 +102,10 @@ lazy val publishSettings : Seq[Setting[_]] = Seq(
|
||||||
publishMavenStyle := true
|
publishMavenStyle := true
|
||||||
)
|
)
|
||||||
|
|
||||||
// Set the version number: The ANT build uses the file "build.number" to get the base version. Overriding versions or
|
// Set the version number: We use the two settings `baseVersion` and `baseVersionSuffix` to compute all versions
|
||||||
// suffixes for certain builds is done by directly setting variables from the shell scripts. For example, in
|
// (canonical, Maven, OSGi). See VersionUtil.versionPropertiesImpl for details. The standard sbt `version` setting
|
||||||
// publish-core this requires computing the commit SHA first and then passing it to ANT. In the sbt build we use
|
// should not be set directly. It is the same as the Maven version and derived automatically from `baseVersion` and
|
||||||
// the two settings `baseVersion` and `baseVersionSuffix` to compute all versions (canonical, Maven, OSGi). See
|
// `baseVersionSuffix`.
|
||||||
// VersionUtil.versionPropertiesImpl for details. The standard sbt `version` setting should not be set directly. It
|
|
||||||
// is the same as the Maven version and derived automatically from `baseVersion` and `baseVersionSuffix`.
|
|
||||||
globalVersionSettings
|
globalVersionSettings
|
||||||
baseVersion in Global := "2.12.0"
|
baseVersion in Global := "2.12.0"
|
||||||
baseVersionSuffix in Global := "SNAPSHOT"
|
baseVersionSuffix in Global := "SNAPSHOT"
|
||||||
|
|
|
@ -27,12 +27,13 @@ object VersionUtil {
|
||||||
generateBuildCharacterPropertiesFile := generateBuildCharacterPropertiesFileImpl.value
|
generateBuildCharacterPropertiesFile := generateBuildCharacterPropertiesFileImpl.value
|
||||||
)
|
)
|
||||||
|
|
||||||
case class Versions(canonicalVersion: String, mavenVersion: String, osgiVersion: String, commitSha: String, commitDate: String, isRelease: Boolean) {
|
case class Versions(canonicalVersion: String, mavenBase: String, mavenSuffix: String, osgiVersion: String, commitSha: String, commitDate: String, isRelease: Boolean) {
|
||||||
val githubTree =
|
val githubTree =
|
||||||
if(isRelease) "v" + mavenVersion
|
if(isRelease) "v" + mavenVersion
|
||||||
else if(commitSha != "unknown") commitSha
|
else if(commitSha != "unknown") commitSha
|
||||||
else "master"
|
else "master"
|
||||||
|
|
||||||
|
def mavenVersion: String = mavenBase + mavenSuffix
|
||||||
override def toString = s"Canonical: $canonicalVersion, Maven: $mavenVersion, OSGi: $osgiVersion, github: $githubTree"
|
override def toString = s"Canonical: $canonicalVersion, Maven: $mavenVersion, OSGi: $osgiVersion, github: $githubTree"
|
||||||
|
|
||||||
def toMap: Map[String, String] = Map(
|
def toMap: Map[String, String] = Map(
|
||||||
|
@ -45,17 +46,18 @@ object VersionUtil {
|
||||||
/** Compute the canonical, Maven and OSGi version number from `baseVersion` and `baseVersionSuffix`.
|
/** Compute the canonical, Maven and OSGi version number from `baseVersion` and `baseVersionSuffix`.
|
||||||
* Examples of the generated versions:
|
* Examples of the generated versions:
|
||||||
*
|
*
|
||||||
* ("2.11.8", "SNAPSHOT" ) -> ("2.11.8-20151215-133023-7559aed3c5", "2.11.8-SNAPSHOT", "2.11.8.v20151215-133023-7559aed3c5")
|
* ("2.11.8", "SNAPSHOT" ) -> ("2.11.8-20151215-133023-7559aed", "2.11.8-SNAPSHOT", "2.11.8.v20151215-133023-7559aed")
|
||||||
* ("2.11.8", "SHA-SNAPSHOT") -> ("2.11.8-20151215-133023-7559aed3c5", "2.11.8-7559aed3c5-SNAPSHOT", "2.11.8.v20151215-133023-7559aed3c5")
|
* ("2.11.8", "SHA-SNAPSHOT") -> ("2.11.8-20151215-133023-7559aed", "2.11.8-7559aed-SNAPSHOT", "2.11.8.v20151215-133023-7559aed")
|
||||||
* ("2.11.8", "" ) -> ("2.11.8", "2.11.8", "2.11.8.v20151215-133023-VFINAL-7559aed3c5")
|
* ("2.11.8", "SHA-NIGHTLY" ) -> ("2.11.8-7559aed-nightly", "2.11.8-7559aed-nightly", "2.11.8.v20151215-133023-NIGHTLY-7559aed")
|
||||||
* ("2.11.8", "M3" ) -> ("2.11.8-M3", "2.11.8-M3", "2.11.8.v20151215-133023-M3-7559aed3c5")
|
* ("2.11.8", "" ) -> ("2.11.8", "2.11.8", "2.11.8.v20151215-133023-VFINAL-7559aed")
|
||||||
* ("2.11.8", "RC4" ) -> ("2.11.8-RC4", "2.11.8-RC4", "2.11.8.v20151215-133023-RC4-7559aed3c5")
|
* ("2.11.8", "M3" ) -> ("2.11.8-M3", "2.11.8-M3", "2.11.8.v20151215-133023-M3-7559aed")
|
||||||
* ("2.11.8-RC4", "SPLIT" ) -> ("2.11.8-RC4", "2.11.8-RC4", "2.11.8.v20151215-133023-RC4-7559aed3c5")
|
* ("2.11.8", "RC4" ) -> ("2.11.8-RC4", "2.11.8-RC4", "2.11.8.v20151215-133023-RC4-7559aed")
|
||||||
|
* ("2.11.8-RC4", "SPLIT" ) -> ("2.11.8-RC4", "2.11.8-RC4", "2.11.8.v20151215-133023-RC4-7559aed")
|
||||||
*
|
*
|
||||||
* A `baseVersionSuffix` of "SNAPSHOT" is the default, which is used for local snapshot builds. The PR validation
|
* A `baseVersionSuffix` of "SNAPSHOT" is the default, which is used for local snapshot builds. The PR validation
|
||||||
* job uses "SHA-SNAPSHOT". An empty suffix is used for releases. All other suffix values are treated as RC /
|
* job uses "SHA-SNAPSHOT". A proper version number for a nightly build can be computed with "SHA-nightly". An empty
|
||||||
* milestone builds. The special suffix value "SPLIT" is used to split the real suffix off from `baseVersion`
|
* suffix is used for releases. All other suffix values are treated as RC / milestone builds. The special suffix
|
||||||
* instead and then apply the usual logic. */
|
* value "SPLIT" is used to split the real suffix off from `baseVersion` instead and then apply the usual logic. */
|
||||||
private lazy val versionPropertiesImpl: Def.Initialize[Versions] = Def.setting {
|
private lazy val versionPropertiesImpl: Def.Initialize[Versions] = Def.setting {
|
||||||
|
|
||||||
val (base, suffix) = {
|
val (base, suffix) = {
|
||||||
|
@ -76,16 +78,17 @@ object VersionUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
val date = executeTool("get-scala-commit-date")
|
val date = executeTool("get-scala-commit-date")
|
||||||
val sha = executeTool("get-scala-commit-sha").substring(0, 7) // The script produces 10 digits at the moment
|
val sha = executeTool("get-scala-commit-sha").substring(0, 7)
|
||||||
|
|
||||||
val (canonicalV, mavenV, osgiV, release) = suffix match {
|
val (canonicalV, mavenSuffix, osgiV, release) = suffix match {
|
||||||
case "SNAPSHOT" => (s"$base-$date-$sha", s"$base-SNAPSHOT", s"$base.v$date-$sha", false)
|
case "SNAPSHOT" => (s"$base-$date-$sha", s"-SNAPSHOT", s"$base.v$date-$sha", false)
|
||||||
case "SHA-SNAPSHOT" => (s"$base-$date-$sha", s"$base-$sha-SNAPSHOT", s"$base.v$date-$sha", false)
|
case "SHA-SNAPSHOT" => (s"$base-$date-$sha", s"-$sha-SNAPSHOT", s"$base.v$date-$sha", false)
|
||||||
case "" => (s"$base", s"$base", s"$base.v$date-VFINAL-$sha", true)
|
case "SHA-NIGHTLY" => (s"$base-$sha-nightly", s"-$sha-nightly", s"$base.v$date-NIGHTLY-$sha", true)
|
||||||
case suffix => (s"$base-$suffix", s"$base-$suffix", s"$base.v$date-$suffix-$sha", true)
|
case "" => (s"$base", "", s"$base.v$date-VFINAL-$sha", true)
|
||||||
|
case suffix => (s"$base-$suffix", s"-$suffix", s"$base.v$date-$suffix-$sha", true)
|
||||||
}
|
}
|
||||||
|
|
||||||
Versions(canonicalV, mavenV, osgiV, sha, date, release)
|
Versions(canonicalV, base, mavenSuffix, osgiV, sha, date, release)
|
||||||
}
|
}
|
||||||
|
|
||||||
private lazy val generateVersionPropertiesFileImpl: Def.Initialize[Task[File]] = Def.task {
|
private lazy val generateVersionPropertiesFileImpl: Def.Initialize[Task[File]] = Def.task {
|
||||||
|
@ -94,7 +97,11 @@ object VersionUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
private lazy val generateBuildCharacterPropertiesFileImpl: Def.Initialize[Task[File]] = Def.task {
|
private lazy val generateBuildCharacterPropertiesFileImpl: Def.Initialize[Task[File]] = Def.task {
|
||||||
writeProps(versionProperties.value.toMap ++ versionProps, (baseDirectory in ThisBuild).value / "buildcharacter.properties")
|
val v = versionProperties.value
|
||||||
|
writeProps(v.toMap ++ versionProps ++ Map(
|
||||||
|
"maven.version.base" -> v.mavenBase,
|
||||||
|
"maven.version.suffix" -> v.mavenSuffix
|
||||||
|
), (baseDirectory in ThisBuild).value / "buildcharacter.properties")
|
||||||
}
|
}
|
||||||
|
|
||||||
private def writeProps(m: Map[String, String], propFile: File): File = {
|
private def writeProps(m: Map[String, String], propFile: File): File = {
|
||||||
|
|
|
@ -327,9 +327,10 @@ determineScalaVersion() {
|
||||||
if [ -z "$scalaTag" ]
|
if [ -z "$scalaTag" ]
|
||||||
then
|
then
|
||||||
echo "No tag found, building nightly snapshot."
|
echo "No tag found, building nightly snapshot."
|
||||||
parseScalaProperties "build.number"
|
$SBT_CMD $sbtArgs 'set baseVersionSuffix in Global := "SHA-NIGHTLY"' generateBuildCharacterPropertiesFile
|
||||||
SCALA_VER_BASE="$version_major.$version_minor.$version_patch"
|
parseScalaProperties "buildcharacter.properties"
|
||||||
SCALA_VER_SUFFIX="-$(git rev-parse --short HEAD)-nightly"
|
SCALA_VER_BASE="$maven_version_base"
|
||||||
|
SCALA_VER_SUFFIX="$maven_version_suffix"
|
||||||
SCALADOC_SOURCE_LINKS_VER=$(git rev-parse HEAD)
|
SCALADOC_SOURCE_LINKS_VER=$(git rev-parse HEAD)
|
||||||
|
|
||||||
# TODO: publish nightly snapshot using this script - currently it's a separate jenkins job still running at EPFL.
|
# TODO: publish nightly snapshot using this script - currently it's a separate jenkins job still running at EPFL.
|
||||||
|
@ -540,7 +541,7 @@ bootstrap() {
|
||||||
dist/mkQuick
|
dist/mkQuick
|
||||||
mv build/quick build/strap
|
mv build/quick build/strap
|
||||||
mv quick1 build/quick
|
mv quick1 build/quick
|
||||||
tools/stability-test.sh
|
$scriptsDir/stability-test.sh
|
||||||
|
|
||||||
# TODO: create PR with following commit (note that release will have been tagged already)
|
# TODO: create PR with following commit (note that release will have been tagged already)
|
||||||
# git commit versions.properties -m"Bump versions.properties for $SCALA_VER."
|
# git commit versions.properties -m"Bump versions.properties for $SCALA_VER."
|
||||||
|
|
12
test/partest
12
test/partest
|
@ -28,7 +28,7 @@ findScalaHome () {
|
||||||
# that runs this script. I don't know why. it may have to do with
|
# that runs this script. I don't know why. it may have to do with
|
||||||
# which bash flags are set (-e? -x?) and with bash flags propagating
|
# which bash flags are set (-e? -x?) and with bash flags propagating
|
||||||
# from one script to another? not sure. anyway, normally in a CI
|
# from one script to another? not sure. anyway, normally in a CI
|
||||||
# context we run partest through ant, not through this script, so I'm
|
# context we run partest through sbt, not through this script, so I'm
|
||||||
# not investigating further for now.)
|
# not investigating further for now.)
|
||||||
term_colors=$(tput colors 2>/dev/null)
|
term_colors=$(tput colors 2>/dev/null)
|
||||||
if [[ $? == 0 ]] && [[ $term_colors -gt 2 ]]; then
|
if [[ $? == 0 ]] && [[ $term_colors -gt 2 ]]; then
|
||||||
|
@ -54,14 +54,14 @@ if $cygwin; then
|
||||||
SCALA_HOME=`cygpath --unix "$SCALA_HOME"`
|
SCALA_HOME=`cygpath --unix "$SCALA_HOME"`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Let ant construct the classpath used to run partest (downloading partest from maven if necessary)
|
# Let sbt construct the classpath used to run partest (downloading partest from maven if necessary)
|
||||||
# PARTEST_CLASSPATH=""
|
# PARTEST_CLASSPATH=""
|
||||||
if [ -z "$PARTEST_CLASSPATH" ] ; then
|
if [ -z "$PARTEST_CLASSPATH" ] ; then
|
||||||
if [ ! -f "$SCALA_HOME/build/pack/partest.properties" ] ; then
|
if [ ! -f "$SCALA_HOME/build/quick/partest.properties" ] ; then
|
||||||
(cd "$SCALA_HOME" && ant -q test.suite.init) # builds pack, downloads partest and writes classpath to build/pack/partest.properties
|
(cd "$SCALA_HOME" && sbt dist/mkQuick) # builds quick, downloads partest and writes classpath to build/quick/partest.properties
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PARTEST_CLASSPATH=$( cat "$SCALA_HOME/build/pack/partest.properties" | grep partest.classpath | sed -e 's/\\:/:/g' | cut -f2- -d= )
|
PARTEST_CLASSPATH=$( cat "$SCALA_HOME/build/quick/partest.properties" | grep partest.classpath | sed -e 's/\\:/:/g' | cut -f2- -d= )
|
||||||
|
|
||||||
# sanity check, disabled to save time
|
# sanity check, disabled to save time
|
||||||
# $( javap -classpath $PARTEST_CLASSPATH scala.tools.partest.nest.NestRunner &> /dev/null ) || unset PARTEST_CLASSPATH
|
# $( javap -classpath $PARTEST_CLASSPATH scala.tools.partest.nest.NestRunner &> /dev/null ) || unset PARTEST_CLASSPATH
|
||||||
|
@ -126,7 +126,7 @@ fi
|
||||||
# supplied argument will be used.
|
# supplied argument will be used.
|
||||||
JAVA_OPTS="-Xmx1024M -Xms64M $JAVA_OPTS"
|
JAVA_OPTS="-Xmx1024M -Xms64M $JAVA_OPTS"
|
||||||
|
|
||||||
# the ant task doesn't supply any options by default,
|
# the sbt task doesn't supply any options by default,
|
||||||
# so don't do that here either -- note that you may want to pass -optimise
|
# so don't do that here either -- note that you may want to pass -optimise
|
||||||
# to mimic what happens during nightlies.
|
# to mimic what happens during nightlies.
|
||||||
# [ -n "$SCALAC_OPTS" ] || SCALAC_OPTS="-deprecation"
|
# [ -n "$SCALAC_OPTS" ] || SCALAC_OPTS="-deprecation"
|
||||||
|
|
|
@ -49,7 +49,7 @@ if [ ! -f "build/scaladoc-output-$oldsha.txt" ]
|
||||||
then
|
then
|
||||||
echo "making scaladoc for parent commit ($oldsha)"
|
echo "making scaladoc for parent commit ($oldsha)"
|
||||||
git checkout -q $oldsha
|
git checkout -q $oldsha
|
||||||
ant docs.lib -Dscaladoc.raw.output='yes' > build/scaladoc-output-$oldsha.txt
|
sbt 'set scalacOptions in Compile in doc in library += "-raw-output"' library/doc > build/scaladoc-output-$oldsha.txt
|
||||||
rm -rf build/scaladoc-${oldsha}
|
rm -rf build/scaladoc-${oldsha}
|
||||||
mv build/scaladoc build/scaladoc-${oldsha}
|
mv build/scaladoc build/scaladoc-${oldsha}
|
||||||
git checkout -q $sha
|
git checkout -q $sha
|
||||||
|
@ -57,7 +57,7 @@ fi
|
||||||
|
|
||||||
# create scaladoc for current commit
|
# create scaladoc for current commit
|
||||||
echo "making scaladoc for current commit ($sha)"
|
echo "making scaladoc for current commit ($sha)"
|
||||||
ant docs.lib -Dscaladoc.raw.output='yes' > build/scaladoc-output-$sha.txt
|
sbt 'set scalacOptions in Compile in doc in library += "-raw-output"' library/doc > build/scaladoc-output-$sha.txt
|
||||||
rm -rf build/scaladoc-${sha}
|
rm -rf build/scaladoc-${sha}
|
||||||
mv build/scaladoc build/scaladoc-${sha}
|
mv build/scaladoc build/scaladoc-${sha}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue