@@ -1424,11 +1424,16 @@ object Build {
1424
1424
versionScheme := Some (" semver-spec" ),
1425
1425
scalaVersion := referenceVersion, // nonbootstrapped artifacts are compiled with the reference compiler (already officially published)
1426
1426
crossPaths := false , // org.scala-lang:scala-library doesn't have a crosspath
1427
- // NOTE: The only difference here is that we drop `-Werror` and semanticDB for now
1428
- Compile / scalacOptions := Seq (" -deprecation" , " -feature" , " -unchecked" , " -encoding" , " UTF8" , " -language:implicitConversions" ),
1427
+ autoScalaLibrary := false , // do not add a dependency to stdlib
1429
1428
// Add the source directories for the stdlib (non-boostrapped)
1430
1429
Compile / unmanagedSourceDirectories := Seq (baseDirectory.value / " src" ),
1431
1430
Compile / unmanagedSourceDirectories += baseDirectory.value / " src-non-bootstrapped" ,
1431
+ // NOTE: The only difference here is that we drop `-Werror` and semanticDB for now
1432
+ Compile / scalacOptions := Seq (" -deprecation" , " -feature" , " -unchecked" , " -encoding" , " UTF8" , " -language:implicitConversions" ),
1433
+ (Compile / scalacOptions) ++= Seq (
1434
+ // Needed so that the library sources are visible when `dotty.tools.dotc.core.Definitions#init` is called
1435
+ " -sourcepath" , (Compile / sourceDirectories).value.map(_.getCanonicalPath).distinct.mkString(File .pathSeparator),
1436
+ ),
1432
1437
// Only publish compilation artifacts, no test artifacts
1433
1438
Compile / publishArtifact := true ,
1434
1439
Test / publishArtifact := false ,
@@ -1438,6 +1443,63 @@ object Build {
1438
1443
target := target.value / " scala-library-nonbootstrapped" ,
1439
1444
)
1440
1445
1446
+ /* Configuration of the org.scala-lang:scala-library:*.**.**-boostrapped project */
1447
+ lazy val `scala-library-bootstrapped` = project.in(file(" library" ))
1448
+ .settings(
1449
+ name := " scala-library-bootstrapped" ,
1450
+ moduleName := " scala-library" ,
1451
+ version := dottyVersion,
1452
+ versionScheme := Some (" semver-spec" ),
1453
+ crossPaths := false , // org.scala-lang:scala-library doesn't have a crosspath
1454
+ // Add the source directories for the stdlib (non-boostrapped)
1455
+ Compile / unmanagedSourceDirectories := Seq (baseDirectory.value / " src" ),
1456
+ Compile / unmanagedSourceDirectories += baseDirectory.value / " src-bootstrapped" ,
1457
+ // NOTE: The only difference here is that we drop `-Werror` and semanticDB for now
1458
+ Compile / scalacOptions := Seq (" -deprecation" , " -feature" , " -unchecked" , " -encoding" , " UTF8" , " -language:implicitConversions" ),
1459
+ Compile / scalacOptions ++= Seq (
1460
+ // Needed so that the library sources are visible when `dotty.tools.dotc.core.Definitions#init` is called
1461
+ " -sourcepath" , (Compile / sourceDirectories).value.map(_.getCanonicalPath).distinct.mkString(File .pathSeparator),
1462
+ ),
1463
+ // Only publish compilation artifacts, no test artifacts
1464
+ Compile / publishArtifact := true ,
1465
+ Test / publishArtifact := false ,
1466
+ // Do not allow to publish this project for now
1467
+ publish / skip := true ,
1468
+ // Project specific target folder. sbt doesn't like having two projects using the same target folder
1469
+ target := target.value / " scala-library-bootstrapped" ,
1470
+ // Configure the nonbootstrapped compiler
1471
+ managedScalaInstance := false ,
1472
+ scalaInstance := {
1473
+ val externalLibraryDeps = (`scala3-library` / Compile / externalDependencyClasspath).value.map(_.data).toSet
1474
+ val externalCompilerDeps = (`scala3-compiler` / Compile / externalDependencyClasspath).value.map(_.data).toSet
1475
+
1476
+ // IMPORTANT: We need to use actual jars to form the ScalaInstance and not
1477
+ // just directories containing classfiles because sbt maintains a cache of
1478
+ // compiler instances. This cache is invalidated based on timestamps
1479
+ // however this is only implemented on jars, directories are never
1480
+ // invalidated.
1481
+ val tastyCore = (`tasty-core` / Compile / packageBin).value
1482
+ val scala3Library = (`scala3-library` / Compile / packageBin).value
1483
+ val scala3Interfaces = (`scala3-interfaces` / Compile / packageBin).value
1484
+ val scala3Compiler = (`scala3-compiler` / Compile / packageBin).value
1485
+
1486
+ val libraryJars = Array (scala3Library) ++ externalLibraryDeps
1487
+ val compilerJars = Seq (tastyCore, scala3Interfaces, scala3Compiler) ++ (externalCompilerDeps -- externalLibraryDeps)
1488
+
1489
+ Defaults .makeScalaInstance(
1490
+ scalaVersion.value,
1491
+ libraryJars = libraryJars,
1492
+ allCompilerJars = compilerJars,
1493
+ allDocJars = Seq .empty,
1494
+ state.value,
1495
+ scalaInstanceTopLoader.value
1496
+ )
1497
+ },
1498
+ scalaCompilerBridgeBinaryJar := {
1499
+ Some ((`scala3-sbt-bridge` / Compile / packageBin).value)
1500
+ },
1501
+ )
1502
+
1441
1503
def dottyLibrary (implicit mode : Mode ): Project = mode match {
1442
1504
case NonBootstrapped => `scala3-library`
1443
1505
case Bootstrapped => `scala3-library-bootstrapped`
0 commit comments