Fix java version check, and use scope filter

This commit is contained in:
Eugene Yokota 2014-12-18 13:14:04 -05:00
parent 4cac42f56c
commit a903aafd7c
3 changed files with 27 additions and 33 deletions

View File

@ -25,6 +25,7 @@ def commonSettings: Seq[Setting[_]] = Seq(
def minimalSettings: Seq[Setting[_]] =
commonSettings ++ customCommands ++ Status.settings ++ nightlySettings ++
publishPomSettings ++ Release.javaVersionCheckSettings ++
Seq(
crossVersion in update <<= (crossVersion, nightly211) { (cv, n) => if (n) CrossVersion.full else cv },
resolvers += Resolver.typesafeIvyRepo("releases")
@ -41,7 +42,7 @@ lazy val root: Project = (project in file(".")).
aggregate(nonRoots: _*).
settings(minimalSettings ++ rootSettings: _*)
/* ** Projproject declarations ** */
/* ** subproject declarations ** */
// defines the Java interfaces through which the launcher and the launched application communicate
lazy val launchInterfaceProj = (project in launchPath / "interface").
@ -438,11 +439,6 @@ def allProjects = Seq(launchInterfaceProj, launchProj, testSamples, interfacePro
def projectsWithMyProvided = allProjects.map(p => p.copy(configurations = (p.configurations.filter(_ != Provided)) :+ myProvided))
lazy val nonRoots = projectsWithMyProvided.map(p => LocalProject(p.id))
def deepTasks[T](scoped: TaskKey[Seq[T]]): Initialize[Task[Seq[T]]] = deep(scoped.task) { _.join.map(_.flatten.distinct) }
def deep[T](scoped: SettingKey[T]): Initialize[Seq[T]] =
Util.inAllProjects(projectsWithMyProvided filterNot Set(root, sbtProj, scriptedBaseProj, scriptedSbtProj, scriptedPluginProj) map { p =>
LocalProject(p.id) }, scoped)
def releaseSettings = Release.settings(nonRoots, proguard in Proguard)
def rootSettings = releaseSettings ++ fullDocSettings ++ LaunchProguard.settings ++ LaunchProguard.specific(launchProj) ++
Util.publishPomSettings ++ otherRootSettings ++ proguardedLauncherSettings ++ Formatting.sbtFilesSettings ++
@ -451,16 +447,27 @@ def otherRootSettings = Seq(
Scripted.scripted <<= scriptedTask,
Scripted.scriptedUnpublished <<= scriptedUnpublishedTask,
Scripted.scriptedSource <<= (sourceDirectory in sbtProj) / "sbt-test",
publishAll <<= inAll(nonRoots, publishLocal.task),
publishAll <<= (publishAll, publishLocal).map((x, y) => ()) // publish all normal deps as well as the sbt-launch jar
publishAll := {
(publishLocal).all(ScopeFilter(inAnyProject)).value
}
)
lazy val docProjects: ScopeFilter = ScopeFilter(
inAnyProject -- inProjects(root, sbtProj, scriptedBaseProj, scriptedSbtProj, scriptedPluginProj),
inConfigurations(Compile)
)
def fullDocSettings = Util.baseScalacOptions ++ Docs.settings ++ Sxr.settings ++ Seq(
scalacOptions += "-Ymacro-no-expand", // for both sxr and doc
sources in sxr <<= deepTasks(sources in Compile), //sxr
sources in (Compile, doc) <<= sources in sxr, // doc
Sxr.sourceDirectories <<= deep(sourceDirectories in Compile).map(_.flatten), // to properly relativize the source paths
fullClasspath in sxr <<= (externalDependencyClasspath in Compile in sbtProj),
dependencyClasspath in (Compile, doc) <<= fullClasspath in sxr
sources in sxr := {
val allSources = (sources ?? Nil).all(docProjects).value
allSources.flatten.distinct
}, //sxr
sources in (Compile, doc) := (sources in sxr).value, // doc
Sxr.sourceDirectories := {
val allSourceDirectories = (sourceDirectories ?? Nil).all(docProjects).value
allSourceDirectories.flatten
},
fullClasspath in sxr := (externalDependencyClasspath in Compile in sbtProj).value,
dependencyClasspath in (Compile, doc) := (fullClasspath in sxr).value
)
// the launcher is published with metadata so that the scripted plugin can pull it in

View File

@ -2,13 +2,13 @@ import sbt._
import Keys._
object Dependencies {
lazy val jline = "jline" % "jline" % "2.11"
lazy val ivy = "org.scala-sbt.ivy" % "ivy" % "2.3.0-sbt-fccfbd44c9f64523b61398a0155784dcbaeae28f"
lazy val jsch = "com.jcraft" % "jsch" % "0.1.46" intransitive ()
lazy val sbinary = "org.scala-tools.sbinary" %% "sbinary" % "0.4.2"
lazy val jline = "jline" % "jline" % "2.11"
lazy val ivy = "org.scala-sbt.ivy" % "ivy" % "2.3.0-sbt-fccfbd44c9f64523b61398a0155784dcbaeae28f"
lazy val jsch = "com.jcraft" % "jsch" % "0.1.46" intransitive ()
lazy val sbinary = "org.scala-tools.sbinary" %% "sbinary" % "0.4.2"
lazy val json4sNative = "org.json4s" %% "json4s-native" % "3.2.10"
lazy val jawnParser = "org.spire-math" %% "jawn-parser" % "0.6.0"
lazy val jawnJson4s = "org.spire-math" %% "json4s-support" % "0.6.0"
lazy val jawnParser = "org.spire-math" %% "jawn-parser" % "0.6.0"
lazy val jawnJson4s = "org.spire-math" %% "json4s-support" % "0.6.0"
lazy val scalaCompiler = Def.setting { "org.scala-lang" % "scala-compiler" % scalaVersion.value }
lazy val testInterface = "org.scala-sbt" % "test-interface" % "1.0"
private def scala211Module(name: String, moduleVersion: String) =
@ -18,6 +18,6 @@ object Dependencies {
case _ => ("org.scala-lang.modules" %% name % moduleVersion) :: Nil
}
}
lazy val scalaXml = scala211Module("scala-xml", "1.0.1")
lazy val scalaXml = scala211Module("scala-xml", "1.0.1")
lazy val scalaParsers = scala211Module("scala-parser-combinators", "1.0.1")
}

View File

@ -10,18 +10,6 @@ object Util {
lazy val nightly211 = SettingKey[Boolean]("nightly-211")
lazy val includeTestDependencies = SettingKey[Boolean]("includeTestDependencies", "Doesn't declare test dependencies.")
def inAll(projects: => Seq[ProjectReference], key: SettingKey[Task[Unit]]): Project.Initialize[Task[Unit]] =
inAllProjects(projects, key) { deps => nop dependsOn (deps: _*) }
def inAllProjects[T](projects: => Seq[ProjectReference], key: SettingKey[T]): Project.Initialize[Seq[T]] =
Def.settingDyn {
val lb = loadedBuild.value
val pr = thisProjectRef.value
def resolve(ref: ProjectReference): ProjectRef = Scope.resolveProjectRef(pr.build, Load.getRootProject(lb.units), ref)
val refs = projects flatMap { base => Defaults.transitiveDependencies(resolve(base.project), lb, includeRoot = true, classpath = true, aggregate = true) }
refs map (ref => (key in ref).?) joinWith (_ flatMap { x => x })
}
def noPublishSettings: Seq[Setting[_]] = Seq(publish := {})
def nightlySettings = Seq(
@ -37,7 +25,6 @@ object Util {
)
lazy val javaOnlySettings = Seq[Setting[_]]( /*crossPaths := false, */ compileOrder := CompileOrder.JavaThenScala, unmanagedSourceDirectories in Compile <<= Seq(javaSource in Compile).join)
// lazy val base: Seq[Setting[_]] = Seq(projectComponent) ++ baseScalacOptions ++ Licensed.settings ++ Formatting.settings
lazy val baseScalacOptions = Seq(
scalacOptions ++= Seq("-Xelide-below", "0"),
scalacOptions <++= scalaVersion map CrossVersion.partialVersion map {