mirror of https://github.com/sbt/sbt.git
Fix sbtw integration tests on Windows: pass full test classpath
When useSbtw=true, LauncherTestHelper runs 'java -cp ... sbtw.Main' using java.class.path, which is incomplete in the test JVM. Pass the full test classpath via -Dsbt.test.classpath in launcherPackageIntegrationTest (fork=true, javaOptions) and use it in LauncherTestHelper when set.
This commit is contained in:
parent
f95cf024b9
commit
a115036378
|
|
@ -1391,6 +1391,11 @@ lazy val launcherPackageIntegrationTest =
|
||||||
),
|
),
|
||||||
testFrameworks += TestFramework("hedgehog.sbt.Framework"),
|
testFrameworks += TestFramework("hedgehog.sbt.Framework"),
|
||||||
testFrameworks += TestFramework("verify.runner.Framework"),
|
testFrameworks += TestFramework("verify.runner.Framework"),
|
||||||
|
Test / fork := true,
|
||||||
|
Test / javaOptions += {
|
||||||
|
val cp = (Test / fullClasspath).value.map(_.data.getAbsolutePath).mkString(java.io.File.pathSeparator)
|
||||||
|
s"-Dsbt.test.classpath=$cp"
|
||||||
|
},
|
||||||
Test / test := {
|
Test / test := {
|
||||||
(Test / test)
|
(Test / test)
|
||||||
.dependsOn(launcherPackage / Universal / packageBin)
|
.dependsOn(launcherPackage / Universal / packageBin)
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,9 @@ object LauncherTestHelper {
|
||||||
|
|
||||||
/** Command prefix to run the launcher: either script path or java -cp sbtw.Main */
|
/** Command prefix to run the launcher: either script path or java -cp sbtw.Main */
|
||||||
def launcherCommand(scriptPath: String): Seq[String] =
|
def launcherCommand(scriptPath: String): Seq[String] =
|
||||||
if (useSbtw)
|
if (useSbtw) {
|
||||||
Seq("java", "-cp", System.getProperty("java.class.path"), "sbtw.Main")
|
val cp = sys.props.get("sbt.test.classpath").getOrElse(System.getProperty("java.class.path"))
|
||||||
else
|
Seq("java", "-cp", cp, "sbtw.Main")
|
||||||
|
} else
|
||||||
Seq(scriptPath)
|
Seq(scriptPath)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue