Skip to content

Commit b0d0bd9

Browse files
committed
Restore CI tests on Windows
1 parent 3c31ec9 commit b0d0bd9

File tree

6 files changed

+26
-20
lines changed

6 files changed

+26
-20
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,24 +230,21 @@ jobs:
230230
shell: cmd
231231

232232
- name: build binary
233-
run: sbt "dist/pack" & bash -version
233+
run: sbt "dist-win-x64/pack" & bash -version
234234
shell: cmd
235235

236236
# skip while Windows runner is on Java 8, and we use jar launcher for Scala CLI
237237
- name: cygwin tests
238-
if: ${{ false }}
239238
run: '"C:\Program Files\cygwin64\bin\bash" ./project/scripts/winCmdTests'
240239
shell: cmd
241240

242241
# skip while Windows runner is on Java 8, and we use jar launcher for Scala CLI
243242
- name: msys tests
244-
if: ${{ false }}
245243
run: '"C:\Program Files\Git\bin\bash" ./project/scripts/winCmdTests'
246244
shell: cmd
247245

248246
# skip while Windows runner is on Java 8, and we use jar launcher for Scala CLI
249247
- name: win tests
250-
if: ${{ false }}
251248
run: './project/scripts/winCmdTests.bat'
252249
shell: cmd
253250

@@ -276,7 +273,7 @@ jobs:
276273
uses: actions/checkout@v4
277274

278275
- name: Test
279-
run: sbt ";dist/pack ;scala3-bootstrapped/compile ;scala3-bootstrapped/test"
276+
run: sbt ";dist-win-x64/pack ;scala3-bootstrapped/compile ;scala3-bootstrapped/test"
280277
shell: cmd
281278

282279
- name: Scala.js Test

compiler/test/dotty/tools/io/ClasspathTest.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ class ClasspathTest {
1515

1616
def pathsep = sys.props("path.separator")
1717

18+
def isWindows: Boolean = scala.util.Properties.isWin
19+
1820
//
1921
// Cope with wildcard classpath entries, exercised with -classpath <cp>
2022
//
@@ -23,7 +25,7 @@ class ClasspathTest {
2325
@Test def testWildcards(): Unit =
2426
val outDir = Files.createTempDirectory("classpath-test")
2527
try
26-
val compilerLib = "dist/target/pack/lib"
28+
val compilerLib = s"${if isWindows then "dist-win-x64" else "dist"}/target/pack/lib"
2729
val libdir = Paths.get(compilerLib).toFile
2830
if libdir.exists then
2931
val libjarFiles = libdir.listFiles.toList.take(5)

compiler/test/dotty/tools/scripting/ClasspathTests.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class ClasspathTests:
5858
val packlibDir: String = ??? /* ??? was s"$scriptCwd/$packLibDir" */ // classpathReport_scalacli.sc specifies a wildcard classpath in this directory
5959
val packlibJars: List[File] = listJars(packlibDir) // classpath entries expected to have been reported by the script
6060

61-
printf("%d jar files in dist/target/pack/lib\n", packlibJars.size)
61+
printf(s"%d jar files in $packDir/lib\n", packlibJars.size)
6262
printf("%d test script jars in classpath\n", hashbangClasspathJars.size)
6363

6464
val (diff: Set[File], msg: String) = if (packlibJars.size > hashbangClasspathJars.size) {
@@ -67,7 +67,7 @@ class ClasspathTests:
6767
(hashbangJars.toSet -- packlibJars.toSet , "only in hashbang classpath")
6868
}
6969
// verify that the script hasbang classpath setting was effective at supplementing the classpath
70-
// (a minimal subset of jars below dist/target/pack/lib are always be in the classpath)
70+
// (a minimal subset of jars below dist*/target/pack/lib are always be in the classpath)
7171
val missingClasspathEntries = if hashbangClasspathJars.size != packlibJars.size then
7272
printf("packlib dir [%s]\n", packlibDir)
7373
printf("hashbangClasspathJars: %s\n", hashbangJars.map { _.relpath.norm }.mkString("\n ", "\n ", ""))

compiler/test/dotty/tools/scripting/ScriptTestEnv.scala

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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
*/
2121
object 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 =

project/scripts/winCmdTests

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22

33
set -e
4-
PREFIX="dist/target/pack"
4+
PREFIX="dist/win-x64/target/pack"
55
SOURCE="tests/pos/HelloWorld.scala"
66
$PREFIX/bin/scalac @project/scripts/options "$SOURCE"
77
$PREFIX/bin/scalac -d out "$SOURCE"

project/scripts/winCmdTests.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
setlocal
33

44
@rem paths are relative to the root project directory
5-
set "_PREFIX=dist\target\pack"
5+
set "_PREFIX=dist\win-x64\target\pack"
66
set "_SOURCE=tests\pos\HelloWorld.scala"
77
set "_OUT_DIR=out"
88
set "_SITE_DIR=_site"

0 commit comments

Comments
 (0)