mirror of https://github.com/sbt/sbt.git
Fix java version check, and use scope filter
This commit is contained in:
parent
4cac42f56c
commit
a903aafd7c
33
build.sbt
33
build.sbt
|
|
@ -25,6 +25,7 @@ def commonSettings: Seq[Setting[_]] = Seq(
|
||||||
|
|
||||||
def minimalSettings: Seq[Setting[_]] =
|
def minimalSettings: Seq[Setting[_]] =
|
||||||
commonSettings ++ customCommands ++ Status.settings ++ nightlySettings ++
|
commonSettings ++ customCommands ++ Status.settings ++ nightlySettings ++
|
||||||
|
publishPomSettings ++ Release.javaVersionCheckSettings ++
|
||||||
Seq(
|
Seq(
|
||||||
crossVersion in update <<= (crossVersion, nightly211) { (cv, n) => if (n) CrossVersion.full else cv },
|
crossVersion in update <<= (crossVersion, nightly211) { (cv, n) => if (n) CrossVersion.full else cv },
|
||||||
resolvers += Resolver.typesafeIvyRepo("releases")
|
resolvers += Resolver.typesafeIvyRepo("releases")
|
||||||
|
|
@ -41,7 +42,7 @@ lazy val root: Project = (project in file(".")).
|
||||||
aggregate(nonRoots: _*).
|
aggregate(nonRoots: _*).
|
||||||
settings(minimalSettings ++ rootSettings: _*)
|
settings(minimalSettings ++ rootSettings: _*)
|
||||||
|
|
||||||
/* ** Projproject declarations ** */
|
/* ** subproject declarations ** */
|
||||||
|
|
||||||
// defines the Java interfaces through which the launcher and the launched application communicate
|
// defines the Java interfaces through which the launcher and the launched application communicate
|
||||||
lazy val launchInterfaceProj = (project in launchPath / "interface").
|
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))
|
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 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 releaseSettings = Release.settings(nonRoots, proguard in Proguard)
|
||||||
def rootSettings = releaseSettings ++ fullDocSettings ++ LaunchProguard.settings ++ LaunchProguard.specific(launchProj) ++
|
def rootSettings = releaseSettings ++ fullDocSettings ++ LaunchProguard.settings ++ LaunchProguard.specific(launchProj) ++
|
||||||
Util.publishPomSettings ++ otherRootSettings ++ proguardedLauncherSettings ++ Formatting.sbtFilesSettings ++
|
Util.publishPomSettings ++ otherRootSettings ++ proguardedLauncherSettings ++ Formatting.sbtFilesSettings ++
|
||||||
|
|
@ -451,16 +447,27 @@ def otherRootSettings = Seq(
|
||||||
Scripted.scripted <<= scriptedTask,
|
Scripted.scripted <<= scriptedTask,
|
||||||
Scripted.scriptedUnpublished <<= scriptedUnpublishedTask,
|
Scripted.scriptedUnpublished <<= scriptedUnpublishedTask,
|
||||||
Scripted.scriptedSource <<= (sourceDirectory in sbtProj) / "sbt-test",
|
Scripted.scriptedSource <<= (sourceDirectory in sbtProj) / "sbt-test",
|
||||||
publishAll <<= inAll(nonRoots, publishLocal.task),
|
publishAll := {
|
||||||
publishAll <<= (publishAll, publishLocal).map((x, y) => ()) // publish all normal deps as well as the sbt-launch jar
|
(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(
|
def fullDocSettings = Util.baseScalacOptions ++ Docs.settings ++ Sxr.settings ++ Seq(
|
||||||
scalacOptions += "-Ymacro-no-expand", // for both sxr and doc
|
scalacOptions += "-Ymacro-no-expand", // for both sxr and doc
|
||||||
sources in sxr <<= deepTasks(sources in Compile), //sxr
|
sources in sxr := {
|
||||||
sources in (Compile, doc) <<= sources in sxr, // doc
|
val allSources = (sources ?? Nil).all(docProjects).value
|
||||||
Sxr.sourceDirectories <<= deep(sourceDirectories in Compile).map(_.flatten), // to properly relativize the source paths
|
allSources.flatten.distinct
|
||||||
fullClasspath in sxr <<= (externalDependencyClasspath in Compile in sbtProj),
|
}, //sxr
|
||||||
dependencyClasspath in (Compile, doc) <<= fullClasspath in 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
|
// the launcher is published with metadata so that the scripted plugin can pull it in
|
||||||
|
|
|
||||||
|
|
@ -10,18 +10,6 @@ object Util {
|
||||||
lazy val nightly211 = SettingKey[Boolean]("nightly-211")
|
lazy val nightly211 = SettingKey[Boolean]("nightly-211")
|
||||||
lazy val includeTestDependencies = SettingKey[Boolean]("includeTestDependencies", "Doesn't declare test dependencies.")
|
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 noPublishSettings: Seq[Setting[_]] = Seq(publish := {})
|
||||||
|
|
||||||
def nightlySettings = Seq(
|
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 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(
|
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 {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue