Skip to content

Commit 2f3878f

Browse files
committed
chore: add tasty-core-bootstrapped to the new build
1 parent 8214533 commit 2f3878f

File tree

3 files changed

+74
-0
lines changed

3 files changed

+74
-0
lines changed

.github/workflows/stdlib.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,20 @@ jobs:
131131
- uses: sbt/setup-sbt@v1
132132
- name: Compile `scala3-sbt-bridge-nonbootstrapped`
133133
run: ./project/scripts/sbt scala3-sbt-bridge-nonbootstrapped/compile
134+
135+
tasty-core-bootstrapped:
136+
runs-on: ubuntu-latest
137+
##needs: [scala3-library-bootstrapped] Add when we add support for caching here
138+
steps:
139+
- name: Git Checkout
140+
uses: actions/checkout@v4
141+
142+
- name: Set up JDK 17
143+
uses: actions/setup-java@v4
144+
with:
145+
distribution: 'temurin'
146+
java-version: 17
147+
cache: 'sbt'
148+
- uses: sbt/setup-sbt@v1
149+
- name: Compile `tasty-core-bootstrapped`
150+
run: ./project/scripts/sbt tasty-core-bootstrapped-new/compile

build.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ val `scala2-library-cc` = Build.`scala2-library-cc`
2727
val `scala2-library-cc-tasty` = Build.`scala2-library-cc-tasty`
2828
val `tasty-core` = Build.`tasty-core`
2929
val `tasty-core-nonbootstrapped` = Build.`tasty-core-nonbootstrapped`
30+
val `tasty-core-bootstrapped-new` = Build.`tasty-core-bootstrapped-new`
3031
val `tasty-core-bootstrapped` = Build.`tasty-core-bootstrapped`
3132
val `tasty-core-scala2` = Build.`tasty-core-scala2`
3233
val scaladoc = Build.scaladoc

project/Build.scala

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1662,6 +1662,62 @@ object Build {
16621662
)},
16631663
)
16641664

1665+
/* Configuration of the org.scala-lang:tasty-core_3:*.**.**-bootstrapped project */
1666+
lazy val `tasty-core-bootstrapped-new` = project.in(file("tasty"))
1667+
.dependsOn(`scala3-library-bootstrapped`)
1668+
.settings(
1669+
name := "tasty-core-bootstrapped",
1670+
moduleName := "tasty-core",
1671+
version := dottyVersion,
1672+
versionScheme := Some("semver-spec"),
1673+
scalaVersion := dottyNonBootstrappedVersion, // nonbootstrapped artifacts are compiled with the reference compiler (already officially published)
1674+
crossPaths := true, // org.scala-lang:tasty-core has a crosspath
1675+
// sbt shouldn't add stdlib automatically, we depend on `scala3-library-nonbootstrapped`
1676+
autoScalaLibrary := false,
1677+
// Add the source directories for the stdlib (non-boostrapped)
1678+
Compile / unmanagedSourceDirectories := Seq(baseDirectory.value / "src"),
1679+
Compile / unmanagedSourceDirectories += baseDirectory.value / "src-bootstrapped",
1680+
// Make sure that the produced artifacts have the minimum JVM version in the bytecode
1681+
Compile / javacOptions ++= Seq("--target", Versions.minimumJVMVersion),
1682+
Compile / scalacOptions ++= Seq("--java-output-version", Versions.minimumJVMVersion),
1683+
// Packaging configuration of the stdlib
1684+
Compile / packageBin / publishArtifact := true,
1685+
Compile / packageDoc / publishArtifact := false,
1686+
Compile / packageSrc / publishArtifact := true,
1687+
// Only publish compilation artifacts, no test artifacts
1688+
Test / publishArtifact := false,
1689+
// Do not allow to publish this project for now
1690+
publish / skip := false,
1691+
// Project specific target folder. sbt doesn't like having two projects using the same target folder
1692+
target := target.value / "tasty-core-bootstrapped",
1693+
// Configure to use the non-bootstrapped compiler
1694+
scalaInstance := {
1695+
val externalCompilerDeps = (`scala3-compiler-nonbootstrapped` / Compile / externalDependencyClasspath).value.map(_.data).toSet
1696+
1697+
// IMPORTANT: We need to use actual jars to form the ScalaInstance and not
1698+
// just directories containing classfiles because sbt maintains a cache of
1699+
// compiler instances. This cache is invalidated based on timestamps
1700+
// however this is only implemented on jars, directories are never
1701+
// invalidated.
1702+
val tastyCore = (`tasty-core-nonbootstrapped` / Compile / packageBin).value
1703+
val scalaLibrary = (`scala-library-nonbootstrapped` / Compile / packageBin).value
1704+
val scala3Interfaces = (`scala3-interfaces` / Compile / packageBin).value
1705+
val scala3Compiler = (`scala3-compiler-nonbootstrapped` / Compile / packageBin).value
1706+
1707+
Defaults.makeScalaInstance(
1708+
dottyNonBootstrappedVersion,
1709+
libraryJars = Array(scalaLibrary),
1710+
allCompilerJars = Seq(tastyCore, scala3Interfaces, scala3Compiler) ++ externalCompilerDeps,
1711+
allDocJars = Seq.empty,
1712+
state.value,
1713+
scalaInstanceTopLoader.value
1714+
)
1715+
},
1716+
scalaCompilerBridgeBinaryJar := {
1717+
Some((`scala3-sbt-bridge-nonbootstrapped` / Compile / packageBin).value)
1718+
},
1719+
)
1720+
16651721
// ==============================================================================================
16661722
// ======================================= SCALA COMPILER =======================================
16671723
// ==============================================================================================

0 commit comments

Comments
 (0)