Skip to content

Commit 8efa688

Browse files
committed
Restore dist projects and add minimal set of tests to confirm correct execution
1 parent c0f7c2a commit 8efa688

File tree

6 files changed

+157
-88
lines changed

6 files changed

+157
-88
lines changed

.github/workflows/ci.yaml

Lines changed: 45 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ jobs:
133133
fi
134134
135135
- name: Prepare the SDKs
136-
if: false # TODO: Requires changes to dist targets, to be done before stable release
137136
shell: bash
138137
run : |
139138
prepareSDK() {
@@ -160,13 +159,11 @@ jobs:
160159
prepareSDK "-x86_64-pc-win32" "dist-win-x86_64" "./dist/win-x86_64/"
161160
162161
- name: Download MSI package
163-
if: false # TODO: Requires changes to dist targets, to be done before stable release
164162
uses: actions/download-artifact@v7
165163
with:
166164
name: scala.msi
167165
path: .
168166
- name: Prepare MSI package
169-
if: false # TODO: Requires changes to dist targets, to be done before stable release
170167
shell: bash
171168
run: |
172169
msiInstaller="scala3-${{ env.RELEASE_TAG }}.msi"
@@ -194,53 +191,52 @@ jobs:
194191
--latest=${{ !contains(env.RELEASE_TAG, '-RC') }} \
195192
--prerelease=${{ contains(env.RELEASE_TAG, '-RC') }} \
196193
--verify-tag ${{ env.RELEASE_TAG }} \
197-
# TODO: dist packaging for 3.8.0 stable release
198-
# scala3-${{ env.RELEASE_TAG }}*.zip \
199-
# scala3-${{ env.RELEASE_TAG }}*.tar.gz \
200-
# scala3-${{ env.RELEASE_TAG }}*.sha256 \
201-
# scala3-${{ env.RELEASE_TAG }}.msi
194+
scala3-${{ env.RELEASE_TAG }}*.zip \
195+
scala3-${{ env.RELEASE_TAG }}*.tar.gz \
196+
scala3-${{ env.RELEASE_TAG }}*.sha256 \
197+
scala3-${{ env.RELEASE_TAG }}.msi
202198
203199
- name: Publish Release
204200
run: ./project/scripts/sbtPublish ";project scala3-bootstrapped-new ;publishSigned ;sonaUpload"
205201

206-
#build-msi-package:
207-
# uses: ./.github/workflows/build-msi.yml
208-
# if :
209-
# (github.event_name == 'pull_request' && contains(github.event.pull_request.body, '[test_msi]')) ||
210-
# (github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/'))
211-
212-
#test-msi-package:
213-
# uses: ./.github/workflows/test-msi.yml
214-
# needs: [build-msi-package]
215-
# with:
216-
# # Ensure that version starts with prefix 3.
217-
# # In the future it can be adapted to compare with git tag or version set in the project/Build.scala
218-
# version: "3."
219-
# java-version: 17
220-
221-
#build-sdk-package:
222-
# uses: ./.github/workflows/build-sdk.yml
223-
# if:
224-
# (github.event_name == 'pull_request' && !contains(github.event.pull_request.body, '[skip ci]')) ||
225-
# (github.event_name == 'workflow_dispatch' && github.repository == 'scala/scala3') ||
226-
# (github.event_name == 'schedule' && github.repository == 'scala/scala3') ||
227-
# github.event_name == 'push' ||
228-
# github.event_name == 'merge_group'
229-
# with:
230-
# java-version: 17
231-
232-
#build-chocolatey-package:
233-
# uses: ./.github/workflows/build-chocolatey.yml
234-
# needs: [ build-sdk-package ]
235-
# with:
236-
# version: 3.6.0-SNAPSHOT # Fake version, used only for choco tests
237-
# url : https://api.github.com/repos/scala/scala3/actions/artifacts/${{ needs.build-sdk-package.outputs.win-x86_64-id }}/zip
238-
# digest : ${{ needs.build-sdk-package.outputs.win-x86_64-digest }}
239-
240-
#test-chocolatey-package:
241-
# uses: ./.github/workflows/test-chocolatey.yml
242-
# with:
243-
# version : 3.6.0-SNAPSHOT # Fake version, used only for choco tests
244-
# java-version: 17
245-
# if: github.event_name == 'pull_request' && contains(github.event.pull_request.body, '[test_chocolatey]')
246-
# needs: [ build-chocolatey-package ]
202+
build-msi-package:
203+
uses: ./.github/workflows/build-msi.yml
204+
if :
205+
(github.event_name == 'pull_request' && contains(github.event.pull_request.body, '[test_msi]')) ||
206+
(github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/'))
207+
208+
test-msi-package:
209+
uses: ./.github/workflows/test-msi.yml
210+
needs: [build-msi-package]
211+
with:
212+
# Ensure that version starts with prefix 3.
213+
# In the future it can be adapted to compare with git tag or version set in the project/Build.scala
214+
version: "3."
215+
java-version: 17
216+
217+
build-sdk-package:
218+
uses: ./.github/workflows/build-sdk.yml
219+
if:
220+
(github.event_name == 'pull_request' && !contains(github.event.pull_request.body, '[skip ci]')) ||
221+
(github.event_name == 'workflow_dispatch' && github.repository == 'scala/scala3') ||
222+
(github.event_name == 'schedule' && github.repository == 'scala/scala3') ||
223+
github.event_name == 'push' ||
224+
github.event_name == 'merge_group'
225+
with:
226+
java-version: 17
227+
228+
build-chocolatey-package:
229+
uses: ./.github/workflows/build-chocolatey.yml
230+
needs: [ build-sdk-package ]
231+
with:
232+
version: 3.6.0-SNAPSHOT # Fake version, used only for choco tests
233+
url : https://api.github.com/repos/scala/scala3/actions/artifacts/${{ needs.build-sdk-package.outputs.win-x86_64-id }}/zip
234+
digest : ${{ needs.build-sdk-package.outputs.win-x86_64-digest }}
235+
236+
test-chocolatey-package:
237+
uses: ./.github/workflows/test-chocolatey.yml
238+
with:
239+
version : 3.6.0-SNAPSHOT # Fake version, used only for choco tests
240+
java-version: 17
241+
if: github.event_name == 'pull_request' && contains(github.event.pull_request.body, '[test_chocolatey]')
242+
needs: [ build-chocolatey-package ]

build.sbt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ val `scaladoc-testcases` = Build.`scaladoc-testcases`
3535
val `scaladoc-js-common` = Build.`scaladoc-js-common`
3636
val `scaladoc-js-main` = Build.`scaladoc-js-main`
3737
val `scaladoc-js-contributors` = Build.`scaladoc-js-contributors`
38-
//val dist = Build.dist
39-
//val `dist-mac-x86_64` = Build.`dist-mac-x86_64`
40-
//val `dist-mac-aarch64` = Build.`dist-mac-aarch64`
41-
//val `dist-win-x86_64` = Build.`dist-win-x86_64`
42-
//val `dist-linux-x86_64` = Build.`dist-linux-x86_64`
43-
//val `dist-linux-aarch64` = Build.`dist-linux-aarch64`
38+
val dist = Build.dist
39+
val `dist-mac-x86_64` = Build.`dist-mac-x86_64`
40+
val `dist-mac-aarch64` = Build.`dist-mac-aarch64`
41+
val `dist-win-x86_64` = Build.`dist-win-x86_64`
42+
val `dist-linux-x86_64` = Build.`dist-linux-x86_64`
43+
val `dist-linux-aarch64` = Build.`dist-linux-aarch64`
4444
val `community-build` = Build.`community-build`
4545
val `scala3-presentation-compiler` = Build.`scala3-presentation-compiler`
4646
val `scala3-presentation-compiler-testcases` = Build.`scala3-presentation-compiler-testcases`

project/Build.scala

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2951,7 +2951,7 @@ object Build {
29512951
),
29522952
)
29532953

2954-
/*lazy val commonDistSettings = Seq(
2954+
lazy val commonDistSettings = Seq(
29552955
publishArtifact := false,
29562956
republishRepo := target.value / "republish",
29572957
Universal / packageName := packageName.value,
@@ -2973,42 +2973,42 @@ object Build {
29732973
Universal / mappings ++= directory(republishRepo.value / "libexec"),
29742974
Universal / mappings += (republishRepo.value / "VERSION") -> "VERSION",
29752975
// ========
2976-
republishCommandLibs += ("scala" -> List("scala3-interfaces", "scala3-compiler", "scala3-library", "tasty-core")),
2977-
republishCommandLibs += ("with_compiler" -> List("scala3-staging", "scala3-tasty-inspector", "^!scala3-interfaces", "^!scala3-compiler", "^!scala3-library", "^!tasty-core")),
2978-
republishCommandLibs += ("scaladoc" -> List("scala3-interfaces", "scala3-compiler", "scala3-library", "tasty-core", "scala3-tasty-inspector", "scaladoc")),
2979-
)*/
2976+
republishCommandLibs += ("scala" -> List("scala3-interfaces", "scala3-compiler", "scala3-library", "scala-library", "tasty-core", "scala3-repl")),
2977+
republishCommandLibs += ("with_compiler" -> List("scala3-staging", "scala3-tasty-inspector", "scala3-repl", "^!scala3-interfaces", "^!scala3-compiler", "^!scala3-library", "^!scala-library", "^!tasty-core")),
2978+
republishCommandLibs += ("scaladoc" -> List("scala3-interfaces", "scala3-compiler", "scala3-library", "scala-library", "tasty-core", "scala3-tasty-inspector", "scaladoc")),
2979+
)
29802980

