Skip to content

chore: add scala3-staging and scala3-tasty-inspector to the new build #23624

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/stdlib.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,42 @@ jobs:
- name: Compile `scala3-sbt-bridge-bootstrapped`
run: ./project/scripts/sbt scala3-sbt-bridge-bootstrapped/compile

scala3-staging:
runs-on: ubuntu-latest
##needs: [scala3-compiler-bootstrapped] 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 `scala3-staging`
run: ./project/scripts/sbt scala3-staging-new/compile

scala3-tasty-inspector:
runs-on: ubuntu-latest
##needs: [scala3-compiler-bootstrapped] 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 `scala3-staging`
run: ./project/scripts/sbt scala3-staging-new/compile
- name: Compile `scala3-tasty-inspector`
run: ./project/scripts/sbt scala3-tasty-inspector-new/compile

#################################################################################################
########################################### TEST JOBS ###########################################
#################################################################################################
Expand Down
2 changes: 2 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ val `scala3-sbt-bridge-bootstrapped` = Build.`scala3-sbt-bridge-bootstrapped`
val `scala3-sbt-bridge-nonbootstrapped` = Build.`scala3-sbt-bridge-nonbootstrapped`
val `scala3-sbt-bridge-tests` = Build.`scala3-sbt-bridge-tests`
val `scala3-staging` = Build.`scala3-staging`
val `scala3-staging-new` = Build.`scala3-staging-new`
val `scala3-tasty-inspector` = Build.`scala3-tasty-inspector`
val `scala3-tasty-inspector-new` = Build.`scala3-tasty-inspector-new`
val `scala3-language-server` = Build.`scala3-language-server`
val `scala3-bench` = Build.`scala3-bench`
val `scala3-bench-bootstrapped` = Build.`scala3-bench-bootstrapped`
Expand Down
118 changes: 116 additions & 2 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1450,7 +1450,8 @@ object Build {

lazy val `scala3-bootstrapped-new` = project
.aggregate(`scala3-interfaces`, `scala3-library-bootstrapped-new` , `scala-library-bootstrapped`,
`tasty-core-bootstrapped-new`, `scala3-compiler-bootstrapped-new`, `scala3-sbt-bridge-bootstrapped`)
`tasty-core-bootstrapped-new`, `scala3-compiler-bootstrapped-new`, `scala3-sbt-bridge-bootstrapped`,
`scala3-staging-new`, `scala3-tasty-inspector-new`)
.settings(
name := "scala3-bootstrapped",
moduleName := "scala3-bootstrapped",
Expand Down Expand Up @@ -1494,7 +1495,6 @@ object Build {
"org.scala-lang" % "scala-reflect",
"org.scala-lang" % "scala-compiler",
),
//
// Packaging configuration of `scala3-sbt-bridge`
Compile / packageBin / publishArtifact := true,
Compile / packageDoc / publishArtifact := false,
Expand Down Expand Up @@ -1533,6 +1533,120 @@ object Build {
},
)

/* Configuration of the org.scala-lang:scala3-staging:*.**.**-bootstrapped project */
lazy val `scala3-staging-new` = project.in(file("staging"))
// We want the compiler to be present in the compiler classpath when compiling this project but not
// when compiling a project that depends on scala3-staging (see sbt-test/sbt-dotty/quoted-example-project),
// but we always need it to be present on the JVM classpath at runtime.
.dependsOn(`scala3-compiler-bootstrapped-new` % "provided; compile->runtime; test->test")
.settings(
name := "scala3-staging",
moduleName := "scala3-staging",
version := dottyVersion,
versionScheme := Some("semver-spec"),
scalaVersion := referenceVersion,
crossPaths := true, // org.scala-lang:scala3-staging has a crosspath
autoScalaLibrary := false, // do not add a dependency to stdlib, we depend transitively on the stdlib from `scala3-compiler-bootstrapped`
// Add the source directories for the sbt-bridge (boostrapped)
Compile / unmanagedSourceDirectories := Seq(baseDirectory.value / "src"),
Test / unmanagedSourceDirectories := Seq(baseDirectory.value / "test"),
// NOTE: The only difference here is that we drop `-Werror` and semanticDB for now
Compile / scalacOptions := Seq("-deprecation", "-feature", "-unchecked", "-encoding", "UTF8", "-language:implicitConversions"),
// 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),
// Packaging configuration of `scala3-staging`
Compile / packageBin / publishArtifact := true,
Compile / packageDoc / publishArtifact := false,
Compile / packageSrc / publishArtifact := true,
// Only publish compilation artifacts, no test artifacts
Test / publishArtifact := false,
publish / skip := false,
// Configure to use the non-bootstrapped compiler
scalaInstance := {
val externalCompilerDeps = (`scala3-compiler-nonbootstrapped` / Compile / externalDependencyClasspath).value.map(_.data).toSet

// IMPORTANT: We need to use actual jars to form the ScalaInstance and not
// just directories containing classfiles because sbt maintains a cache of
// compiler instances. This cache is invalidated based on timestamps
// however this is only implemented on jars, directories are never
// invalidated.
val tastyCore = (`tasty-core-nonbootstrapped` / Compile / packageBin).value
val scalaLibrary = (`scala-library-nonbootstrapped` / Compile / packageBin).value
val scala3Interfaces = (`scala3-interfaces` / Compile / packageBin).value
val scala3Compiler = (`scala3-compiler-nonbootstrapped` / Compile / packageBin).value

Defaults.makeScalaInstance(
dottyNonBootstrappedVersion,
libraryJars = Array(scalaLibrary),
allCompilerJars = Seq(tastyCore, scala3Interfaces, scala3Compiler) ++ externalCompilerDeps,
allDocJars = Seq.empty,
state.value,
scalaInstanceTopLoader.value
)
},
scalaCompilerBridgeBinaryJar := {
Some((`scala3-sbt-bridge-nonbootstrapped` / Compile / packageBin).value)
},
)

/* Configuration of the org.scala-lang:scala3-tasty-inspector:*.**.**-bootstrapped project */
lazy val `scala3-tasty-inspector-new` = project.in(file("tasty-inspector"))
// We want the compiler to be present in the compiler classpath when compiling this project but not
// when compiling a project that depends on scala3-tasty-inspector (see sbt-test/sbt-dotty/tasty-inspector-example-project),
// but we always need it to be present on the JVM classpath at runtime.
.dependsOn(`scala3-compiler-bootstrapped-new` % "provided; compile->runtime; test->test")
.settings(
name := "scala3-tasty-inspector",
moduleName := "scala3-tasty-inspector",
version := dottyVersion,
versionScheme := Some("semver-spec"),
scalaVersion := referenceVersion,
crossPaths := true, // org.scala-lang:scala3-tasty-inspector has a crosspath
autoScalaLibrary := false, // do not add a dependency to stdlib, we depend transitively on the stdlib from `scala3-compiler-bootstrapped`
// Add the source directories for the sbt-bridge (boostrapped)
Compile / unmanagedSourceDirectories := Seq(baseDirectory.value / "src"),
Test / unmanagedSourceDirectories := Seq(baseDirectory.value / "test"),
// NOTE: The only difference here is that we drop `-Werror` and semanticDB for now
Compile / scalacOptions := Seq("-deprecation", "-feature", "-unchecked", "-encoding", "UTF8", "-language:implicitConversions"),
// 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),
// Packaging configuration of `scala3-staging`
Compile / packageBin / publishArtifact := true,
Compile / packageDoc / publishArtifact := false,
Compile / packageSrc / publishArtifact := true,
// Only publish compilation artifacts, no test artifacts
Test / publishArtifact := false,
publish / skip := false,
// Configure to use the non-bootstrapped compiler
scalaInstance := {
val externalCompilerDeps = (`scala3-compiler-nonbootstrapped` / Compile / externalDependencyClasspath).value.map(_.data).toSet

// IMPORTANT: We need to use actual jars to form the ScalaInstance and not
// just directories containing classfiles because sbt maintains a cache of
// compiler instances. This cache is invalidated based on timestamps
// however this is only implemented on jars, directories are never
// invalidated.
val tastyCore = (`tasty-core-nonbootstrapped` / Compile / packageBin).value
val scalaLibrary = (`scala-library-nonbootstrapped` / Compile / packageBin).value
val scala3Interfaces = (`scala3-interfaces` / Compile / packageBin).value
val scala3Compiler = (`scala3-compiler-nonbootstrapped` / Compile / packageBin).value

Defaults.makeScalaInstance(
dottyNonBootstrappedVersion,
libraryJars = Array(scalaLibrary),
allCompilerJars = Seq(tastyCore, scala3Interfaces, scala3Compiler) ++ externalCompilerDeps,
allDocJars = Seq.empty,
state.value,
scalaInstanceTopLoader.value
)
},
scalaCompilerBridgeBinaryJar := {
Some((`scala3-sbt-bridge-nonbootstrapped` / Compile / packageBin).value)
},
)

// ==============================================================================================
// =================================== SCALA STANDARD LIBRARY ===================================
// ==============================================================================================
Expand Down
Loading