mirror of https://github.com/sbt/sbt.git
Merge pull request #7670 from eed3si9n/wip/refactor-scripted-sbt
This commit is contained in:
commit
d8ea50bccb
49
build.sbt
49
build.sbt
|
|
@ -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)): _*)
|
||||
|
|
@ -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(
|
||||
|
|
@ -947,7 +921,6 @@ lazy val mainProj = (project in file("main"))
|
|||
runProj,
|
||||
commandProj,
|
||||
collectionProj,
|
||||
scriptedPluginProj,
|
||||
zincLmIntegrationProj,
|
||||
utilLogging,
|
||||
)
|
||||
|
|
@ -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,
|
||||
|
|
@ -1261,7 +1234,7 @@ 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,
|
||||
|
|
@ -1269,7 +1242,7 @@ def scriptedTask(launch: Boolean): Def.Initialize[InputTask[Unit]] = Def.inputTa
|
|||
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,
|
||||
|
|
@ -1288,9 +1261,7 @@ def allProjects =
|
|||
taskProj,
|
||||
stdTaskProj,
|
||||
runProj,
|
||||
scriptedSbtReduxProj,
|
||||
scriptedSbtOldProj,
|
||||
scriptedPluginProj,
|
||||
scriptedSbtProj,
|
||||
dependencyTreeProj,
|
||||
protocolProj,
|
||||
actionsProj,
|
||||
|
|
@ -1364,9 +1335,7 @@ lazy val docProjects: ScopeFilter = ScopeFilter(
|
|||
inAnyProject -- inProjects(
|
||||
sbtRoot,
|
||||
sbtProj,
|
||||
scriptedSbtReduxProj,
|
||||
scriptedSbtOldProj,
|
||||
scriptedPluginProj,
|
||||
scriptedSbtProj,
|
||||
upperModules,
|
||||
lowerUtils,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
/*
|
||||
* sbt
|
||||
* Copyright 2023, Scala center
|
||||
* Copyright 2011 - 2022, Lightbend, Inc.
|
||||
* Copyright 2008 - 2010, Mark Harrah
|
||||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
package sbt
|
||||
|
||||
// ScriptedPlugin has moved to main.
|
||||
private[sbt] object ScriptedPluginNote
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* sbt
|
||||
* Copyright 2023, Scala center
|
||||
* Copyright 2011 - 2022, Lightbend, Inc.
|
||||
* Copyright 2008 - 2010, Mark Harrah
|
||||
* Licensed under Apache License 2.0 (see LICENSE)
|
||||
*/
|
||||
|
||||
package sbt.test
|
||||
|
||||
import java.io.File
|
||||
|
||||
/**
|
||||
* This is a bincompat place holder sbt.test package that we are now trying to hide
|
||||
* because of the name conflict with Keys.test.
|
||||
*/
|
||||
@deprecated("Use sbt.scriptedtest.ScriptedRunner.", "1.2.0")
|
||||
private[sbt] class ScriptedRunner extends sbt.scriptedtest.ScriptedRunner
|
||||
|
||||
/**
|
||||
* This is a bincompat place holder for sbt.test package that we are now trying to hide
|
||||
* because of the name conflict with Keys.test.
|
||||
*/
|
||||
@deprecated("Use sbt.scriptedtest.ScriptedTests.", "1.2.0")
|
||||
private[sbt] object ScriptedTests extends ScriptedRunner {
|
||||
|
||||
/** Represents the function that runs the scripted tests, both in single or batch mode. */
|
||||
type TestRunner = () => Seq[Option[String]]
|
||||
|
||||
val emptyCallback: File => Unit = _ => ()
|
||||
def main(args: Array[String]): Unit =
|
||||
sbt.scriptedtest.ScriptedTests.main(args)
|
||||
}
|
||||
Loading…
Reference in New Issue