@@ -1411,6 +1411,95 @@ object Build {
14111411 )
14121412 )
14131413
1414+  //  ==============================================================================================
1415+  //  =================================== SCALA STANDARD LIBRARY ===================================
1416+  //  ==============================================================================================
1417+ 
1418+  /*  Configuration of the org.scala-lang:scala-library:*.**.**-nonboostrapped project */ 
1419+  lazy  val  `scala-library-nonbootstrapped`  =  project.in(file(" library"  ))
1420+  .settings(
1421+  name :=  " scala-library-nonbootstrapped"  ,
1422+  moduleName :=  " scala-library"  ,
1423+  version :=  dottyNonBootstrappedVersion,
1424+  versionScheme :=  Some (" semver-spec"  ),
1425+  scalaVersion :=  referenceVersion, //  nonbootstrapped artifacts are compiled with the reference compiler (already officially published)
1426+  crossPaths :=  false , //  org.scala-lang:scala-library doesn't have a crosspath
1427+  autoScalaLibrary :=  false , //  do not add a dependency to stdlib
1428+  //  Add the source directories for the stdlib (non-boostrapped)
1429+  Compile  /  unmanagedSourceDirectories :=  Seq (baseDirectory.value /  " src"  ),
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+  ),
1437+  //  Only publish compilation artifacts, no test artifacts
1438+  Compile  /  publishArtifact :=  true ,
1439+  Test  /  publishArtifact :=  false ,
1440+  //  Do not allow to publish this project for now
1441+  publish /  skip :=  true ,
1442+  //  Project specific target folder. sbt doesn't like having two projects using the same target folder
1443+  target :=  target.value /  " scala-library-nonbootstrapped"  ,
1444+  )
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+ 
14141503 def  dottyLibrary (implicit  mode : Mode ):  Project  =  mode match  {
14151504 case  NonBootstrapped  =>  `scala3-library`
14161505 case  Bootstrapped  =>  `scala3-library-bootstrapped`
0 commit comments