2981-
/*lazy val dist = project.asDist(Bootstrapped)
2981+
lazy val dist = project.asDist
29822982
.settings(packageName := "scala3-" + dottyVersion)
29832983
.settings(
29842984
republishLibexecDir := baseDirectory.value / "libexec",
29852985
republishCoursier +=
29862986
("coursier.jar" -> s"https://github.com/coursier/coursier/releases/download/v$coursierJarVersion/coursier.jar"),
29872987
republishLaunchers +=
29882988
("scala-cli.jar" -> s"https://github.com/VirtusLab/scala-cli/releases/download/v$scalaCliLauncherVersion/scala-cli.jar"),
2989-
)*/
2989+
)
29902990

2991-
/*lazy val `dist-mac-x86_64` = project.in(file("dist/mac-x86_64")).asDist(Bootstrapped)
2991+
lazy val `dist-mac-x86_64` = project.in(file("dist/mac-x86_64")).asDist
29922992
.settings(packageName := (dist / packageName).value + "-x86_64-apple-darwin")
29932993
.settings(
29942994
republishLibexecDir := (dist / republishLibexecDir).value,
29952995
republishLibexecOverrides += (dist / baseDirectory).value / "libexec-native-overrides",
29962996
republishFetchCoursier := (dist / republishFetchCoursier).value,
29972997
republishLaunchers +=
29982998
("scala-cli" -> s"gz+https://github.com/VirtusLab/scala-cli/releases/download/v$scalaCliLauncherVersion/scala-cli-x86_64-apple-darwin.gz")
2999-
)*/
2999+
)
30003000

