diff --git a/.github/workflows/stdlib.yaml b/.github/workflows/stdlib.yaml index e8ebfdffc1cc..4d5b3b7a6654 100644 --- a/.github/workflows/stdlib.yaml +++ b/.github/workflows/stdlib.yaml @@ -79,3 +79,20 @@ jobs: - uses: sbt/setup-sbt@v1 - name: Compile `scala3-library-bootstrapped` run: ./project/scripts/sbt scala3-library-bootstrapped-new/compile + + tasty-core-nonbootstrapped: + runs-on: ubuntu-latest + ##needs: [scala3-library-nonbootstrapped] Add when we add support for caching here + steps: + - name: Git Checkout + uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 17 + cache: 'sbt' + - uses: sbt/setup-sbt@v1 + - name: Compile `tasty-core-nonbootstrapped` + run: ./project/scripts/sbt tasty-core-nonbootstrapped/compile diff --git a/build.sbt b/build.sbt index 986b2102e16f..e9d2f20a05c2 100644 --- a/build.sbt +++ b/build.sbt @@ -23,6 +23,7 @@ val `scala2-library-tasty` = Build.`scala2-library-tasty` val `scala2-library-cc` = Build.`scala2-library-cc` val `scala2-library-cc-tasty` = Build.`scala2-library-cc-tasty` val `tasty-core` = Build.`tasty-core` +val `tasty-core-nonbootstrapped` = Build.`tasty-core-nonbootstrapped` val `tasty-core-bootstrapped` = Build.`tasty-core-bootstrapped` val `tasty-core-scala2` = Build.`tasty-core-scala2` val scaladoc = Build.scaladoc diff --git a/project/Build.scala b/project/Build.scala index ebacda4dbb80..710572b98904 100644 --- a/project/Build.scala +++ b/project/Build.scala @@ -1540,6 +1540,54 @@ object Build { target := target.value / "scala3-library-bootstrapped", ) + // ============================================================================================== + // ===================================== TASTY CORE LIBRARY ===================================== + // ============================================================================================== + + /* Configuration of the org.scala-lang:tasty-core_3:*.**.**-nonbootstrapped project */ + lazy val `tasty-core-nonbootstrapped` = project.in(file("tasty")) + .dependsOn(`scala3-library-nonbootstrapped`) + .settings( + name := "tasty-core-nonbootstrapped", + moduleName := "tasty-core", + version := dottyNonBootstrappedVersion, + versionScheme := Some("semver-spec"), + scalaVersion := referenceVersion, // nonbootstrapped artifacts are compiled with the reference compiler (already officially published) + crossPaths := true, // org.scala-lang:tasty-core has a crosspath + // sbt shouldn't add stdlib automatically, we depend on `scala3-library-nonbootstrapped` + autoScalaLibrary := false, + // Add the source directories for the stdlib (non-boostrapped) + Compile / unmanagedSourceDirectories := Seq(baseDirectory.value / "src"), + Compile / unmanagedSourceDirectories += baseDirectory.value / "src-non-bootstrapped", + // Make sure that the produced artifacts have the minimum JVM version in the bytecode + Compile / javacOptions ++= Seq("--target", Versions.minimumJVMVersion), + Compile / scalacOptions ++= Seq("--java-output-version", Versions.minimumJVMVersion), + // Only publish compilation artifacts, no test artifacts + Compile / publishArtifact := true, + Test / publishArtifact := false, + // Do not allow to publish this project for now + publish / skip := true, + // Project specific target folder. sbt doesn't like having two projects using the same target folder + target := target.value / "tasty-core-nonbootstrapped", + // sbt adds all the projects to scala-tool config which breaks building the scalaInstance + // as a workaround, I build it manually by only adding the compiler + scalaInstance := { + val lm = dependencyResolution.value + val log = streams.value.log + val retrieveDir = streams.value.cacheDirectory / "scala3-compiler" / scalaVersion.value + val comp = lm.retrieve("org.scala-lang" % "scala3-compiler_3" % + scalaVersion.value, scalaModuleInfo = None, retrieveDir, log) + .fold(w => throw w.resolveException, identity) + Defaults.makeScalaInstance( + scalaVersion.value, + Array.empty, + comp.toSeq, + Seq.empty, + state.value, + scalaInstanceTopLoader.value, + )}, + ) + def dottyLibrary(implicit mode: Mode): Project = mode match { case NonBootstrapped => `scala3-library` case Bootstrapped => `scala3-library-bootstrapped`