Skip to content

Commit 6199891

Browse files
committed
chore: add scala3-sbt-bridge-nonbootstrapped to the new build
1 parent 7d65adf commit 6199891

File tree

3 files changed

+66
-1
lines changed

3 files changed

+66
-1
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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ val `scala3-library` = Build.`scala3-library`
1313
val `scala3-library-bootstrapped` = Build.`scala3-library-bootstrapped`
1414
val `scala3-library-bootstrappedJS` = Build.`scala3-library-bootstrappedJS`
1515
val `scala3-sbt-bridge` = Build.`scala3-sbt-bridge`
16+
val `scala3-sbt-bridge-nonbootstrapped` = Build.`scala3-sbt-bridge-nonbootstrapped`
1617
val `scala3-sbt-bridge-tests` = Build.`scala3-sbt-bridge-tests`
1718
val `scala3-staging` = Build.`scala3-staging`
1819
val `scala3-tasty-inspector` = Build.`scala3-tasty-inspector`

project/Build.scala

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1369,7 +1369,7 @@ object Build {
13691369

13701370
lazy val `scala3-nonbootstrapped` = project
13711371
.aggregate(`scala3-interfaces`, `scala3-library-nonbootstrapped` , `scala-library-nonbootstrapped`,
1372-
`tasty-core-nonbootstrapped`, `scala3-compiler-nonbootstrapped`)
1372+
`tasty-core-nonbootstrapped`, `scala3-compiler-nonbootstrapped`, `scala3-sbt-bridge-nonbootstrapped`)
13731373
.settings(
13741374
name := "scala3-nonbootstrapped",
13751375
moduleName := "scala3-nonbootstrapped",
@@ -1383,6 +1383,53 @@ object Build {
13831383
target := target.value / "scala3-nonbootstrapped",
13841384
)
13851385

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+
13861433
// ==============================================================================================
13871434
// =================================== SCALA STANDARD LIBRARY ===================================
13881435
// ==============================================================================================

0 commit comments

Comments
 (0)