3001-
/*lazy val `dist-mac-aarch64` = project.in(file("dist/mac-aarch64")).asDist(Bootstrapped)
3001+
lazy val `dist-mac-aarch64` = project.in(file("dist/mac-aarch64")).asDist
30023002
.settings(packageName := (dist / packageName).value + "-aarch64-apple-darwin")
30033003
.settings(
30043004
republishLibexecDir := (dist / republishLibexecDir).value,
30053005
republishLibexecOverrides += (dist / baseDirectory).value / "libexec-native-overrides",
30063006
republishFetchCoursier := (dist / republishFetchCoursier).value,
30073007
republishLaunchers +=
30083008
("scala-cli" -> s"gz+https://github.com/VirtusLab/scala-cli/releases/download/v$scalaCliLauncherVersion/scala-cli-aarch64-apple-darwin.gz")
3009-
)*/
3009+
)
30103010

3011-
/*lazy val `dist-win-x86_64` = project.in(file("dist/win-x86_64")).asDist(Bootstrapped)
3011+
lazy val `dist-win-x86_64` = project.in(file("dist/win-x86_64")).asDist
30123012
.enablePlugins(WindowsPlugin) // TO GENERATE THE `.msi` installer
30133013
.settings(packageName := (dist / packageName).value + "-x86_64-pc-win32")
30143014
.settings(
@@ -3033,27 +3033,27 @@ object Build {
30333033
wixProductId := "*", // Unique ID for each generated MSI; will change for each generated msi
30343034
wixProductUpgradeId := "3E5A1A82-CA67-4353-94FE-5BDD400AF66B", // Unique ID to identify the package; used to manage the upgrades
30353035
wixProductLicense := Some(dist.base / "LICENSE.rtf") // Link to the LICENSE to show during the installation (keep in sync with ../LICENSE)
3036-
)*/
3036+
)
30373037

