diff options
author | Stefan Zeiger <szeiger@novocode.com> | 2015-12-16 10:28:03 -0800 |
---|---|---|
committer | Stefan Zeiger <szeiger@novocode.com> | 2016-01-12 14:18:50 +0100 |
commit | b1b54751cd4d96c102110bdbb512c729d1f618a5 (patch) | |
tree | 1cfae17f0f97e24f32d5825896b1cd535a08edc0 /build.sbt | |
parent | 7559aed3c5b9ccf7e995d8094772340234769017 (diff) | |
download | scala-b1b54751cd4d96c102110bdbb512c729d1f618a5.tar.gz scala-b1b54751cd4d96c102110bdbb512c729d1f618a5.tar.bz2 scala-b1b54751cd4d96c102110bdbb512c729d1f618a5.zip |
Use sbt for PR validation builds.
# Improve version handling in the sbt build:
The new settings `baseVersion` and `baseVersionSuffix` make it easier
to set version numbers for different kinds of builds in a consistent
way without e.g. having to first get a git SHA outside of sbt.
The new task `generateBuildCharacterPropertiesFile` writes the file
`buildcharacter.properties` to the root dir. The format is compatible
with the same file produced by the ANT build but it only contains a
subset of the properties, in particular the Maven version, which is
needed in publishing scripts and passed around between different
Jenkins jobs as `jenkins.properties`.
SHAs in version numbers are consistently shortened to 7 digits (as used
by git and github). Previously we used 7 digits in Maven snapshot
version numbers but 10 digits in canonical and OSGi version numbers.
# Add Jenkins script support to the sbt build:
The new command `setupPublishCore` takes the PR validation snapshot
repository as an argument and changes the required settings for the
`publish-core` build (use SHA-SNAPSHOT versioning, compile with
optimization enabled, do not publish scaladoc sets)
For example, the following command can be used to generate
`buildcharacter.properties` with the version numbers needed for PR
validation builds:
sbt setupPublishCore dummy generateBuildCharacterPropertiesFile
The sbt build will now automatically detect and use a “~/.credentials”
file with the credentials for publishing to a remote repository.
# Call sbt from `publish-core`:
The correct`$SBT_CMD` is set directly in `bootstrap` and used by
`publish-core` to first generate `buildcharacter.properties` and then
build and publish. Parsing the git revision, computing a version
number and getting binary dependencies are no longer required in the
script. This is all done in the sbt build.
Diffstat (limited to 'build.sbt')
-rw-r--r-- | build.sbt | 32 |
1 files changed, 26 insertions, 6 deletions
@@ -53,7 +53,7 @@ * https://groups.google.com/d/topic/scala-internals/gp5JsM1E0Fo/discussion */ -import VersionUtil.{versionProps, versionNumber, generatePropertiesFileSettings, versionProperties, versionPropertiesSettings} +import VersionUtil._ val bootstrapScalaVersion = versionProps("starr.version") @@ -98,13 +98,27 @@ lazy val publishSettings : Seq[Setting[_]] = Seq( (f, to) } IO.copy(mappings) - } + }, + credentials ++= { + val file = Path.userHome / ".credentials" + if (file.exists) List(Credentials(file)) + else Nil + }, + publishMavenStyle := true ) -lazy val commonSettings = clearSourceAndResourceDirectories ++ versionPropertiesSettings ++ publishSettings ++ Seq[Setting[_]]( +// Set the version number: The ANT build uses the file "build.number" to get the base version. Overriding versions or +// suffixes for certain builds is done by directly setting variables from the shell scripts. For example, in +// publish-core this requires computing the commit SHA first and then passing it to ANT. In the sbt build we use +// the two settings `baseVersion` and `baseVersionSuffix` to compute all versions (canonical, Maven, OSGi). See +// 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 +baseVersion in Global := "2.11.8" +baseVersionSuffix in Global := "SNAPSHOT" + +lazy val commonSettings = clearSourceAndResourceDirectories ++ publishSettings ++ Seq[Setting[_]]( organization := "org.scala-lang", - // The ANT build uses the file "build.number" and the property "build.release" to compute the version - version := "2.11.8-SNAPSHOT", scalaVersion := bootstrapScalaVersion, // we don't cross build Scala itself crossPaths := false, @@ -649,7 +663,13 @@ lazy val scalaDist = Project("scala-dist", file(".") / "target" / "scala-dist-di lazy val root = (project in file(".")) .settings(disableDocs: _*) - .settings(publishArtifact := false) + .settings(generateBuildCharacterFileSettings: _*) + .settings( + publishArtifact := false, + publish := {}, + publishLocal := {}, + commands ++= ScriptCommands.all + ) .aggregate(library, forkjoin, reflect, compiler, interactive, repl, replJline, replJlineEmbedded, scaladoc, scalap, actors, partestExtras, junit, libraryAll, scalaDist).settings( sources in Compile := Seq.empty, |