diff options
-rw-r--r-- | build.sbt | 15 | ||||
-rw-r--r-- | project/VersionUtil.scala | 9 |
2 files changed, 21 insertions, 3 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 diff --git a/project/VersionUtil.scala b/project/VersionUtil.scala index 1c2fff27b7..fde55a5969 100644 --- a/project/VersionUtil.scala +++ b/project/VersionUtil.scala @@ -8,8 +8,10 @@ import BuildSettings.autoImport._ object VersionUtil { lazy val copyrightString = settingKey[String]("Copyright string.") lazy val versionProperties = settingKey[Versions]("Version properties.") - lazy val generateVersionPropertiesFile = taskKey[File]("Generating version properties file.") - lazy val generateBuildCharacterPropertiesFile = taskKey[File]("Generating buildcharacter.properties file.") + lazy val buildCharacterPropertiesFile = settingKey[File]("The file which gets generated by generateBuildCharacterPropertiesFile") + lazy val generateVersionPropertiesFile = taskKey[File]("Generate version properties file.") + lazy val generateBuildCharacterPropertiesFile = taskKey[File]("Generate buildcharacter.properties file.") + lazy val extractBuildCharacterPropertiesFile = taskKey[File]("Extract buildcharacter.properties file from bootstrap scala-compiler.") lazy val globalVersionSettings = Seq[Setting[_]]( // Set the version properties globally (they are the same for all projects) @@ -24,6 +26,7 @@ object VersionUtil { ) lazy val generateBuildCharacterFileSettings = Seq[Setting[_]]( + buildCharacterPropertiesFile := ((baseDirectory in ThisBuild).value / "buildcharacter.properties"), generateBuildCharacterPropertiesFile := generateBuildCharacterPropertiesFileImpl.value ) @@ -101,7 +104,7 @@ object VersionUtil { writeProps(v.toMap ++ versionProps ++ Map( "maven.version.base" -> v.mavenBase, "maven.version.suffix" -> v.mavenSuffix - ), (baseDirectory in ThisBuild).value / "buildcharacter.properties") + ), buildCharacterPropertiesFile.value) } private def writeProps(m: Map[String, String], propFile: File): File = { |