create scripted-sbt-redux

Fixes #4241
Fixes #4242

This introduces a new subproject named scripted-sbt-redux. The purpose of this new subproject is to workaround the 'sbt.test` package vs `Keys.test` key confusion (#4242) while maintaining the forward compatibility of 0.13.17's sbt cross testing ^^ (#4241).

The new subproject uses `sbt.scriptedtest` package name, and that's the one that will be used by the mothership.

Meanwhile "scripted-sbt" subproject will also be published for compatibility purpose.
This commit is contained in:
Eugene Yokota 2018-07-10 00:58:45 -04:00
parent de299c0413
commit d7dc4b3e29
9 changed files with 33 additions and 20 deletions

View File

@ -94,6 +94,10 @@ val mimaSettings = Def settings (
),
)
val scriptedSbtReduxMimaSettings = Def settings (
mimaPreviousArtifacts := Set()
)
lazy val sbtRoot: Project = (project in file("."))
.enablePlugins(ScriptedPlugin) // , SiteScaladocPlugin, GhpagesPlugin)
.configs(Sxr.SxrConf)
@ -307,33 +311,43 @@ lazy val runProj = (project in file("run"))
val sbtProjDepsCompileScopeFilter =
ScopeFilter(inDependencies(LocalProject("sbtProj"), includeRoot = false), inConfigurations(Compile))
lazy val scriptedSbtProj = (project in scriptedPath / "sbt")
lazy val scriptedSbtReduxProj = (project in file("scripted-sbt-redux"))
.dependsOn(commandProj)
.settings(
baseSettings,
name := "Scripted sbt",
name := "Scripted sbt Redux",
libraryDependencies ++= Seq(launcherInterface % "provided"),
resourceGenerators in Compile += Def task {
val mainClassDir = (classDirectory in Compile in LocalProject("sbtProj")).value
val testClassDir = (classDirectory in Test in LocalProject("sbtProj")).value
val classDirs = (classDirectory all sbtProjDepsCompileScopeFilter).value
val extDepsCp = (externalDependencyClasspath in Compile in LocalProject("sbtProj")).value
val cpStrings = (mainClassDir +: testClassDir +: classDirs) ++ extDepsCp.files map (_.toString)
val file = (resourceManaged in Compile).value / "RunFromSource.classpath"
IO.writeLines(file, cpStrings)
List(file)
},
mimaSettings,
mimaBinaryIssueFilters ++= Seq(
// sbt.test package is renamed to sbt.scriptedtest.
exclude[MissingClassProblem]("sbt.test.*"),
),
scriptedSbtReduxMimaSettings,
)
.configure(addSbtIO, addSbtUtilLogging, addSbtCompilerInterface, addSbtUtilScripted, addSbtLmCore)
lazy val scriptedPluginProj = (project in scriptedPath / "plugin")
lazy val scriptedSbtOldProj = (project in file("scripted-sbt-old"))
.dependsOn(scriptedSbtReduxProj)
.settings(
baseSettings,
name := "Scripted sbt",
mimaSettings,
mimaBinaryIssueFilters ++= Seq(
// sbt.test package is renamed to sbt.scriptedtest.
exclude[MissingClassProblem]("sbt.test.*"),
exclude[DirectMissingMethodProblem]("sbt.test.*"),
exclude[IncompatibleMethTypeProblem]("sbt.test.*"),
),
)
lazy val scriptedPluginProj = (project in file("scripted-plugin"))
.dependsOn(mainProj)
.settings(
baseSettings,
@ -524,7 +538,7 @@ lazy val mainSettingsProj = (project in file("main-settings"))
// The main integration project for sbt. It brings all of the projects together, configures them, and provides for overriding conventions.
lazy val mainProj = (project in file("main"))
.enablePlugins(ContrabandPlugin)
.dependsOn(logicProj, actionsProj, mainSettingsProj, runProj, commandProj, collectionProj, scriptedSbtProj)
.dependsOn(logicProj, actionsProj, mainSettingsProj, runProj, commandProj, collectionProj, scriptedSbtReduxProj)
.settings(
testedBaseSettings,
name := "Main",
@ -557,7 +571,7 @@ lazy val mainProj = (project in file("main"))
// 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)
lazy val sbtProj = (project in file("sbt"))
.dependsOn(mainProj, scriptedSbtProj % "test->test")
.dependsOn(mainProj, scriptedSbtReduxProj % "test->test")
.settings(
testedBaseSettings,
name := "sbt",
@ -654,8 +668,8 @@ def scriptedTask: Def.Initialize[InputTask[Unit]] = Def.inputTask {
(sbtProj / Test / compile).value // make sure sbt.RunFromSourceMain is compiled
Scripted.doScripted(
(sbtLaunchJar in bundledLauncherProj).value,
(fullClasspath in scriptedSbtProj in Test).value,
(scalaInstance in scriptedSbtProj).value,
(fullClasspath in scriptedSbtReduxProj in Test).value,
(scalaInstance in scriptedSbtReduxProj).value,
scriptedSource.value,
scriptedBufferLog.value,
Def.setting(Scripted.scriptedParser(scriptedSource.value)).parsed,
@ -667,8 +681,8 @@ def scriptedTask: Def.Initialize[InputTask[Unit]] = Def.inputTask {
def scriptedUnpublishedTask: Def.Initialize[InputTask[Unit]] = Def.inputTask {
Scripted.doScripted(
(sbtLaunchJar in bundledLauncherProj).value,
(fullClasspath in scriptedSbtProj in Test).value,
(scalaInstance in scriptedSbtProj).value,
(fullClasspath in scriptedSbtReduxProj in Test).value,
(scalaInstance in scriptedSbtReduxProj).value,
scriptedSource.value,
scriptedBufferLog.value,
Def.setting(Scripted.scriptedParser(scriptedSource.value)).parsed,
@ -689,7 +703,8 @@ def allProjects =
taskProj,
stdTaskProj,
runProj,
scriptedSbtProj,
scriptedSbtReduxProj,
scriptedSbtOldProj,
scriptedPluginProj,
protocolProj,
actionsProj,
@ -727,7 +742,7 @@ def otherRootSettings =
))
lazy val docProjects: ScopeFilter = ScopeFilter(
inAnyProject -- inProjects(sbtRoot, sbtProj, scriptedSbtProj, scriptedPluginProj),
inAnyProject -- inProjects(sbtRoot, sbtProj, scriptedSbtReduxProj, scriptedSbtOldProj, scriptedPluginProj),
inConfigurations(Compile)
)
lazy val safeUnitTests = taskKey[Unit]("Known working tests (for both 2.10 and 2.11)")

View File

@ -7,9 +7,7 @@ import sbt.internal.inc.classpath.{ ClasspathUtilities, FilteredLoader }
object ScriptedPlugin extends AutoPlugin {
override def requires = plugins.JvmPlugin
object autoImport extends ScriptedKeys {
def scriptedPath = file("scripted")
}
object autoImport extends ScriptedKeys
import autoImport._