[2.x] feat: sbtw launcher (#8742)
- Add sbtwProj: Scala 3.x launcher with scopt, drop-in for sbt.bat
- Config: .sbtopts, .jvmopts, sbtconfig.txt, JAVA_OPTS/SBT_OPTS precedence
- Options: --client, --server, --jvm-client, mem, sbt-version, java-home, etc.
- sbt 2.x defaults to native client; --server forces JVM launcher
- JVM run via xsbt.boot.Boot; native via sbtn with --sbt-script
- build.sbt: sbtwProj in root build and allProjects; NativeImagePlugin
- Fixes: JAVA_OPTS then .jvmopts, build.properties trim, shutdownAll PID, Iterator.lastOption
2026-02-16 22:21:30 +01:00
|
|
|
package example.test
|
|
|
|
|
|
|
|
|
|
import java.io.File
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Resolves paths for launcher-package integration tests relative to the
|
|
|
|
|
* integration-test project base directory. The build injects
|
|
|
|
|
* sbt.test.integrationtest.basedir when Test/fork is true so paths are
|
|
|
|
|
* correct regardless of the forked JVM's working directory (e.g. on Windows).
|
|
|
|
|
*/
|
|
|
|
|
object IntegrationTestPaths {
|
|
|
|
|
private val baseDir: Option[File] =
|
|
|
|
|
sys.props.get("sbt.test.integrationtest.basedir").map(new File(_))
|
|
|
|
|
|
|
|
|
|
def sbtScript(isWindows: Boolean): File =
|
|
|
|
|
baseDir match {
|
|
|
|
|
case Some(b) =>
|
|
|
|
|
val name = if (isWindows) "sbt.bat" else "sbt"
|
|
|
|
|
new File(b.getParentFile, s"target/universal/stage/bin/$name").getAbsoluteFile
|
|
|
|
|
case None =>
|
2026-02-23 07:39:15 +01:00
|
|
|
val rel =
|
|
|
|
|
if (isWindows) "../target/universal/stage/bin/sbt.bat"
|
|
|
|
|
else "../target/universal/stage/bin/sbt"
|
[2.x] feat: sbtw launcher (#8742)
- Add sbtwProj: Scala 3.x launcher with scopt, drop-in for sbt.bat
- Config: .sbtopts, .jvmopts, sbtconfig.txt, JAVA_OPTS/SBT_OPTS precedence
- Options: --client, --server, --jvm-client, mem, sbt-version, java-home, etc.
- sbt 2.x defaults to native client; --server forces JVM launcher
- JVM run via xsbt.boot.Boot; native via sbtn with --sbt-script
- build.sbt: sbtwProj in root build and allProjects; NativeImagePlugin
- Fixes: JAVA_OPTS then .jvmopts, build.properties trim, shutdownAll PID, Iterator.lastOption
2026-02-16 22:21:30 +01:00
|
|
|
new File(rel).getAbsoluteFile
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
def citestDir(citestVariant: String = "citest"): File =
|
|
|
|
|
baseDir match {
|
|
|
|
|
case Some(b) =>
|
|
|
|
|
new File(b.getParentFile, citestVariant).getAbsoluteFile
|
|
|
|
|
case None =>
|
|
|
|
|
new File("..", citestVariant).getAbsoluteFile
|
|
|
|
|
}
|
|
|
|
|
}
|