3038-
/*lazy val `dist-linux-x86_64` = project.in(file("dist/linux-x86_64")).asDist(Bootstrapped)
3038+
lazy val `dist-linux-x86_64` = project.in(file("dist/linux-x86_64")).asDist
30393039
.settings(packageName := (dist / packageName).value + "-x86_64-pc-linux")
30403040
.settings(
30413041
republishLibexecDir := (dist / republishLibexecDir).value,
30423042
republishLibexecOverrides += (dist / baseDirectory).value / "libexec-native-overrides",
30433043
republishFetchCoursier := (dist / republishFetchCoursier).value,
30443044
republishLaunchers +=
30453045
("scala-cli" -> s"gz+https://github.com/VirtusLab/scala-cli/releases/download/v$scalaCliLauncherVersion/scala-cli-x86_64-pc-linux.gz")
3046-
)*/
3046+
)
30473047

3048-
/*lazy val `dist-linux-aarch64` = project.in(file("dist/linux-aarch64")).asDist(Bootstrapped)
3048+
lazy val `dist-linux-aarch64` = project.in(file("dist/linux-aarch64")).asDist
30493049
.settings(packageName := (dist / packageName).value + "-aarch64-pc-linux")
30503050
.settings(
30513051
republishLibexecDir := (dist / republishLibexecDir).value,
30523052
republishLibexecOverrides += (dist / baseDirectory).value / "libexec-native-overrides",
30533053
republishFetchCoursier := (dist / republishFetchCoursier).value,
30543054
republishLaunchers +=
30553055
("scala-cli" -> s"gz+https://github.com/VirtusLab/scala-cli/releases/download/v$scalaCliLauncherVersion/scala-cli-aarch64-pc-linux.gz")
3056-
)*/
3056+
)
30573057

