Skip to content

Commit

Permalink
refactor: Move scripted-sbt-redux back to scripted-sbt
Browse files Browse the repository at this point in the history
**Problem**
During sbt 1.x we created scripted-sbt-redux for package name change.

**Solution**
We can move the module back to scripted-sbt, which simplifies things.
  • Loading branch information
eed3si9n committed Sep 15, 2024
1 parent e574914 commit 4af0024
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 103 deletions.
49 changes: 9 additions & 40 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def mimaSettingsSince(versions: Seq[String]): Seq[Def.Setting[_]] = Def settings
),
)

val scriptedSbtReduxMimaSettings = Def.settings(mimaPreviousArtifacts := Set())
val scriptedSbtMimaSettings = Def.settings(mimaPreviousArtifacts := Set())

lazy val sbtRoot: Project = (project in file("."))
.aggregate(allProjects.map(p => LocalProject(p.id)): _*)
Expand Down Expand Up @@ -618,43 +618,17 @@ val sbtProjDepsCompileScopeFilter =
inConfigurations(Compile)
)

lazy val scriptedSbtReduxProj = (project in file("scripted-sbt-redux"))
lazy val scriptedSbtProj = (project in file("scripted-sbt"))
.dependsOn(sbtProj % "compile;test->test", commandProj, utilLogging, utilScripted)
.settings(
baseSettings,
name := "Scripted sbt Redux",
name := "scripted-sbt",
libraryDependencies ++= Seq(launcherInterface % "provided"),
mimaSettings,
scriptedSbtReduxMimaSettings,
scriptedSbtMimaSettings,
)
.configure(addSbtIO, addSbtCompilerInterface, addSbtLmCore)

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.*"),
exclude[IncompatibleSignatureProblem]("sbt.test.*"),
),
)

lazy val scriptedPluginProj = (project in file("scripted-plugin"))
.settings(
baseSettings,
name := "Scripted Plugin",
mimaSettings,
mimaBinaryIssueFilters ++= Seq(
// scripted plugin has moved into sbt mothership.
exclude[MissingClassProblem]("sbt.ScriptedPlugin*")
),
)

lazy val dependencyTreeProj = (project in file("dependency-tree"))
.dependsOn(sbtProj)
.settings(
Expand Down Expand Up @@ -947,7 +921,6 @@ lazy val mainProj = (project in file("main"))
runProj,
commandProj,
collectionProj,
scriptedPluginProj,
zincLmIntegrationProj,
utilLogging,
)
Expand Down Expand Up @@ -1028,7 +1001,7 @@ lazy val sbtProj = (project in file("sbt-app"))
// addSbtCompilerBridge

lazy val serverTestProj = (project in file("server-test"))
.dependsOn(sbtProj % "compile->test", scriptedSbtReduxProj % "compile->test")
.dependsOn(sbtProj % "compile->test", scriptedSbtProj % "compile->test")
.settings(
testedBaseSettings,
publish / skip := true,
Expand Down Expand Up @@ -1261,15 +1234,15 @@ def scriptedTask(launch: Boolean): Def.Initialize[InputTask[Unit]] = Def.inputTa
val _ = publishLocalBinAll.value
val launchJar = s"-Dsbt.launch.jar=${(bundledLauncherProj / Compile / packageBin).value}"
Scripted.doScripted(
(scriptedSbtReduxProj / scalaInstance).value,
(scriptedSbtProj / scalaInstance).value,
scriptedSource.value,
scriptedBufferLog.value,
Def.setting(Scripted.scriptedParser(scriptedSource.value)).parsed,
scriptedPrescripted.value,
scriptedLaunchOpts.value ++ (if (launch) Some(launchJar) else None),
scalaVersion.value,
version.value,
(scriptedSbtReduxProj / Test / fullClasspathAsJars).value
(scriptedSbtProj / Test / fullClasspathAsJars).value
.map(_.data)
.filterNot(_.getName.contains("scala-compiler")),
(bundledLauncherProj / Compile / packageBin).value,
Expand All @@ -1288,9 +1261,7 @@ def allProjects =
taskProj,
stdTaskProj,
runProj,
scriptedSbtReduxProj,
scriptedSbtOldProj,
scriptedPluginProj,
scriptedSbtProj,
dependencyTreeProj,
protocolProj,
actionsProj,
Expand Down Expand Up @@ -1364,9 +1335,7 @@ lazy val docProjects: ScopeFilter = ScopeFilter(
inAnyProject -- inProjects(
sbtRoot,
sbtProj,
scriptedSbtReduxProj,
scriptedSbtOldProj,
scriptedPluginProj,
scriptedSbtProj,
upperModules,
lowerUtils,
),
Expand Down
21 changes: 3 additions & 18 deletions main/src/main/scala/sbt/ScriptedPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -67,24 +67,9 @@ object ScriptedPlugin extends AutoPlugin {
.map(_.get().head)
.value,
sbtTestDirectory := sourceDirectory.value / "sbt-test",
libraryDependencies ++= (CrossVersion.partialVersion(scriptedSbt.value) match
case Some((0, 13)) =>
Seq(
"org.scala-sbt" % "scripted-sbt" % scriptedSbt.value % ScriptedConf,
"org.scala-sbt" % "sbt-launch" % scriptedSbt.value % ScriptedLaunchConf
)
case Some((1, _)) =>
Seq(
"org.scala-sbt" %% "scripted-sbt" % scriptedSbt.value % ScriptedConf,
"org.scala-sbt" % "sbt-launch" % scriptedSbt.value % ScriptedLaunchConf
)
case Some((2, _)) =>
Seq(
"org.scala-sbt" %% "scripted-sbt-redux" % scriptedSbt.value % ScriptedConf,
"org.scala-sbt" % "sbt-launch" % scriptedSbt.value % ScriptedLaunchConf
)
case Some((x, y)) => sys error s"Unknown sbt version ${scriptedSbt.value} ($x.$y)"
case None => sys error s"Unknown sbt version ${scriptedSbt.value}"
libraryDependencies ++= Seq(
"org.scala-sbt" %% "scripted-sbt" % scriptedSbt.value % ScriptedConf,
"org.scala-sbt" % "sbt-launch" % scriptedSbt.value % ScriptedLaunchConf
),
scriptedClasspath := getJars(ScriptedConf).value,
scriptedTests := scriptedTestsTask.value,
Expand Down
12 changes: 0 additions & 12 deletions scripted-plugin/src/main/scala/sbt/ScriptedPlugin.scala

This file was deleted.

33 changes: 0 additions & 33 deletions scripted-sbt-old/src/main/scala/sbt/test/OldScriptedTests.scala

This file was deleted.

File renamed without changes.

0 comments on commit 4af0024

Please sign in to comment.