Skip to content

Commit 1148afe

Browse files
authored
Add all remaining non-bootstrapped projects (#23605)
- Add root project `scala3-nonbootstrapped` - Add non-bootstrapped sbt-bridge (`scala3-sbt-bridge-nonbootstrapped`) - Allow publishing the projects such that we can publish them locally to build now the bootstrapped projects.
2 parents e2d23ed + 6199891 commit 1148afe

File tree

3 files changed

+112
-13
lines changed

3 files changed

+112
-13
lines changed

.github/workflows/stdlib.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,20 @@ jobs:
113113
- uses: sbt/setup-sbt@v1
114114
- name: Compile `scala3-compiler-nonbootstrapped`
115115
run: ./project/scripts/sbt scala3-compiler-nonbootstrapped/compile
116+
117+
scala3-sbt-bridge-nonbootstrapped:
118+
runs-on: ubuntu-latest
119+
##needs: [scala3-compiler-nonbootstrapped] Add when we add support for caching here
120+
steps:
121+
- name: Git Checkout
122+
uses: actions/checkout@v4
123+
124+
- name: Set up JDK 17
125+
uses: actions/setup-java@v4
126+
with:
127+
distribution: 'temurin'
128+
java-version: 17
129+
cache: 'sbt'
130+
- uses: sbt/setup-sbt@v1
131+
- name: Compile `scala3-sbt-bridge-nonbootstrapped`
132+
run: ./project/scripts/sbt scala3-sbt-bridge-nonbootstrapped/compile

build.sbt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
val scala3 = Build.scala3
2+
val `scala3-nonbootstrapped` = Build.`scala3-nonbootstrapped`
23
val `scala3-bootstrapped` = Build.`scala3-bootstrapped`
34
val `scala3-interfaces` = Build.`scala3-interfaces`
45
val `scala3-compiler` = Build.`scala3-compiler`
@@ -12,6 +13,7 @@ val `scala3-library` = Build.`scala3-library`
1213
val `scala3-library-bootstrapped` = Build.`scala3-library-bootstrapped`
1314
val `scala3-library-bootstrappedJS` = Build.`scala3-library-bootstrappedJS`
1415
val `scala3-sbt-bridge` = Build.`scala3-sbt-bridge`
16+
val `scala3-sbt-bridge-nonbootstrapped` = Build.`scala3-sbt-bridge-nonbootstrapped`
1517
val `scala3-sbt-bridge-tests` = Build.`scala3-sbt-bridge-tests`
1618
val `scala3-staging` = Build.`scala3-staging`
1719
val `scala3-tasty-inspector` = Build.`scala3-tasty-inspector`

project/Build.scala

Lines changed: 93 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,6 +1363,73 @@ object Build {
13631363
)
13641364
)
13651365

