@@ -15,7 +15,7 @@ import scala.jdk.CollectionConverters.*
1515/**
1616 * Common Code for supporting scripting tests.
1717 * To override the path to the bash executable, set TEST_BASH=<path-to-bash.exe>
18- * To specify where `dist/target/pack/bin` resides, set TEST_CWD=<working-directory>
18+ * To specify where `dist[*] /target/pack/bin` resides, set TEST_CWD=<working-directory>
1919 * Test scripts run in a bash env, so paths are converted to forward slash via .norm.
2020 */
2121object ScriptTestEnv {
@@ -46,6 +46,14 @@ object ScriptTestEnv {
4646 if bspDir.isEmpty then bspDir.delete()
4747 }
4848
49+ lazy val packDir : String =
50+ if winshell then
51+ " dist-win-x64/target/pack"
52+ else
53+ " dist/target/pack"
54+
55+ def packBinDir : String = s " $packDir/bin "
56+
4957 lazy val workingDirectory : String = {
5058 val dirstr = if testCwd.nonEmpty then
5159 if verbose then printf(" TEST_CWD set to [%s]\n " , testCwd)
@@ -54,7 +62,7 @@ object ScriptTestEnv {
5462 userDir // userDir, if TEST_CWD not set
5563
5664 // issue warning if things don't look right
57- val test = Paths .get(s " $dirstr/dist/target/pack/bin " ).normalize
65+ val test = Paths .get(s " $dirstr/ $packBinDir " ).normalize
5866 if ! test.isDirectory then
5967 printf(" warning: not found below working directory: %s\n " , test.norm)
6068
@@ -64,7 +72,7 @@ object ScriptTestEnv {
6472
6573 def envPath : String = envOrElse(" PATH" , " " )
6674 // remove duplicate entries in path
67- def supplementedPath : String = s " dist/target/pack/bin $psep$envJavaHome/bin $psep$envScalaHome/bin $psep$envPath" .norm
75+ def supplementedPath : String = s " $packBinDir $psep$envJavaHome/bin $psep$envScalaHome/bin $psep$envPath" .norm
6876 def adjustedPathEntries : List [String ] = supplementedPath.norm.split(psep).toList.distinct
6977 def adjustedPath : String = adjustedPathEntries.mkString(psep)
7078 def envPathEntries : List [String ] = envPath.split(psep).toList.distinct
@@ -142,10 +150,9 @@ object ScriptTestEnv {
142150 } yield line
143151
144152
145- def packBinDir = " dist/target/pack/bin"
146- // def packLibDir = "dist/target/pack/lib" // replaced by packMavenDir
147- def packMavenDir = " dist/target/pack/maven2"
148- def packVersionFile = " dist/target/pack/VERSION"
153+ // def packLibDir = s"$packDir/lib" // replaced by packMavenDir
154+ def packMavenDir = s " $packDir/maven2 "
155+ def packVersionFile = s " $packDir/VERSION "
149156 def packBinScalaExists : Boolean = Files .exists(Paths .get(s " $packBinDir/scala " ))
150157
151158 def packScalaVersion : String = {
@@ -266,16 +273,16 @@ object ScriptTestEnv {
266273 lazy val cwd : Path = Paths .get(" ." ).toAbsolutePath.normalize
267274
268275 lazy val (scalacPath : String , scalaPath : String ) = {
269- val scalac = s " $workingDirectory/dist/target/pack/bin /scalac " .toPath.normalize
270- val scala = s " $workingDirectory/dist/target/pack/bin /scala " .toPath.normalize
276+ val scalac = s " $workingDirectory/ $packBinDir /scalac " .toPath.normalize
277+ val scala = s " $workingDirectory/ $packBinDir /scala " .toPath.normalize
271278 (scalac.norm, scala.norm)
272279 }
273280
274281
275282 // use optional TEST_BASH if defined, otherwise, bash must be in PATH
276283
277284 // envScalaHome is:
278- // dist/target/pack, if present
285+ // dist[*] /target/pack, if present
279286 // else, SCALA_HOME if defined
280287 // else, not defined
281288 lazy val envScalaHome =
0 commit comments