From d7dc4b3e290ee17b9981e23005ac707d7250a805 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Tue, 10 Jul 2018 00:58:45 -0400 Subject: [PATCH] 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. --- build.sbt | 49 ++++++++++++------- project/Scripted.scala | 4 +- .../src/main/scala/sbt/ScriptedPlugin.scala | 0 .../main/scala/sbt/test/ScriptedTests.scala | 0 {scripted/sbt => scripted-sbt-redux}/NOTICE | 0 .../sbt/scriptedtest/BatchScriptRunner.scala | 0 .../sbt/scriptedtest/RemoteSbtCreator.scala | 0 .../scala/sbt/scriptedtest/SbtHandler.scala | 0 .../sbt/scriptedtest/ScriptedTests.scala | 0 9 files changed, 33 insertions(+), 20 deletions(-) rename {scripted/plugin => scripted-plugin}/src/main/scala/sbt/ScriptedPlugin.scala (100%) rename {scripted/plugin => scripted-sbt-old}/src/main/scala/sbt/test/ScriptedTests.scala (100%) rename {scripted/sbt => scripted-sbt-redux}/NOTICE (100%) rename {scripted/sbt => scripted-sbt-redux}/src/main/scala/sbt/scriptedtest/BatchScriptRunner.scala (100%) rename {scripted/sbt => scripted-sbt-redux}/src/main/scala/sbt/scriptedtest/RemoteSbtCreator.scala (100%) rename {scripted/sbt => scripted-sbt-redux}/src/main/scala/sbt/scriptedtest/SbtHandler.scala (100%) rename {scripted/sbt => scripted-sbt-redux}/src/main/scala/sbt/scriptedtest/ScriptedTests.scala (100%) diff --git a/build.sbt b/build.sbt index b9bd3f797..75dd2a338 100644 --- a/build.sbt +++ b/build.sbt @@ -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)") diff --git a/project/Scripted.scala b/project/Scripted.scala index 7a46149fc..2cd17db8b 100644 --- a/project/Scripted.scala +++ b/project/Scripted.scala @@ -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._ diff --git a/scripted/plugin/src/main/scala/sbt/ScriptedPlugin.scala b/scripted-plugin/src/main/scala/sbt/ScriptedPlugin.scala similarity index 100% rename from scripted/plugin/src/main/scala/sbt/ScriptedPlugin.scala rename to scripted-plugin/src/main/scala/sbt/ScriptedPlugin.scala diff --git a/scripted/plugin/src/main/scala/sbt/test/ScriptedTests.scala b/scripted-sbt-old/src/main/scala/sbt/test/ScriptedTests.scala similarity index 100% rename from scripted/plugin/src/main/scala/sbt/test/ScriptedTests.scala rename to scripted-sbt-old/src/main/scala/sbt/test/ScriptedTests.scala diff --git a/scripted/sbt/NOTICE b/scripted-sbt-redux/NOTICE similarity index 100% rename from scripted/sbt/NOTICE rename to scripted-sbt-redux/NOTICE diff --git a/scripted/sbt/src/main/scala/sbt/scriptedtest/BatchScriptRunner.scala b/scripted-sbt-redux/src/main/scala/sbt/scriptedtest/BatchScriptRunner.scala similarity index 100% rename from scripted/sbt/src/main/scala/sbt/scriptedtest/BatchScriptRunner.scala rename to scripted-sbt-redux/src/main/scala/sbt/scriptedtest/BatchScriptRunner.scala diff --git a/scripted/sbt/src/main/scala/sbt/scriptedtest/RemoteSbtCreator.scala b/scripted-sbt-redux/src/main/scala/sbt/scriptedtest/RemoteSbtCreator.scala similarity index 100% rename from scripted/sbt/src/main/scala/sbt/scriptedtest/RemoteSbtCreator.scala rename to scripted-sbt-redux/src/main/scala/sbt/scriptedtest/RemoteSbtCreator.scala diff --git a/scripted/sbt/src/main/scala/sbt/scriptedtest/SbtHandler.scala b/scripted-sbt-redux/src/main/scala/sbt/scriptedtest/SbtHandler.scala similarity index 100% rename from scripted/sbt/src/main/scala/sbt/scriptedtest/SbtHandler.scala rename to scripted-sbt-redux/src/main/scala/sbt/scriptedtest/SbtHandler.scala diff --git a/scripted/sbt/src/main/scala/sbt/scriptedtest/ScriptedTests.scala b/scripted-sbt-redux/src/main/scala/sbt/scriptedtest/ScriptedTests.scala similarity index 100% rename from scripted/sbt/src/main/scala/sbt/scriptedtest/ScriptedTests.scala rename to scripted-sbt-redux/src/main/scala/sbt/scriptedtest/ScriptedTests.scala