Merge pull request #1842 from sbt/wip/build-fix

Build fix
This commit is contained in:
eugene yokota 2015-02-10 14:35:37 -05:00
commit d9b76be874
11 changed files with 102 additions and 78 deletions

124
build.sbt
View File

@ -8,10 +8,15 @@ import Scripted._
import StringUtilities.normalize import StringUtilities.normalize
import Sxr.sxr import Sxr.sxr
// ThisBuild settings take lower precedence,
// but can be shared across the multi projects.
def buildLevelSettings: Seq[Setting[_]] = Seq(
organization in ThisBuild := "org.scala-sbt",
version in ThisBuild := "0.13.8-SNAPSHOT"
)
def commonSettings: Seq[Setting[_]] = Seq( def commonSettings: Seq[Setting[_]] = Seq(
organization := "org.scala-sbt", scalaVersion := "2.10.4",
version := "0.13.8-SNAPSHOT",
scalaVersion in ThisBuild := "2.10.4",
publishArtifact in packageDoc := false, publishArtifact in packageDoc := false,
publishMavenStyle := false, publishMavenStyle := false,
componentID := None, componentID := None,
@ -20,7 +25,8 @@ def commonSettings: Seq[Setting[_]] = Seq(
concurrentRestrictions in Global += Util.testExclusiveRestriction, concurrentRestrictions in Global += Util.testExclusiveRestriction,
testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"), testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"),
javacOptions in compile ++= Seq("-target", "6", "-source", "6", "-Xlint", "-Xlint:-serial"), javacOptions in compile ++= Seq("-target", "6", "-source", "6", "-Xlint", "-Xlint:-serial"),
incOptions := incOptions.value.withNameHashing(true) incOptions := incOptions.value.withNameHashing(true),
crossScalaVersions := Seq(scala210)
) )
def minimalSettings: Seq[Setting[_]] = def minimalSettings: Seq[Setting[_]] =
@ -34,9 +40,17 @@ def testedBaseSettings: Seq[Setting[_]] =
baseSettings ++ testDependencies baseSettings ++ testDependencies
lazy val root: Project = (project in file(".")). lazy val root: Project = (project in file(".")).
configs(Sxr.sxrConf, Proguard). configs(Sxr.sxrConf).
aggregate(nonRoots: _*). aggregate(nonRoots: _*).
settings(minimalSettings ++ rootSettings: _*) settings(buildLevelSettings: _*).
settings(minimalSettings ++ rootSettings: _*).
settings(
publish := {},
publishLocal := {
val p = (proguard in (proguardedLauncherProj, Proguard)).value
IO.copyFile(p, target.value / p.getName)
}
)
/* ** subproject declarations ** */ /* ** subproject declarations ** */
@ -62,6 +76,24 @@ lazy val launchProj = (project in launchPath).
Transform.sourceProperties := Map("cross.package0" -> "xsbt", "cross.package1" -> "boot") Transform.sourceProperties := Map("cross.package0" -> "xsbt", "cross.package1" -> "boot")
)): _*) )): _*)
// the proguarded launcher
// the launcher is published with metadata so that the scripted plugin can pull it in
// being proguarded, it shouldn't ever be on a classpath with other jars, however
lazy val proguardedLauncherProj = (project in file("sbt-launch")).
configs(Proguard).
settings(minimalSettings ++ LaunchProguard.settings ++ LaunchProguard.specific(launchProj) ++
Release.launcherSettings(proguard in Proguard): _*).
settings(
name := "sbt-launch",
moduleName := "sbt-launch",
description := "sbt application launcher",
publishArtifact in packageSrc := false,
autoScalaLibrary := false,
publish <<= Seq(publish, Release.deployLauncher).dependOn,
publishLauncher <<= Release.deployLauncher,
packageBin in Compile <<= proguard in Proguard
)
// used to test the retrieving and loading of an application: sample app is packaged and published to the local repository // used to test the retrieving and loading of an application: sample app is packaged and published to the local repository
lazy val testSamples = (project in launchPath / "test-sample"). lazy val testSamples = (project in launchPath / "test-sample").
dependsOn(interfaceProj, launchInterfaceProj). dependsOn(interfaceProj, launchInterfaceProj).
@ -84,7 +116,13 @@ lazy val interfaceProj = (project in file("interface")).
watchSources <++= apiDefinitions, watchSources <++= apiDefinitions,
resourceGenerators in Compile <+= (version, resourceManaged, streams, compile in Compile) map generateVersionFile, resourceGenerators in Compile <+= (version, resourceManaged, streams, compile in Compile) map generateVersionFile,
apiDefinitions <<= baseDirectory map { base => (base / "definition") :: (base / "other") :: (base / "type") :: Nil }, apiDefinitions <<= baseDirectory map { base => (base / "definition") :: (base / "other") :: (base / "type") :: Nil },
sourceGenerators in Compile <+= (cacheDirectory, apiDefinitions, fullClasspath in Compile in datatypeProj, sourceManaged in Compile, mainClass in datatypeProj in Compile, runner, streams) map generateAPICached sourceGenerators in Compile <+= (cacheDirectory,
apiDefinitions,
fullClasspath in Compile in datatypeProj,
sourceManaged in Compile,
mainClass in datatypeProj in Compile,
runner,
streams) map generateAPICached
) )
// defines operations on the API of a source, including determining whether it has changed and converting it to a string // defines operations on the API of a source, including determining whether it has changed and converting it to a string
@ -295,9 +333,18 @@ lazy val compileInterfaceProj = (project in compilePath / "interface").
artifact in (Compile, packageSrc) := Artifact(srcID).copy(configurations = Compile :: Nil).extra("e:component" -> srcID) artifact in (Compile, packageSrc) := Artifact(srcID).copy(configurations = Compile :: Nil).extra("e:component" -> srcID)
) )
lazy val precompiled282 = precompiled("2.8.2") def precompiledSettings = Seq(
lazy val precompiled292 = precompiled("2.9.2") artifact in packageBin <<= (appConfiguration, scalaVersion) { (app, sv) =>
lazy val precompiled293 = precompiled("2.9.3") val launcher = app.provider.scalaProvider.launcher
val bincID = binID + "_" + ScalaInstance(sv, launcher).actualVersion
Artifact(binID) extra ("e:component" -> bincID)
},
target <<= (target, scalaVersion) { (base, sv) => base / ("precompiled_" + sv) },
scalacOptions := Nil,
ivyScala ~= { _.map(_.copy(checkExplicit = false, overrideScalaVersion = false)) },
exportedProducts in Compile := Nil,
libraryDependencies += scalaCompiler.value % "provided"
)
// Implements the core functionality of detecting and propagating changes incrementally. // Implements the core functionality of detecting and propagating changes incrementally.
// Defines the data structures for representing file fingerprints and relationships and the overall source analysis // Defines the data structures for representing file fingerprints and relationships and the overall source analysis
@ -405,7 +452,7 @@ lazy val mainProj = (project in mainPath).
// technically, we need a dependency on all of mainProj's dependencies, but we don't do that since this is strictly an integration project // technically, we need a dependency on all of mainProj's dependencies, but we don't do that since this is strictly an integration project
// with the sole purpose of providing certain identifiers without qualification (with a package object) // with the sole purpose of providing certain identifiers without qualification (with a package object)
lazy val sbtProj = (project in sbtPath). lazy val sbtProj = (project in sbtPath).
dependsOn(mainProj, compileInterfaceProj, precompiled282, precompiled292, precompiled293, scriptedSbtProj % "test->test"). dependsOn(mainProj, compileInterfaceProj, scriptedSbtProj % "test->test").
settings(baseSettings: _*). settings(baseSettings: _*).
settings( settings(
name := "sbt", name := "sbt",
@ -424,13 +471,13 @@ lazy val mavenResolverPluginProj = (project in file("sbt-maven-resolver")).
def scriptedTask: Initialize[InputTask[Unit]] = Def.inputTask { def scriptedTask: Initialize[InputTask[Unit]] = Def.inputTask {
val result = scriptedSource(dir => (s: State) => scriptedParser(dir)).parsed val result = scriptedSource(dir => (s: State) => scriptedParser(dir)).parsed
publishAll.value publishAll.value
doScripted((proguard in Proguard).value, (fullClasspath in scriptedSbtProj in Test).value, doScripted((proguard in Proguard in proguardedLauncherProj).value, (fullClasspath in scriptedSbtProj in Test).value,
(scalaInstance in scriptedSbtProj).value, scriptedSource.value, result, scriptedPrescripted.value) (scalaInstance in scriptedSbtProj).value, scriptedSource.value, result, scriptedPrescripted.value)
} }
def scriptedUnpublishedTask: Initialize[InputTask[Unit]] = Def.inputTask { def scriptedUnpublishedTask: Initialize[InputTask[Unit]] = Def.inputTask {
val result = scriptedSource(dir => (s: State) => scriptedParser(dir)).parsed val result = scriptedSource(dir => (s: State) => scriptedParser(dir)).parsed
doScripted((proguard in Proguard).value, (fullClasspath in scriptedSbtProj in Test).value, doScripted((proguard in Proguard in proguardedLauncherProj).value, (fullClasspath in scriptedSbtProj in Test).value,
(scalaInstance in scriptedSbtProj).value, scriptedSource.value, result, scriptedPrescripted.value) (scalaInstance in scriptedSbtProj).value, scriptedSource.value, result, scriptedPrescripted.value)
} }
@ -439,7 +486,8 @@ lazy val publishLauncher = TaskKey[Unit]("publish-launcher")
lazy val myProvided = config("provided") intransitive lazy val myProvided = config("provided") intransitive
def allProjects = Seq(launchInterfaceProj, launchProj, testSamples, interfaceProj, apiProj, def allProjects = Seq(launchInterfaceProj, launchProj, proguardedLauncherProj,
testSamples, interfaceProj, apiProj,
controlProj, collectionProj, applyMacroProj, processProj, ioProj, classpathProj, completeProj, controlProj, collectionProj, applyMacroProj, processProj, ioProj, classpathProj, completeProj,
logProj, relationProj, classfileProj, datatypeProj, crossProj, logicProj, ivyProj, logProj, relationProj, classfileProj, datatypeProj, crossProj, logicProj, ivyProj,
testingProj, testAgentProj, taskProj, stdTaskProj, cacheProj, trackingProj, runProj, testingProj, testAgentProj, taskProj, stdTaskProj, cacheProj, trackingProj, runProj,
@ -447,12 +495,12 @@ def allProjects = Seq(launchInterfaceProj, launchProj, testSamples, interfacePro
compilerIntegrationProj, compilerIvyProj, compilerIntegrationProj, compilerIvyProj,
scriptedBaseProj, scriptedSbtProj, scriptedPluginProj, scriptedBaseProj, scriptedSbtProj, scriptedPluginProj,
actionsProj, commandProj, mainSettingsProj, mainProj, sbtProj, mavenResolverPluginProj) actionsProj, commandProj, mainSettingsProj, mainProj, sbtProj, mavenResolverPluginProj)
def projectsWithMyProvided = allProjects.map(p => p.copy(configurations = (p.configurations.filter(_ != Provided)) :+ myProvided)) def projectsWithMyProvided = allProjects.map(p => p.copy(configurations = (p.configurations.filter(_ != Provided)) :+ myProvided))
lazy val nonRoots = projectsWithMyProvided.map(p => LocalProject(p.id)) lazy val nonRoots = projectsWithMyProvided.map(p => LocalProject(p.id))
def releaseSettings = Release.settings(nonRoots, proguard in Proguard) def rootSettings = Release.releaseSettings ++ fullDocSettings ++
def rootSettings = releaseSettings ++ fullDocSettings ++ LaunchProguard.settings ++ LaunchProguard.specific(launchProj) ++ Util.publishPomSettings ++ otherRootSettings ++ Formatting.sbtFilesSettings ++
Util.publishPomSettings ++ otherRootSettings ++ proguardedLauncherSettings ++ Formatting.sbtFilesSettings ++
Transform.conscriptSettings(launchProj) Transform.conscriptSettings(launchProj)
def otherRootSettings = Seq( def otherRootSettings = Seq(
Scripted.scriptedPrescripted := { _ => }, Scripted.scriptedPrescripted := { _ => },
@ -460,7 +508,7 @@ def otherRootSettings = Seq(
Scripted.scriptedUnpublished <<= scriptedUnpublishedTask, Scripted.scriptedUnpublished <<= scriptedUnpublishedTask,
Scripted.scriptedSource <<= (sourceDirectory in sbtProj) / "sbt-test", Scripted.scriptedSource <<= (sourceDirectory in sbtProj) / "sbt-test",
publishAll := { publishAll := {
(publishLocal).all(ScopeFilter(inAnyProject)).value val _ = (publishLocal).all(ScopeFilter(inAnyProject)).value
} }
) ++ inConfig(Scripted.MavenResolverPluginTest)(Seq( ) ++ inConfig(Scripted.MavenResolverPluginTest)(Seq(
Scripted.scripted <<= scriptedTask, Scripted.scripted <<= scriptedTask,
@ -492,17 +540,6 @@ def fullDocSettings = Util.baseScalacOptions ++ Docs.settings ++ Sxr.settings ++
dependencyClasspath in (Compile, doc) := (fullClasspath in sxr).value dependencyClasspath in (Compile, doc) := (fullClasspath in sxr).value
) )
// the launcher is published with metadata so that the scripted plugin can pull it in
// being proguarded, it shouldn't ever be on a classpath with other jars, however
def proguardedLauncherSettings = Seq(
publishArtifact in packageSrc := false,
moduleName := "sbt-launch",
autoScalaLibrary := false,
description := "sbt application launcher",
publishLauncher <<= Release.deployLauncher,
packageBin in Compile <<= proguard in Proguard
)
/* Nested Projproject paths */ /* Nested Projproject paths */
def sbtPath = file("sbt") def sbtPath = file("sbt")
def cachePath = file("cache") def cachePath = file("cache")
@ -512,34 +549,6 @@ def utilPath = file("util")
def compilePath = file("compile") def compilePath = file("compile")
def mainPath = file("main") def mainPath = file("main")
def precompiledSettings = Seq(
artifact in packageBin <<= (appConfiguration, scalaVersion) { (app, sv) =>
val launcher = app.provider.scalaProvider.launcher
val bincID = binID + "_" + ScalaInstance(sv, launcher).actualVersion
Artifact(binID) extra ("e:component" -> bincID)
},
target <<= (target, scalaVersion) { (base, sv) => base / ("precompiled_" + sv) },
scalacOptions := Nil,
ivyScala ~= { _.map(_.copy(checkExplicit = false, overrideScalaVersion = false)) },
exportedProducts in Compile := Nil,
libraryDependencies += scalaCompiler.value % "provided"
)
def precompiled(scalav: String): Project = Project(id = normalize("Precompiled " + scalav.replace('.', '_')), base = compilePath / "interface").
dependsOn(interfaceProj).
settings(baseSettings ++ precompiledSettings: _*).
settings(
name := "Precompiled " + scalav.replace('.', '_'),
scalaHome := None,
scalaVersion <<= (scalaVersion in ThisBuild) { sbtScalaV =>
assert(sbtScalaV != scalav, "Precompiled compiler interface cannot have the same Scala version (" + scalav + ") as sbt.")
scalav
},
// we disable compiling and running tests in precompiled Projprojects of compiler interface
// so we do not need to worry about cross-versioning testing dependencies
sources in Test := Nil
)
lazy val safeUnitTests = taskKey[Unit]("Known working tests (for both 2.10 and 2.11)") lazy val safeUnitTests = taskKey[Unit]("Known working tests (for both 2.10 and 2.11)")
lazy val safeProjects: ScopeFilter = ScopeFilter( lazy val safeProjects: ScopeFilter = ScopeFilter(
inProjects(launchProj, mainSettingsProj, mainProj, ivyProj, completeProj, inProjects(launchProj, mainSettingsProj, mainProj, ivyProj, completeProj,
@ -580,7 +589,6 @@ def customCommands: Seq[Setting[_]] = Seq(
"so compile" :: "so compile" ::
"so publishSigned" :: "so publishSigned" ::
"publishLauncher" :: "publishLauncher" ::
"release-libs-211" ::
state state
} }
) )

View File

@ -8,7 +8,6 @@ object NightlyPlugin extends AutoPlugin {
override def trigger = allRequirements override def trigger = allRequirements
override def requires = plugins.JvmPlugin override def requires = plugins.JvmPlugin
object autoImport { object autoImport {
lazy val nightly212 = SettingKey[Boolean]("nightly212")
lazy val includeTestDependencies = SettingKey[Boolean]("includeTestDependencies", "Doesn't declare test dependencies.") lazy val includeTestDependencies = SettingKey[Boolean]("includeTestDependencies", "Doesn't declare test dependencies.")
def testDependencies = libraryDependencies <++= includeTestDependencies { incl => def testDependencies = libraryDependencies <++= includeTestDependencies { incl =>
@ -22,8 +21,13 @@ object NightlyPlugin extends AutoPlugin {
} }
override def buildSettings: Seq[Setting[_]] = Seq( override def buildSettings: Seq[Setting[_]] = Seq(
nightly212 <<= scalaVersion(v => v.startsWith("2.12.")), // Avoid 2.12.x nightlies
includeTestDependencies <<= nightly212(x => !x) // Avoid 2.9.x precompiled
// Avoid 2.8.x precompiled
includeTestDependencies := {
val v = scalaVersion.value
v.startsWith("2.10.") || v.startsWith("2.11.")
}
) )
override def projectSettings: Seq[Setting[_]] = Seq( override def projectSettings: Seq[Setting[_]] = Seq(

View File

@ -13,20 +13,19 @@ object Release extends Build {
val PublishRepoHost = "private-repo.typesafe.com" val PublishRepoHost = "private-repo.typesafe.com"
def settings(nonRoots: => Seq[ProjectReference], launcher: TaskKey[File]): Seq[Setting[_]] = def launcherSettings(launcher: TaskKey[File]): Seq[Setting[_]] = Seq(
releaseSettings(nonRoots, launcher) launcherRemotePath <<= (organization, version, moduleName) { (org, v, n) => List(org, n, v, n + ".jar").mkString("/") },
deployLauncher <<= deployLauncher(launcher)
)
// Add credentials if they exist. // Add credentials if they exist.
def lameCredentialSettings: Seq[Setting[_]] = def lameCredentialSettings: Seq[Setting[_]] =
if (CredentialsFile.exists) Seq(credentials in ThisBuild += Credentials(CredentialsFile)) if (CredentialsFile.exists) Seq(credentials in ThisBuild += Credentials(CredentialsFile))
else Nil else Nil
def releaseSettings(nonRoots: => Seq[ProjectReference], launcher: TaskKey[File]): Seq[Setting[_]] = Seq( def releaseSettings: Seq[Setting[_]] = Seq(
publishTo in ThisBuild <<= publishResolver, publishTo in ThisBuild <<= publishResolver,
remoteID <<= publishStatus("typesafe-ivy-" + _), remoteID in ThisBuild <<= publishStatus("typesafe-ivy-" + _),
remoteBase <<= publishStatus("https://" + PublishRepoHost + "/typesafe/ivy-" + _), remoteBase in ThisBuild <<= publishStatus("https://" + PublishRepoHost + "/typesafe/ivy-" + _),
launcherRemotePath <<= (organization, version, moduleName) { (org, v, n) => List(org, n, v, n + ".jar").mkString("/") },
publish <<= Seq(publish, Release.deployLauncher).dependOn,
deployLauncher <<= deployLauncher(launcher),
checkCredentials := { checkCredentials := {
// Note - This will eitehr issue a failure or succeed. // Note - This will eitehr issue a failure or succeed.
getCredentials(credentials.value, streams.value.log) getCredentials(credentials.value, streams.value.log)

View File

@ -22,8 +22,8 @@ object Util {
lazy val baseScalacOptions = Seq( lazy val baseScalacOptions = Seq(
scalacOptions ++= Seq("-Xelide-below", "0"), scalacOptions ++= Seq("-Xelide-below", "0"),
scalacOptions <++= scalaVersion map CrossVersion.partialVersion map { scalacOptions <++= scalaVersion map CrossVersion.partialVersion map {
case Some((2, 9)) => Nil // support 2.9 for some subprojects for the Scala Eclipse IDE case Some((2, 9)) | Some((2, 8)) => Nil // support 2.9 for some subprojects for the Scala Eclipse IDE
case _ => Seq("-feature", "-language:implicitConversions", "-language:postfixOps", "-language:higherKinds", "-language:existentials") case _ => Seq("-feature", "-language:implicitConversions", "-language:postfixOps", "-language:higherKinds", "-language:existentials")
}, },
scalacOptions <++= scalaVersion map CrossVersion.partialVersion map { scalacOptions <++= scalaVersion map CrossVersion.partialVersion map {
case Some((2, 10)) => Seq("-deprecation", "-Xlint") case Some((2, 10)) => Seq("-deprecation", "-Xlint")

View File

@ -13,4 +13,4 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-scalariform" % "1.3.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-javaversioncheck" % "0.1.0") addSbtPlugin("com.typesafe.sbt" % "sbt-javaversioncheck" % "0.1.0")
addSbtPlugin("com.eed3si9n" % "sbt-doge" % "0.1.1") addSbtPlugin("com.eed3si9n" % "sbt-doge" % "0.1.3")

View File

@ -0,0 +1,13 @@
lazy val specs = Def.setting {
"org.scala-tools.testing" %% "specs" % (scalaVersion.value match {
case "2.8.1" | "2.8.2" | "2.9.0" => "1.6.8"
case "2.9.3" => "1.6.9"
})
}
lazy val root = (project in file(".")).
settings(
scalaVersion := "2.8.1",
libraryDependencies += specs.value % Test,
libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-compiler" % _)
)

View File

@ -0,0 +1,6 @@
> ++2.8.1
> test:test
> ++2.9.0
> test:test
> ++2.9.3
> test:test

View File

@ -1,5 +0,0 @@
scalaVersion := "2.8.1"
libraryDependencies += "org.scala-tools.testing" %% "specs" % "1.6.7.2" % "test"
libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-compiler" % _)

View File

@ -1 +0,0 @@
> test:test