Migrate to using the sbt/launcher module, rather than having the code embedded.

* Remove launch/* code/tests, as these are in the sbt/launcher project.
* Create a new project which will resolve launcher module from sonatype-snapshots,
  and repackage it for the currently building version of sbt.
* Remove ComponentManagerTest which was relying DIRECTLY on launcher classes.
  We'll need to reconfigure this shortly to enable the tests again.

Remaining TODOs -

* Update resolvers so people can find the launcher.
* Add ComponentManagerTest back.
* Re-publish the sbt-launch.jar in the location it used to be published.
This commit is contained in:
Josh Suereth 2015-03-24 16:12:51 -04:00
parent 3496288845
commit 4f1e1f61fc
1 changed files with 22 additions and 57 deletions

View File

@ -46,12 +46,21 @@ lazy val root: Project = (project in file(".")).
settings(minimalSettings ++ rootSettings: _*).
settings(
publish := {},
publishLocal := {
val p = (proguard in (proguardedLauncherProj, Proguard)).value
IO.copyFile(p, target.value / p.getName)
}
publishLocal := {}
)
// This is used to configure an sbt-launcher for this version of sbt.
lazy val bundledLauncherProj =
(project in file("launch")).
settings(minimalSettings:_*).
settings(inConfig(Compile)(Transform.configSettings):_*).
enablePlugins(SbtLauncherPlugin).
settings(
publish := {},
publishLocal := {}
)
// This is used only for command aggregation
lazy val allPrecompiled: Project = (project in file("all-precompiled")).
aggregate(precompiled282, precompiled292, precompiled293).
@ -63,49 +72,6 @@ lazy val allPrecompiled: Project = (project in file("all-precompiled")).
/* ** subproject declarations ** */
// the launcher. Retrieves, loads, and runs applications based on a configuration file.
lazy val launchProj = (project in launchPath).
dependsOn(ioProj % "test->test", interfaceProj % Test).
settings(testedBaseSettings: _*).
settings(
name := "Launcher",
libraryDependencies ++= Seq(ivy, Dependencies.launcherInterface),
compile in Test <<= compile in Test dependsOn (publishLocal in interfaceProj, publishLocal in testSamples)
).
settings(inConfig(Compile)(Transform.configSettings): _*).
settings(inConfig(Compile)(Transform.transSourceSettings ++ Seq(
Transform.inputSourceDirectory <<= (sourceDirectory in crossProj) / "input_sources",
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
lazy val testSamples = (project in launchPath / "test-sample").
dependsOn(interfaceProj).
settings(baseSettings ++ noPublishSettings: _*).
settings(
name := "Launch Test",
libraryDependencies ++= Seq(scalaCompiler.value, Dependencies.launcherInterface)
)
// defines Java structures used across Scala versions, such as the API structures and relationships extracted by
// the analysis compiler phases and passed back to sbt. The API structures are defined in a simple
// format from which Java sources are generated by the datatype generator Projproject
@ -252,7 +218,7 @@ lazy val logicProj = (project in utilPath / "logic").
// Apache Ivy integration
lazy val ivyProj = (project in file("ivy")).
dependsOn(interfaceProj, crossProj, logProj % "compile;test->test", ioProj % "compile;test->test", launchProj % "test->test", collectionProj).
dependsOn(interfaceProj, crossProj, logProj % "compile;test->test", ioProj % "compile;test->test", /*launchProj % "test->test",*/ collectionProj).
settings(baseSettings: _*).
settings(
name := "Ivy",
@ -321,7 +287,7 @@ lazy val runProj = (project in file("run")).
// Compiler-side interface to compiler that is compiled against the compiler being used either in advance or on the fly.
// Includes API and Analyzer phases that extract source API and relationships.
lazy val compileInterfaceProj = (project in compilePath / "interface").
dependsOn(interfaceProj % "compile;test->test", ioProj % "test->test", logProj % "test->test", launchProj % "test->test", apiProj % "test->test").
dependsOn(interfaceProj % "compile;test->test", ioProj % "test->test", logProj % "test->test", /*launchProj % "test->test",*/ apiProj % "test->test").
settings(baseSettings ++ precompiledSettings: _*).
settings(
name := "Compiler Interface",
@ -361,7 +327,7 @@ lazy val compilePersistProj = (project in compilePath / "persist").
// sbt-side interface to compiler. Calls compiler-side interface reflectively
lazy val compilerProj = (project in compilePath).
dependsOn(interfaceProj % "compile;test->test", logProj, ioProj, classpathProj, apiProj, classfileProj,
logProj % "test->test", launchProj % "test->test").
logProj % "test->test" /*,launchProj % "test->test" */).
settings(testedBaseSettings: _*).
settings(
name := "Compile",
@ -467,13 +433,13 @@ lazy val mavenResolverPluginProj = (project in file("sbt-maven-resolver")).
def scriptedTask: Initialize[InputTask[Unit]] = Def.inputTask {
val result = scriptedSource(dir => (s: State) => scriptedParser(dir)).parsed
publishAll.value
doScripted((proguard in Proguard in proguardedLauncherProj).value, (fullClasspath in scriptedSbtProj in Test).value,
doScripted((sbtLaunchJar in bundledLauncherProj).value, (fullClasspath in scriptedSbtProj in Test).value,
(scalaInstance in scriptedSbtProj).value, scriptedSource.value, result, scriptedPrescripted.value)
}
def scriptedUnpublishedTask: Initialize[InputTask[Unit]] = Def.inputTask {
val result = scriptedSource(dir => (s: State) => scriptedParser(dir)).parsed
doScripted((proguard in Proguard in proguardedLauncherProj).value, (fullClasspath in scriptedSbtProj in Test).value,
doScripted((sbtLaunchJar in bundledLauncherProj).value, (fullClasspath in scriptedSbtProj in Test).value,
(scalaInstance in scriptedSbtProj).value, scriptedSource.value, result, scriptedPrescripted.value)
}
@ -482,8 +448,7 @@ lazy val publishLauncher = TaskKey[Unit]("publish-launcher")
lazy val myProvided = config("provided") intransitive
def allProjects = Seq(launchProj, proguardedLauncherProj,
testSamples, interfaceProj, apiProj,
def allProjects = Seq(interfaceProj, apiProj,
controlProj, collectionProj, applyMacroProj, processProj, ioProj, classpathProj, completeProj,
logProj, relationProj, classfileProj, datatypeProj, crossProj, logicProj, ivyProj,
testingProj, testAgentProj, taskProj, stdTaskProj, cacheProj, trackingProj, runProj,
@ -496,8 +461,8 @@ def projectsWithMyProvided = allProjects.map(p => p.copy(configurations = (p.con
lazy val nonRoots = projectsWithMyProvided.map(p => LocalProject(p.id))
def rootSettings = Release.releaseSettings ++ fullDocSettings ++
Util.publishPomSettings ++ otherRootSettings ++ Formatting.sbtFilesSettings ++
Transform.conscriptSettings(launchProj)
Util.publishPomSettings ++ otherRootSettings ++ Formatting.sbtFilesSettings /*++
Transform.conscriptSettings(launchProj)*/
def otherRootSettings = Seq(
Scripted.scriptedPrescripted := { _ => },
Scripted.scripted <<= scriptedTask,
@ -576,7 +541,7 @@ def precompiled(scalav: String): Project = Project(id = normalize("Precompiled "
lazy val safeUnitTests = taskKey[Unit]("Known working tests (for both 2.10 and 2.11)")
lazy val safeProjects: ScopeFilter = ScopeFilter(
inProjects(launchProj, mainSettingsProj, mainProj, ivyProj, completeProj,
inProjects(mainSettingsProj, mainProj, ivyProj, completeProj,
actionsProj, classpathProj, collectionProj, compileIncrementalProj,
logProj, runProj, stdTaskProj),
inConfigurations(Test)