@@ -1431,6 +1431,67 @@ object Build {
14311431 )},
14321432 )
14331433
1434+ // ==============================================================================================
1435+ // =================================== BOOTSTRAPPED PROJECTS ====================================
1436+ // ==============================================================================================
1437+
1438+ /* Configuration of the org.scala-lang:scala3-sbt-bridge:*.**.**-bootstrapped project */
1439+ lazy val `scala3-sbt-bridge-bootstrapped` = project.in(file(" sbt-bridge" ))
1440+ .dependsOn(`scala3-compiler-bootstrapped`) // TODO: Would this actually evict the reference compiler in scala-tool?
1441+ .settings(
1442+ name := " scala3-sbt-bridge-bootstrapped" ,
1443+ moduleName := " scala3-sbt-bridge" ,
1444+ version := dottyVersion,
1445+ versionScheme := Some (" semver-spec" ),
1446+ scalaVersion := referenceVersion, // nonbootstrapped artifacts are compiled with the reference compiler (already officially published)
1447+ crossPaths := false , // org.scala-lang:scala3-sbt-bridge doesn't have a crosspath
1448+ autoScalaLibrary := false , // do not add a dependency to stdlib, we depend transitively on the stdlib from `scala3-compiler-nonbootstrapped`
1449+ // Add the source directories for the stdlib (non-boostrapped)
1450+ Compile / unmanagedSourceDirectories := Seq (baseDirectory.value / " src" ),
1451+ Compile / resourceDirectory := baseDirectory.value / " resources" ,
1452+ // NOTE: The only difference here is that we drop `-Werror` and semanticDB for now
1453+ Compile / scalacOptions := Seq (" -deprecation" , " -feature" , " -unchecked" , " -encoding" , " UTF8" , " -language:implicitConversions" ),
1454+ // Make sure that the produced artifacts have the minimum JVM version in the bytecode
1455+ Compile / javacOptions ++= Seq (" --target" , Versions .minimumJVMVersion),
1456+ Compile / scalacOptions ++= Seq (" --java-output-version" , Versions .minimumJVMVersion),
1457+ // Packaging configuration of the stdlib
1458+ Compile / packageBin / publishArtifact := true ,
1459+ Compile / packageDoc / publishArtifact := false ,
1460+ Compile / packageSrc / publishArtifact := true ,
1461+ // Only publish compilation artifacts, no test artifacts
1462+ Test / publishArtifact := false ,
1463+ // non-bootstrapped stdlib is publishable (only locally)
1464+ publish / skip := false ,
1465+ // Project specific target folder. sbt doesn't like having two projects using the same target folder
1466+ target := target.value / " scala3-sbt-bridge-bootstrapped" ,
1467+ // Configure to use the non-bootstrapped compiler
1468+ scalaInstance := {
1469+ val externalCompilerDeps = (`scala3-compiler-nonbootstrapped` / Compile / externalDependencyClasspath).value.map(_.data).toSet
1470+
1471+ // IMPORTANT: We need to use actual jars to form the ScalaInstance and not
1472+ // just directories containing classfiles because sbt maintains a cache of
1473+ // compiler instances. This cache is invalidated based on timestamps
1474+ // however this is only implemented on jars, directories are never
1475+ // invalidated.
1476+ val tastyCore = (`tasty-core-nonbootstrapped` / Compile / packageBin).value
1477+ val scalaLibrary = (`scala-library-nonbootstrapped` / Compile / packageBin).value
1478+ val scala3Interfaces = (`scala3-interfaces` / Compile / packageBin).value
1479+ val scala3Compiler = (`scala3-compiler-nonbootstrapped` / Compile / packageBin).value
1480+
1481+ Defaults .makeScalaInstance(
1482+ dottyNonBootstrappedVersion,
1483+ libraryJars = Array (scalaLibrary),
1484+ allCompilerJars = Seq (tastyCore, scala3Interfaces, scala3Compiler) ++ externalCompilerDeps,
1485+ allDocJars = Seq .empty,
1486+ state.value,
1487+ scalaInstanceTopLoader.value
1488+ )
1489+ },
1490+ scalaCompilerBridgeBinaryJar := {
1491+ Some ((`scala3-sbt-bridge-nonbootstrapped` / Compile / packageBin).value)
1492+ },
1493+ )
1494+
14341495 // ==============================================================================================
14351496 // =================================== SCALA STANDARD LIBRARY ===================================
14361497 // ==============================================================================================
0 commit comments