1366+
// ==============================================================================================
1367+
// ================================= NON-BOOTSTRAPPED PROJECTS ==================================
1368+
// ==============================================================================================
1369+
1370+
lazy val `scala3-nonbootstrapped` = project
1371+
.aggregate(`scala3-interfaces`, `scala3-library-nonbootstrapped` , `scala-library-nonbootstrapped`,
1372+
`tasty-core-nonbootstrapped`, `scala3-compiler-nonbootstrapped`, `scala3-sbt-bridge-nonbootstrapped`)
1373+
.settings(
1374+
name := "scala3-nonbootstrapped",
1375+
moduleName := "scala3-nonbootstrapped",
1376+
version := dottyNonBootstrappedVersion,
1377+
// Nothing to be published by this project, it is only an aggregate
1378+
Compile / publishArtifact := false,
1379+
Test / publishArtifact := false,
1380+
// Nothing to be published by this project
1381+
publish / skip := true,
1382+
// Project specific target folder. sbt doesn't like having two projects using the same target folder
1383+
target := target.value / "scala3-nonbootstrapped",
1384+
)
1385+
1386+
/* Configuration of the org.scala-lang:scala3-sbt-bridge:*.**.**-nonbootstrapped project */
1387+
lazy val `scala3-sbt-bridge-nonbootstrapped` = project.in(file("sbt-bridge"))
1388+
.dependsOn(`scala3-compiler-nonbootstrapped`) // TODO: Would this actually evict the reference compiler in scala-tool?
1389+
.settings(
1390+
name := "scala3-sbt-bridge-nonbootstrapped",
1391+
moduleName := "scala3-sbt-bridge",
1392+
version := dottyNonBootstrappedVersion,
1393+
versionScheme := Some("semver-spec"),
1394+
scalaVersion := referenceVersion, // nonbootstrapped artifacts are compiled with the reference compiler (already officially published)
1395+
crossPaths := false, // org.scala-lang:scala3-sbt-bridge doesn't have a crosspath
1396+
autoScalaLibrary := false, // do not add a dependency to stdlib, we depend transitively on the stdlib from `scala3-compiler-nonbootstrapped`
1397+
// Add the source directories for the stdlib (non-boostrapped)
1398+
Compile / unmanagedSourceDirectories := Seq(baseDirectory.value / "src"),
1399+
// NOTE: The only difference here is that we drop `-Werror` and semanticDB for now
1400+
Compile / scalacOptions := Seq("-deprecation", "-feature", "-unchecked", "-encoding", "UTF8", "-language:implicitConversions"),
1401+
// Make sure that the produced artifacts have the minimum JVM version in the bytecode
1402+
Compile / javacOptions ++= Seq("--target", Versions.minimumJVMVersion),
1403+
Compile / scalacOptions ++= Seq("--java-output-version", Versions.minimumJVMVersion),
1404+
// Packaging configuration of the stdlib
1405+
Compile / packageBin / publishArtifact := true,
1406+
Compile / packageDoc / publishArtifact := false,
1407+
Compile / packageSrc / publishArtifact := true,
1408+
// Only publish compilation artifacts, no test artifacts
1409+
Test / publishArtifact := false,
1410+
// non-bootstrapped stdlib is publishable (only locally)
1411+
publish / skip := false,
1412+
// Project specific target folder. sbt doesn't like having two projects using the same target folder
1413+
target := target.value / "scala3-sbt-bridge-nonbootstrapped",
1414+
// sbt adds all the projects to scala-tool config which breaks building the scalaInstance
1415+
// as a workaround, I build it manually by only adding the compiler
1416+
scalaInstance := {
1417+
val lm = dependencyResolution.value
1418+
val log = streams.value.log
1419+
val retrieveDir = streams.value.cacheDirectory / "scala3-compiler" / scalaVersion.value
1420+
val comp = lm.retrieve("org.scala-lang" % "scala3-compiler_3" %
1421+
scalaVersion.value, scalaModuleInfo = None, retrieveDir, log)
1422+
.fold(w => throw w.resolveException, identity)
1423+
Defaults.makeScalaInstance(
1424+
scalaVersion.value,
1425+
Array.empty,
1426+
comp.toSeq,
1427+
Seq.empty,
1428+
state.value,
1429+
scalaInstanceTopLoader.value,
1430+
)},
1431+
)
1432+
13661433
// ==============================================================================================
13671434
// =================================== SCALA STANDARD LIBRARY ===================================
13681435
// ==============================================================================================
@@ -1391,11 +1458,14 @@ object Build {
13911458
// Make sure that the produced artifacts have the minimum JVM version in the bytecode
13921459
Compile / javacOptions ++= Seq("--target", Versions.minimumJVMVersion),
13931460
Compile / scalacOptions ++= Seq("--java-output-version", Versions.minimumJVMVersion),
1461+
// Packaging configuration of the stdlib
1462+
Compile / packageBin / publishArtifact := true,
1463+
Compile / packageDoc / publishArtifact := false,
1464+
Compile / packageSrc / publishArtifact := true,
13941465
// Only publish compilation artifacts, no test artifacts
1395-
Compile / publishArtifact := true,
13961466
Test / publishArtifact := false,
1397-
// Do not allow to publish this project for now
1398-
publish / skip := true,
1467+
// non-bootstrapped stdlib is publishable (only locally)
1468+
publish / skip := false,
13991469
// Project specific target folder. sbt doesn't like having two projects using the same target folder
14001470
target := target.value / "scala-library-nonbootstrapped",
14011471
)
@@ -1426,11 +1496,15 @@ object Build {
14261496
Test / compile := (`scala-library-nonbootstrapped` / Test / compile).value,
14271497
Test / doc := (`scala-library-nonbootstrapped` / Test / doc).value,
14281498
Test / run := (`scala-library-nonbootstrapped` / Test / run).evaluated,
1499+
Test / test := (`scala-library-nonbootstrapped` / Test / test).value,
1500+
// Packaging configuration of the stdlib
1501+
Compile / packageBin / publishArtifact := true,
1502+
Compile / packageDoc / publishArtifact := false,
1503+
Compile / packageSrc / publishArtifact := true,
14291504
// Only publish compilation artifacts, no test artifacts
1430-
Compile / publishArtifact := true,
14311505
Test / publishArtifact := false,
14321506
// Do not allow to publish this project for now
1433-
publish / skip := true,
1507+
publish / skip := false,
14341508
// Project specific target folder. sbt doesn't like having two projects using the same target folder
14351509
target := target.value / "scala3-library-nonbootstrapped",
14361510
)
@@ -1443,7 +1517,7 @@ object Build {
14431517
moduleName := "scala-library",
14441518
version := dottyVersion,
14451519
versionScheme := Some("semver-spec"),
1446-
// sbt defaults to scala 2.12.x and metals will report issues as it doesn't consider the project a scala 3 project
1520+
// sbt defaults to scala 2.12.x and metals will report issues as it doesn't consider the project a scala 3 project
14471521
// (not the actual version we use to compile the project)
14481522
scalaVersion := referenceVersion,
14491523
crossPaths := false, // org.scala-lang:scala-library doesn't have a crosspath
@@ -1511,7 +1585,7 @@ object Build {
15111585
moduleName := "scala3-library",
15121586
version := dottyVersion,
15131587
versionScheme := Some("semver-spec"),
1514-
// sbt defaults to scala 2.12.x and metals will report issues as it doesn't consider the project a scala 3 project
1588+
// sbt defaults to scala 2.12.x and metals will report issues as it doesn't consider the project a scala 3 project
15151589
// (not the actual version we use to compile the project)
15161590
scalaVersion := referenceVersion,
15171591
crossPaths := true, // org.scala-lang:scala3-library has a crosspath
@@ -1562,11 +1636,14 @@ object Build {
15621636
// Make sure that the produced artifacts have the minimum JVM version in the bytecode
15631637
Compile / javacOptions ++= Seq("--target", Versions.minimumJVMVersion),
15641638
Compile / scalacOptions ++= Seq("--java-output-version", Versions.minimumJVMVersion),
1639+
// Packaging configuration of the stdlib
1640+
Compile / packageBin / publishArtifact := true,
1641+
Compile / packageDoc / publishArtifact := false,
1642+
Compile / packageSrc / publishArtifact := true,
15651643
// Only publish compilation artifacts, no test artifacts
1566-
Compile / publishArtifact := true,
15671644
Test / publishArtifact := false,
15681645
// Do not allow to publish this project for now
1569-
publish / skip := true,
1646+
publish / skip := false,
15701647
// Project specific target folder. sbt doesn't like having two projects using the same target folder
15711648
target := target.value / "tasty-core-nonbootstrapped",
15721649
// sbt adds all the projects to scala-tool config which breaks building the scalaInstance
@@ -1575,7 +1652,7 @@ object Build {
15751652
val lm = dependencyResolution.value
15761653
val log = streams.value.log
15771654
val retrieveDir = streams.value.cacheDirectory / "scala3-compiler" / scalaVersion.value
1578-
val comp = lm.retrieve("org.scala-lang" % "scala3-compiler_3" %
1655+
val comp = lm.retrieve("org.scala-lang" % "scala3-compiler_3" %
15791656
scalaVersion.value, scalaModuleInfo = None, retrieveDir, log)
15801657
.fold(w => throw w.resolveException, identity)
15811658
Defaults.makeScalaInstance(
@@ -1623,11 +1700,14 @@ object Build {
16231700
// Make sure that the produced artifacts have the minimum JVM version in the bytecode
16241701
Compile / javacOptions ++= Seq("--target", Versions.minimumJVMVersion),
16251702
Compile / scalacOptions ++= Seq("--java-output-version", Versions.minimumJVMVersion),
1703+
// Packaging configuration of the stdlib
1704+
Compile / packageBin / publishArtifact := true,
1705+
Compile / packageDoc / publishArtifact := false,
1706+
Compile / packageSrc / publishArtifact := true,
16261707
// Only publish compilation artifacts, no test artifacts
1627-
Compile / publishArtifact := true,
16281708
Test / publishArtifact := false,
16291709
// Do not allow to publish this project for now
1630-
publish / skip := true,
1710+
publish / skip := false,
16311711
// Project specific target folder. sbt doesn't like having two projects using the same target folder
16321712
target := target.value / "scala3-compiler-nonbootstrapped",
16331713
// Generate compiler.properties, used by sbt
@@ -1656,7 +1736,7 @@ object Build {
16561736
val lm = dependencyResolution.value
16571737
val log = streams.value.log
16581738
val retrieveDir = streams.value.cacheDirectory / "scala3-compiler" / scalaVersion.value
1659-
val comp = lm.retrieve("org.scala-lang" % "scala3-compiler_3" %
1739+
val comp = lm.retrieve("org.scala-lang" % "scala3-compiler_3" %
16601740
scalaVersion.value, scalaModuleInfo = None, retrieveDir, log)
16611741
.fold(w => throw w.resolveException, identity)
16621742
Defaults.makeScalaInstance(

0 commit comments

Comments
 (0)