diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c9508f65ab0e..bd7cdaa4c809 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -133,7 +133,6 @@ jobs: fi - name: Prepare the SDKs - if: false # TODO: Requires changes to dist targets, to be done before stable release shell: bash run : | prepareSDK() { @@ -160,13 +159,11 @@ jobs: prepareSDK "-x86_64-pc-win32" "dist-win-x86_64" "./dist/win-x86_64/" - name: Download MSI package - if: false # TODO: Requires changes to dist targets, to be done before stable release uses: actions/download-artifact@v7 with: name: scala.msi path: . - name: Prepare MSI package - if: false # TODO: Requires changes to dist targets, to be done before stable release shell: bash run: | msiInstaller="scala3-${{ env.RELEASE_TAG }}.msi" @@ -194,53 +191,52 @@ jobs: --latest=${{ !contains(env.RELEASE_TAG, '-RC') }} \ --prerelease=${{ contains(env.RELEASE_TAG, '-RC') }} \ --verify-tag ${{ env.RELEASE_TAG }} \ - # TODO: dist packaging for 3.8.0 stable release - # scala3-${{ env.RELEASE_TAG }}*.zip \ - # scala3-${{ env.RELEASE_TAG }}*.tar.gz \ - # scala3-${{ env.RELEASE_TAG }}*.sha256 \ - # scala3-${{ env.RELEASE_TAG }}.msi + scala3-${{ env.RELEASE_TAG }}*.zip \ + scala3-${{ env.RELEASE_TAG }}*.tar.gz \ + scala3-${{ env.RELEASE_TAG }}*.sha256 \ + scala3-${{ env.RELEASE_TAG }}.msi - name: Publish Release run: ./project/scripts/sbtPublish ";project scala3-bootstrapped-new ;publishSigned ;sonaUpload" - #build-msi-package: - # uses: ./.github/workflows/build-msi.yml - # if : - # (github.event_name == 'pull_request' && contains(github.event.pull_request.body, '[test_msi]')) || - # (github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')) - - #test-msi-package: - # uses: ./.github/workflows/test-msi.yml - # needs: [build-msi-package] - # with: - # # Ensure that version starts with prefix 3. - # # In the future it can be adapted to compare with git tag or version set in the project/Build.scala - # version: "3." - # java-version: 17 - - #build-sdk-package: - # uses: ./.github/workflows/build-sdk.yml - # if: - # (github.event_name == 'pull_request' && !contains(github.event.pull_request.body, '[skip ci]')) || - # (github.event_name == 'workflow_dispatch' && github.repository == 'scala/scala3') || - # (github.event_name == 'schedule' && github.repository == 'scala/scala3') || - # github.event_name == 'push' || - # github.event_name == 'merge_group' - # with: - # java-version: 17 - - #build-chocolatey-package: - # uses: ./.github/workflows/build-chocolatey.yml - # needs: [ build-sdk-package ] - # with: - # version: 3.6.0-SNAPSHOT # Fake version, used only for choco tests - # url : https://api.github.com/repos/scala/scala3/actions/artifacts/${{ needs.build-sdk-package.outputs.win-x86_64-id }}/zip - # digest : ${{ needs.build-sdk-package.outputs.win-x86_64-digest }} - - #test-chocolatey-package: - # uses: ./.github/workflows/test-chocolatey.yml - # with: - # version : 3.6.0-SNAPSHOT # Fake version, used only for choco tests - # java-version: 17 - # if: github.event_name == 'pull_request' && contains(github.event.pull_request.body, '[test_chocolatey]') - # needs: [ build-chocolatey-package ] + build-msi-package: + uses: ./.github/workflows/build-msi.yml + if : + (github.event_name == 'pull_request' && contains(github.event.pull_request.body, '[test_msi]')) || + (github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')) + + test-msi-package: + uses: ./.github/workflows/test-msi.yml + needs: [build-msi-package] + with: + # Ensure that version starts with prefix 3. + # In the future it can be adapted to compare with git tag or version set in the project/Build.scala + version: "3." + java-version: 17 + + build-sdk-package: + uses: ./.github/workflows/build-sdk.yml + if: + (github.event_name == 'pull_request' && !contains(github.event.pull_request.body, '[skip ci]')) || + (github.event_name == 'workflow_dispatch' && github.repository == 'scala/scala3') || + (github.event_name == 'schedule' && github.repository == 'scala/scala3') || + github.event_name == 'push' || + github.event_name == 'merge_group' + with: + java-version: 17 + + build-chocolatey-package: + uses: ./.github/workflows/build-chocolatey.yml + needs: [ build-sdk-package ] + with: + version: 3.6.0-SNAPSHOT # Fake version, used only for choco tests + url : https://api.github.com/repos/scala/scala3/actions/artifacts/${{ needs.build-sdk-package.outputs.win-x86_64-id }}/zip + digest : ${{ needs.build-sdk-package.outputs.win-x86_64-digest }} + + test-chocolatey-package: + uses: ./.github/workflows/test-chocolatey.yml + with: + version : 3.6.0-SNAPSHOT # Fake version, used only for choco tests + java-version: 17 + if: github.event_name == 'pull_request' && contains(github.event.pull_request.body, '[test_chocolatey]') + needs: [ build-chocolatey-package ] diff --git a/.github/workflows/test-launchers.yml b/.github/workflows/test-launchers.yml index c65118223344..c6014fa1f2fd 100644 --- a/.github/workflows/test-launchers.yml +++ b/.github/workflows/test-launchers.yml @@ -1,6 +1,6 @@ name: Test CLI Launchers on all the platforms on: - #pull_request: + pull_request: workflow_dispatch: env: diff --git a/build.sbt b/build.sbt index aedb04e93ec9..b9e1c132d416 100644 --- a/build.sbt +++ b/build.sbt @@ -35,12 +35,12 @@ val `scaladoc-testcases` = Build.`scaladoc-testcases` val `scaladoc-js-common` = Build.`scaladoc-js-common` val `scaladoc-js-main` = Build.`scaladoc-js-main` val `scaladoc-js-contributors` = Build.`scaladoc-js-contributors` -//val dist = Build.dist -//val `dist-mac-x86_64` = Build.`dist-mac-x86_64` -//val `dist-mac-aarch64` = Build.`dist-mac-aarch64` -//val `dist-win-x86_64` = Build.`dist-win-x86_64` -//val `dist-linux-x86_64` = Build.`dist-linux-x86_64` -//val `dist-linux-aarch64` = Build.`dist-linux-aarch64` +val dist = Build.dist +val `dist-mac-x86_64` = Build.`dist-mac-x86_64` +val `dist-mac-aarch64` = Build.`dist-mac-aarch64` +val `dist-win-x86_64` = Build.`dist-win-x86_64` +val `dist-linux-x86_64` = Build.`dist-linux-x86_64` +val `dist-linux-aarch64` = Build.`dist-linux-aarch64` val `community-build` = Build.`community-build` val `scala3-presentation-compiler` = Build.`scala3-presentation-compiler` val `scala3-presentation-compiler-testcases` = Build.`scala3-presentation-compiler-testcases` diff --git a/project/Build.scala b/project/Build.scala index 473fd21f6d19..23c3552ad049 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -2951,7 +2951,7 @@ object Build { ), ) - /*lazy val commonDistSettings = Seq( + lazy val commonDistSettings = Seq( publishArtifact := false, republishRepo := target.value / "republish", Universal / packageName := packageName.value, @@ -2973,12 +2973,12 @@ object Build { Universal / mappings ++= directory(republishRepo.value / "libexec"), Universal / mappings += (republishRepo.value / "VERSION") -> "VERSION", // ======== - republishCommandLibs += ("scala" -> List("scala3-interfaces", "scala3-compiler", "scala3-library", "tasty-core")), - republishCommandLibs += ("with_compiler" -> List("scala3-staging", "scala3-tasty-inspector", "^!scala3-interfaces", "^!scala3-compiler", "^!scala3-library", "^!tasty-core")), - republishCommandLibs += ("scaladoc" -> List("scala3-interfaces", "scala3-compiler", "scala3-library", "tasty-core", "scala3-tasty-inspector", "scaladoc")), - )*/ + republishCommandLibs += ("scala" -> List("scala3-interfaces", "scala3-compiler", "scala3-library", "scala-library", "tasty-core", "scala3-repl")), + republishCommandLibs += ("with_compiler" -> List("scala3-staging", "scala3-tasty-inspector", "scala3-repl", "^!scala3-interfaces", "^!scala3-compiler", "^!scala3-library", "^!scala-library", "^!tasty-core")), + republishCommandLibs += ("scaladoc" -> List("scala3-interfaces", "scala3-compiler", "scala3-library", "scala-library", "tasty-core", "scala3-tasty-inspector", "scaladoc")), + ) - /*lazy val dist = project.asDist(Bootstrapped) + lazy val dist = project.asDist .settings(packageName := "scala3-" + dottyVersion) .settings( republishLibexecDir := baseDirectory.value / "libexec", @@ -2986,9 +2986,9 @@ object Build { ("coursier.jar" -> s"https://github.com/coursier/coursier/releases/download/v$coursierJarVersion/coursier.jar"), republishLaunchers += ("scala-cli.jar" -> s"https://github.com/VirtusLab/scala-cli/releases/download/v$scalaCliLauncherVersion/scala-cli.jar"), - )*/ + ) - /*lazy val `dist-mac-x86_64` = project.in(file("dist/mac-x86_64")).asDist(Bootstrapped) + lazy val `dist-mac-x86_64` = project.in(file("dist/mac-x86_64")).asDist .settings(packageName := (dist / packageName).value + "-x86_64-apple-darwin") .settings( republishLibexecDir := (dist / republishLibexecDir).value, @@ -2996,9 +2996,9 @@ object Build { republishFetchCoursier := (dist / republishFetchCoursier).value, republishLaunchers += ("scala-cli" -> s"gz+https://github.com/VirtusLab/scala-cli/releases/download/v$scalaCliLauncherVersion/scala-cli-x86_64-apple-darwin.gz") - )*/ + ) - /*lazy val `dist-mac-aarch64` = project.in(file("dist/mac-aarch64")).asDist(Bootstrapped) + lazy val `dist-mac-aarch64` = project.in(file("dist/mac-aarch64")).asDist .settings(packageName := (dist / packageName).value + "-aarch64-apple-darwin") .settings( republishLibexecDir := (dist / republishLibexecDir).value, @@ -3006,9 +3006,9 @@ object Build { republishFetchCoursier := (dist / republishFetchCoursier).value, republishLaunchers += ("scala-cli" -> s"gz+https://github.com/VirtusLab/scala-cli/releases/download/v$scalaCliLauncherVersion/scala-cli-aarch64-apple-darwin.gz") - )*/ + ) - /*lazy val `dist-win-x86_64` = project.in(file("dist/win-x86_64")).asDist(Bootstrapped) + lazy val `dist-win-x86_64` = project.in(file("dist/win-x86_64")).asDist .enablePlugins(WindowsPlugin) // TO GENERATE THE `.msi` installer .settings(packageName := (dist / packageName).value + "-x86_64-pc-win32") .settings( @@ -3033,9 +3033,9 @@ object Build { wixProductId := "*", // Unique ID for each generated MSI; will change for each generated msi wixProductUpgradeId := "3E5A1A82-CA67-4353-94FE-5BDD400AF66B", // Unique ID to identify the package; used to manage the upgrades wixProductLicense := Some(dist.base / "LICENSE.rtf") // Link to the LICENSE to show during the installation (keep in sync with ../LICENSE) - )*/ + ) - /*lazy val `dist-linux-x86_64` = project.in(file("dist/linux-x86_64")).asDist(Bootstrapped) + lazy val `dist-linux-x86_64` = project.in(file("dist/linux-x86_64")).asDist .settings(packageName := (dist / packageName).value + "-x86_64-pc-linux") .settings( republishLibexecDir := (dist / republishLibexecDir).value, @@ -3043,9 +3043,9 @@ object Build { republishFetchCoursier := (dist / republishFetchCoursier).value, republishLaunchers += ("scala-cli" -> s"gz+https://github.com/VirtusLab/scala-cli/releases/download/v$scalaCliLauncherVersion/scala-cli-x86_64-pc-linux.gz") - )*/ + ) - /*lazy val `dist-linux-aarch64` = project.in(file("dist/linux-aarch64")).asDist(Bootstrapped) + lazy val `dist-linux-aarch64` = project.in(file("dist/linux-aarch64")).asDist .settings(packageName := (dist / packageName).value + "-aarch64-pc-linux") .settings( republishLibexecDir := (dist / republishLibexecDir).value, @@ -3053,7 +3053,7 @@ object Build { republishFetchCoursier := (dist / republishFetchCoursier).value, republishLaunchers += ("scala-cli" -> s"gz+https://github.com/VirtusLab/scala-cli/releases/download/v$scalaCliLauncherVersion/scala-cli-aarch64-pc-linux.gz") - )*/ + ) private def customMimaReportBinaryIssues(issueFilterLocation: String) = mimaReportBinaryIssues := { mimaReportBinaryIssues.result.value match { @@ -3071,23 +3071,25 @@ object Build { settings(commonBenchmarkSettings). enablePlugins(JmhPlugin)*/ - /*def asDist(implicit mode: Mode): Project = project. - enablePlugins(UniversalPlugin, RepublishPlugin). - withCommonSettings. - settings(commonDistSettings). - dependsOn( + def asDist: Project = project + .enablePlugins(UniversalPlugin, RepublishPlugin) + .settings(commonBootstrappedSettings) + .settings(commonDistSettings) + .dependsOn( + `scala-library-bootstrapped`, + `scala3-compiler-bootstrapped-new`, `scala3-interfaces`, - dottyCompiler, - dottyLibrary, - tastyCore, - `scala3-staging`, - `scala3-tasty-inspector`, - scaladoc, - `scala3-sbt-bridge`, // for scala-cli - ). - bootstrappedSettings( + `scala3-library-bootstrapped-new`, + `scala3-repl`, + `scala3-sbt-bridge-bootstrapped`, // for scala-cli + `scala3-staging-new`, + `scala3-tasty-inspector-new`, + `scaladoc-new`, + `tasty-core-bootstrapped-new`, + ) + .settings( target := baseDirectory.value / "target" // override setting in commonBootstrappedSettings - )*/ + ) } diff --git a/project/scripts/native-integration/bashTests b/project/scripts/native-integration/bashTests index c71e81ac183b..b99918f798c6 100755 --- a/project/scripts/native-integration/bashTests +++ b/project/scripts/native-integration/bashTests @@ -23,6 +23,7 @@ PROG_HOME="$DIST_DIR/target/universal/stage" SOURCE="$ROOT/tests/pos/HelloWorld.scala" SOURCE_VERSION="$ROOT/project/scripts/native-integration/reportScalaVersion.scala" +SOURCE_TEST_BOOTSTRAPPED="$ROOT/project/scripts/native-integration/testBootstrappedLibrary.scala" clear_cli_dotfiles() { @@ -82,3 +83,15 @@ std_output=$("$PROG_HOME/bin/scala" run "$SOURCE_VERSION" -with-compiler --power test "$SCALA_VERSION" = "$std_output" clear_cli_dotfiles "$ROOT/project/scripts/native-integration" +echo "testing REPL direct invocation with -repl-init-script" +# Use scalac with REPL options to verify REPL functionality +# -repl-init-script runs code on startup, -repl-quit-after-init exits after init +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) +echo "$std_output" | grep -q "REPL_INIT_OK" || die "REPL init script test failed, output: $std_output" +clear_cli_dotfiles "$ROOT" + +echo "testing bootstrapped standard library (scala-library-bootstrapped)" +std_output=$("$PROG_HOME/bin/scala" run "$SOURCE_TEST_BOOTSTRAPPED" --power --offline --server=false) +echo "$std_output" | grep -q "BOOTSTRAPPED_LIBRARY_TEST_PASSED" || die "Bootstrapped library test failed, output: $std_output" +clear_cli_dotfiles "$ROOT/project/scripts/native-integration" + diff --git a/project/scripts/native-integration/testBootstrappedLibrary.scala b/project/scripts/native-integration/testBootstrappedLibrary.scala new file mode 100644 index 000000000000..26e5698b5c08 --- /dev/null +++ b/project/scripts/native-integration/testBootstrappedLibrary.scala @@ -0,0 +1,42 @@ +// Test that the bootstrapped standard library (scala-library-bootstrapped) works correctly +// This verifies the Scala 3 compiled standard library is properly included in the distribution + +@main def testBootstrappedLibrary: Unit = + // ========================================================================== + // CRITICAL TEST: Verify we're using Scala 3 compiled library, not Scala 2.13 + // ========================================================================== + + // Test A: Check scala.util.Properties.versionNumberString + // In Scala 3.8+, this should start with "3." because scala-library is compiled with Scala 3 + // In Scala 3.7.4 and earlier, this was "2.13.x" because scala-library was from Scala 2.13 + val libraryVersion = scala.util.Properties.versionNumberString + assert( + libraryVersion.startsWith("3."), + s"scala-library should be compiled with Scala 3, but got version: $libraryVersion. " + + "This indicates the distribution is using Scala 2.13 compiled library instead of scala-library-bootstrapped." + ) + + // Test B: Verify no Scala 2.13 library JAR is on the classpath + val classpath = System.getProperty("java.class.path", "") + val classpathEntries = classpath.split(java.io.File.pathSeparator).toList + + val scala213Entries = classpathEntries.filter { entry => + val lowerEntry = entry.toLowerCase + // Look for scala-library with 2.13 version pattern + (lowerEntry.contains("scala-library") || lowerEntry.contains("scala_library")) && + lowerEntry.contains("2.13") + } + + assert( + scala213Entries.isEmpty, + s"Found Scala 2.13 library on classpath, which should not happen:\n${scala213Entries.mkString("\n")}\n" + + "The distribution should only include scala-library-bootstrapped (compiled with Scala 3)." + ) + + // Test C: Verify scala3-library is on classpath (the Scala 3 specific additions) + val scala3LibraryEntries = classpathEntries.filter { entry => + entry.toLowerCase.contains("scala3-library") + } + // Note: scala3-library might be merged or named differently, so this is informational + + println("BOOTSTRAPPED_LIBRARY_TEST_PASSED") diff --git a/project/scripts/native-integration/winTests.bat b/project/scripts/native-integration/winTests.bat index 18e406423ebd..ab9d20a0670f 100755 --- a/project/scripts/native-integration/winTests.bat +++ b/project/scripts/native-integration/winTests.bat @@ -4,16 +4,36 @@ setlocal @rem paths are relative to the root project directory set "_PREFIX=dist\win-x86_64\target\universal\stage" set "_SOURCE=tests\pos\HelloWorld.scala" +set "_SOURCE_TEST_BOOTSTRAPPED=project\scripts\native-integration\testBootstrappedLibrary.scala" set "_OUT_DIR=out" @rem if-tests mimic the non-existing bash instruction 'set -e'. call "%_PREFIX%\bin\scalac.bat" "@project\scripts\options" "%_SOURCE%" if not %ERRORLEVEL%==0 endlocal& exit /b 1 +@rem Create output directory (scalac requires it to exist) +if exist "%_OUT_DIR%" rmdir /s /q "%_OUT_DIR%" +mkdir "%_OUT_DIR%" + call "%_PREFIX%\bin\scalac.bat" -d "%_OUT_DIR%" "%_SOURCE%" if not %ERRORLEVEL%==0 endlocal& exit /b 1 call "%_PREFIX%\bin\scala.bat" --power -classpath "%_OUT_DIR%" -M HelloWorld --offline --server=false if not %ERRORLEVEL%==0 endlocal& exit /b 1 +echo testing REPL direct invocation with -repl-init-script +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 +if not %ERRORLEVEL%==0 ( + echo REPL init script test failed: output did not contain REPL_INIT_OK + endlocal& exit /b 1 +) + +echo testing bootstrapped standard library (scala-library-bootstrapped) +call "%_PREFIX%\bin\scala.bat" run "%_SOURCE_TEST_BOOTSTRAPPED%" --power --offline --server=false 2>&1 | findstr /C:"BOOTSTRAPPED_LIBRARY_TEST_PASSED" >nul +if not %ERRORLEVEL%==0 ( + echo Bootstrapped library test failed: output did not contain BOOTSTRAPPED_LIBRARY_TEST_PASSED + endlocal& exit /b 1 +) + +echo All tests passed! endlocal