diff options
author | Stefan Zeiger <szeiger@novocode.com> | 2016-09-06 21:55:16 +0200 |
---|---|---|
committer | Stefan Zeiger <szeiger@novocode.com> | 2016-09-06 21:55:16 +0200 |
commit | 86d492c0b79b265a596cae1e4d8fd05cc1b11d53 (patch) | |
tree | 8fc970b7faaff51a51fa6c097e96e3fb5afbde83 /build.sbt | |
parent | 4fa4b8302bffb2f35cfdaa6015ada5f8e047564d (diff) | |
download | scala-86d492c0b79b265a596cae1e4d8fd05cc1b11d53.tar.gz scala-86d492c0b79b265a596cae1e4d8fd05cc1b11d53.tar.bz2 scala-86d492c0b79b265a596cae1e4d8fd05cc1b11d53.zip |
Store buildcharacter.properties in scala-compiler.jar
In addition to all the individual projects’ version properties files
that we already keep in `scala-compiler.jar` we now write a new
`scala-buildcharacter.properties` which is identical to the
`buildcharacter.properties` written to the root directory by
`generateBuildCharacterPropertiesFile`. The new task
`extractBuildCharacterPropertiesFile` extracts it from the bootstrap
Scala compiler and writes the usual `buildcharacter.properties`.
This can be used to reproduce the exact version information for all
modules in builds that start from an arbitrary published Scala version
instead of being triggered directly by a bootstrap job.
Diffstat (limited to 'build.sbt')
-rw-r--r-- | build.sbt | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -364,6 +364,7 @@ lazy val reflect = configureAsSubproject(project) lazy val compiler = configureAsSubproject(project) .settings(generatePropertiesFileSettings: _*) + .settings(generateBuildCharacterFileSettings: _*) .settings(Osgi.settings: _*) .settings( name := "scala-compiler", @@ -371,6 +372,8 @@ lazy val compiler = configureAsSubproject(project) libraryDependencies ++= Seq(antDep, asmDep), // These are only needed for the POM: libraryDependencies ++= Seq(scalaXmlDep, jlineDep % "optional"), + buildCharacterPropertiesFile := (resourceManaged in Compile).value / "scala-buildcharacter.properties", + resourceGenerators in Compile += generateBuildCharacterPropertiesFile.map(file => Seq(file)).taskValue, // this a way to make sure that classes from interactive and scaladoc projects // end up in compiler jar. note that we need to use LocalProject references // (with strings) to deal with mutual recursion @@ -740,6 +743,18 @@ lazy val root: Project = (project in file(".")) publish := {}, publishLocal := {}, commands ++= ScriptCommands.all, + extractBuildCharacterPropertiesFile := { + val jar = (scalaInstance in bootstrap).value.compilerJar + val bc = buildCharacterPropertiesFile.value + val packagedName = "scala-buildcharacter.properties" + IO.withTemporaryDirectory { tmp => + val extracted = IO.unzip(jar, tmp, new SimpleFilter(_ == packagedName)).headOption.getOrElse { + throw new RuntimeException(s"No file $packagedName found in bootstrap compiler $jar") + } + IO.copyFile(extracted, bc) + bc + } + }, // Generate (Product|TupleN|Function|AbstractFunction)*.scala files and scaladoc stubs for all AnyVal sources. // They should really go into a managedSources dir instead of overwriting sources checked into git but scaladoc // source links (could be fixed by shipping these sources with the scaladoc bundles) and scala-js source maps |