30583058
private def customMimaReportBinaryIssues(issueFilterLocation: String) = mimaReportBinaryIssues := {
30593059
mimaReportBinaryIssues.result.value match {
@@ -3071,23 +3071,25 @@ object Build {
30713071
settings(commonBenchmarkSettings).
30723072
enablePlugins(JmhPlugin)*/
30733073

3074-
/*def asDist(implicit mode: Mode): Project = project.
3075-
enablePlugins(UniversalPlugin, RepublishPlugin).
3076-
withCommonSettings.
3077-
settings(commonDistSettings).
3078-
dependsOn(
3074+
def asDist: Project = project
3075+
.enablePlugins(UniversalPlugin, RepublishPlugin)
3076+
.settings(commonBootstrappedSettings)
3077+
.settings(commonDistSettings)
3078+
.dependsOn(
3079+
`scala-library-bootstrapped`,
3080+
`scala3-compiler-bootstrapped-new`,
30793081
`scala3-interfaces`,
3080-
dottyCompiler,
3081-
dottyLibrary,
3082-
tastyCore,
3083-
`scala3-staging`,
3084-
`scala3-tasty-inspector`,
3085-
scaladoc,
3086-
`scala3-sbt-bridge`, // for scala-cli
3087-
).
3088-
bootstrappedSettings(
3082+
`scala3-library-bootstrapped-new`,
3083+
`scala3-repl`,
3084+
`scala3-sbt-bridge-bootstrapped`, // for scala-cli
3085+
`scala3-staging-new`,
3086+
`scala3-tasty-inspector-new`,
3087+
`scaladoc-new`,
3088+
`tasty-core-bootstrapped-new`,
3089+
)
3090+
.settings(
30893091
target := baseDirectory.value / "target" // override setting in commonBootstrappedSettings
3090-
)*/
3092+
)
30913093

30923094
}
30933095

project/scripts/native-integration/bashTests

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ PROG_HOME="$DIST_DIR/target/universal/stage"
2323

2424
SOURCE="$ROOT/tests/pos/HelloWorld.scala"
2525
SOURCE_VERSION="$ROOT/project/scripts/native-integration/reportScalaVersion.scala"
26+
SOURCE_TEST_BOOTSTRAPPED="$ROOT/project/scripts/native-integration/testBootstrappedLibrary.scala"
2627

2728
clear_cli_dotfiles()
2829
{
@@ -82,3 +83,15 @@ std_output=$("$PROG_HOME/bin/scala" run "$SOURCE_VERSION" -with-compiler --power
8283
test "$SCALA_VERSION" = "$std_output"
8384
clear_cli_dotfiles "$ROOT/project/scripts/native-integration"
8485

86+
echo "testing REPL direct invocation with -repl-init-script"
87+
# Use scalac with REPL options to verify REPL functionality
88+
# -repl-init-script runs code on startup, -repl-quit-after-init exits after init
89+
std_output=$("$PROG_HOME/bin/scala" -repl-init-script 'println("REPL_INIT_OK"); assert(scala.util.Properties.versionNumberString.startsWith("3."))' -repl-quit-after-init --power --offline --server=false 2>&1)
90+
echo "$std_output" | grep -q "REPL_INIT_OK" || die "REPL init script test failed, output: $std_output"
91+
clear_cli_dotfiles "$ROOT"
92+
93+
echo "testing bootstrapped standard library (scala-library-bootstrapped)"
94+
std_output=$("$PROG_HOME/bin/scala" run "$SOURCE_TEST_BOOTSTRAPPED" --power --offline --server=false)
95+
echo "$std_output" | grep -q "BOOTSTRAPPED_LIBRARY_TEST_PASSED" || die "Bootstrapped library test failed, output: $std_output"
96+
clear_cli_dotfiles "$ROOT/project/scripts/native-integration"
97+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Test that the bootstrapped standard library (scala-library-bootstrapped) works correctly
2+
// This verifies the Scala 3 compiled standard library is properly included in the distribution
3+
4+
@main def testBootstrappedLibrary: Unit =
5+
// ==========================================================================
6+
// CRITICAL TEST: Verify we're using Scala 3 compiled library, not Scala 2.13
7+
// ==========================================================================
8+
9+
// Test A: Check scala.util.Properties.versionNumberString
10+
// In Scala 3.8+, this should start with "3." because scala-library is compiled with Scala 3
11+
// In Scala 3.7.4 and earlier, this was "2.13.x" because scala-library was from Scala 2.13
12+
val libraryVersion = scala.util.Properties.versionNumberString
13+
assert(
14+
libraryVersion.startsWith("3."),
15+
s"scala-library should be compiled with Scala 3, but got version: $libraryVersion. " +
16+
"This indicates the distribution is using Scala 2.13 compiled library instead of scala-library-bootstrapped."
17+
)
18+
19+
// Test B: Verify no Scala 2.13 library JAR is on the classpath
20+
val classpath = System.getProperty("java.class.path", "")
21+
val classpathEntries = classpath.split(java.io.File.pathSeparator).toList
22+
23+
val scala213Entries = classpathEntries.filter { entry =>
24+
val lowerEntry = entry.toLowerCase
25+
// Look for scala-library with 2.13 version pattern
26+
(lowerEntry.contains("scala-library") || lowerEntry.contains("scala_library")) &&
27+
lowerEntry.contains("2.13")
28+
}
29+
30+
assert(
31+
scala213Entries.isEmpty,
32+
s"Found Scala 2.13 library on classpath, which should not happen:\n${scala213Entries.mkString("\n")}\n" +
33+
"The distribution should only include scala-library-bootstrapped (compiled with Scala 3)."
34+
)
35+
36+
// Test C: Verify scala3-library is on classpath (the Scala 3 specific additions)
37+
val scala3LibraryEntries = classpathEntries.filter { entry =>
38+
entry.toLowerCase.contains("scala3-library")
39+
}
40+
// Note: scala3-library might be merged or named differently, so this is informational
41+
42+
println("BOOTSTRAPPED_LIBRARY_TEST_PASSED")

project/scripts/native-integration/winTests.bat

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
@echo off
2-
setlocal
2+
setlocal EnableDelayedExpansion
33

44
@rem paths are relative to the root project directory
55
set "_PREFIX=dist\win-x86_64\target\universal\stage"
66
set "_SOURCE=tests\pos\HelloWorld.scala"
7+
set "_SOURCE_TEST_BOOTSTRAPPED=project\scripts\native-integration\testBootstrappedLibrary.scala"
78
set "_OUT_DIR=out"
89

910
@rem if-tests mimic the non-existing bash instruction 'set -e'.
@@ -16,4 +17,19 @@ if not %ERRORLEVEL%==0 endlocal& exit /b 1
1617
call "%_PREFIX%\bin\scala.bat" --power -classpath "%_OUT_DIR%" -M HelloWorld --offline --server=false
1718
if not %ERRORLEVEL%==0 endlocal& exit /b 1
1819

20+
echo testing REPL direct invocation with -repl-init-script
21+
call "%_PREFIX%\bin\scala.bat" -repl-init-script "println(\"REPL_INIT_OK\"); assert(scala.util.Properties.versionNumberString.startsWith(\"3.\"))" -repl-quit-after-init --power --offline --server=false 2>&1 | findstr /C:"REPL_INIT_OK" >nul
22+
if not %ERRORLEVEL%==0 (
23+
echo REPL init script test failed: output did not contain REPL_INIT_OK
24+
endlocal& exit /b 1
25+
)
26+
27+
echo testing bootstrapped standard library (scala-library-bootstrapped)
28+
call "%_PREFIX%\bin\scala.bat" run "%_SOURCE_TEST_BOOTSTRAPPED%" --power --offline --server=false 2>&1 | findstr /C:"BOOTSTRAPPED_LIBRARY_TEST_PASSED" >nul
29+
if not %ERRORLEVEL%==0 (
30+
echo Bootstrapped library test failed: output did not contain BOOTSTRAPPED_LIBRARY_TEST_PASSED
31+
endlocal& exit /b 1
32+
)
33+
34+
echo All tests passed!
1935
endlocal

0 commit comments

Comments
 (0)