Skip to content

Commit 1347174

Browse files
committed
chore: add tasty-core-nonbootstrapped
1 parent 3f2b12f commit 1347174

File tree

3 files changed

+66
-0
lines changed

3 files changed

+66
-0
lines changed

.github/workflows/stdlib.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,20 @@ jobs:
7979
- uses: sbt/setup-sbt@v1
8080
- name: Compile `scala3-library-bootstrapped`
8181
run: ./project/scripts/sbt scala3-library-bootstrapped-new/compile
82+
83+
tasty-core-nonbootstrapped:
84+
runs-on: ubuntu-latest
85+
##needs: [scala3-library-nonbootstrapped] Add when we add support for caching here
86+
steps:
87+
- name: Git Checkout
88+
uses: actions/checkout@v4
89+
90+
- name: Set up JDK 17
91+
uses: actions/setup-java@v4
92+
with:
93+
distribution: 'temurin'
94+
java-version: 17
95+
cache: 'sbt'
96+
- uses: sbt/setup-sbt@v1
97+
- name: Compile `tasty-core-nonbootstrapped`
98+
run: ./project/scripts/sbt tasty-core-nonbootstrapped/compile

build.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ val `scala2-library-tasty` = Build.`scala2-library-tasty`
2323
val `scala2-library-cc` = Build.`scala2-library-cc`
2424
val `scala2-library-cc-tasty` = Build.`scala2-library-cc-tasty`
2525
val `tasty-core` = Build.`tasty-core`
26+
val `tasty-core-nonbootstrapped` = Build.`tasty-core-nonbootstrapped`
2627
val `tasty-core-bootstrapped` = Build.`tasty-core-bootstrapped`
2728
val `tasty-core-scala2` = Build.`tasty-core-scala2`
2829
val scaladoc = Build.scaladoc

project/Build.scala

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,6 +1540,54 @@ object Build {
15401540
target := target.value / "scala3-library-bootstrapped",
15411541
)
15421542

1543+
// ==============================================================================================
1544+
// ===================================== TASTY CORE LIBRARY =====================================
1545+
// ==============================================================================================
1546+
1547+
/* Configuration of the org.scala-lang:tasty-core_3:*.**.**-nonbootstrapped project */
1548+
lazy val `tasty-core-nonbootstrapped` = project.in(file("tasty"))
1549+
.dependsOn(`scala3-library-nonbootstrapped`)
1550+
.settings(
1551+
name := "tasty-core-nonbootstrapped",
1552+
moduleName := "tasty-core",
1553+
version := dottyNonBootstrappedVersion,
1554+
versionScheme := Some("semver-spec"),
1555+
scalaVersion := referenceVersion, // nonbootstrapped artifacts are compiled with the reference compiler (already officially published)
1556+
crossPaths := true, // org.scala-lang:tasty-core has a crosspath
1557+
// sbt shouldn't add stdlib automatically, we depend on `scala3-library-nonbootstrapped`
1558+
autoScalaLibrary := false,
1559+
// Add the source directories for the stdlib (non-boostrapped)
1560+
Compile / unmanagedSourceDirectories := Seq(baseDirectory.value / "src"),
1561+
Compile / unmanagedSourceDirectories += baseDirectory.value / "src-non-bootstrapped",
1562+
// Make sure that the produced artifacts have the minimum JVM version in the bytecode
1563+
Compile / javacOptions ++= Seq("--target", Versions.minimumJVMVersion),
1564+
Compile / scalacOptions ++= Seq("--java-output-version", Versions.minimumJVMVersion),
1565+
// Only publish compilation artifacts, no test artifacts
1566+
Compile / publishArtifact := true,
1567+
Test / publishArtifact := false,
1568+
// Do not allow to publish this project for now
1569+
publish / skip := true,
1570+
// Project specific target folder. sbt doesn't like having two projects using the same target folder
1571+
target := target.value / "tasty-core-nonbootstrapped",
1572+
// sbt adds all the projects to scala-tool config which breaks building the scalaInstance
1573+
// as a workaround, I build it manually by only adding the compiler
1574+
scalaInstance := {
1575+
val lm = dependencyResolution.value
1576+
val log = streams.value.log
1577+
val retrieveDir = streams.value.cacheDirectory / "scala3-compiler" / scalaVersion.value
1578+
val comp = lm.retrieve("org.scala-lang" % "scala3-compiler_3" %
1579+
scalaVersion.value, scalaModuleInfo = None, retrieveDir, log)
1580+
.fold(w => throw w.resolveException, identity)
1581+
Defaults.makeScalaInstance(
1582+
scalaVersion.value,
1583+
Array.empty,
1584+
comp.toSeq,
1585+
Seq.empty,
1586+
state.value,
1587+
scalaInstanceTopLoader.value,
1588+
)},
1589+
)
1590+
15431591
def dottyLibrary(implicit mode: Mode): Project = mode match {
15441592
case NonBootstrapped => `scala3-library`
15451593
case Bootstrapped => `scala3-library-bootstrapped`

0 commit comments

Comments
 (0)