@@ -1647,6 +1647,73 @@ object Build {
16471647 },
16481648 )
16491649
1650+ /* Configuration of the org.scala-lang:scala-library-cc:*.**.**-bootstrapped */
1651+ lazy val `scala-library-cc` = project.in(file("library"))
1652+ .enablePlugins(ScalaLibraryPlugin)
1653+ .settings(
1654+ name := "scala-library-cc",
1655+ moduleName := "scala-library-cc",
1656+ version := dottyVersion,
1657+ versionScheme := Some("semver-spec"),
1658+ // sbt defaults to scala 2.12.x and metals will report issues as it doesn't consider the project a scala 3 project
1659+ // (not the actual version we use to compile the project)
1660+ scalaVersion := referenceVersion,
1661+ crossPaths := true,
1662+ // Add the source directories for the stdlib (non-boostrapped)
1663+ Compile / unmanagedSourceDirectories := Seq(baseDirectory.value / "src"),
1664+ Compile / unmanagedSourceDirectories += baseDirectory.value / "src-bootstrapped",
1665+ // NOTE: The only difference here is that we drop `-Werror` and semanticDB for now
1666+ Compile / scalacOptions := Seq("-deprecation", "-feature", "-unchecked", "-encoding", "UTF8", "-language:implicitConversions"),
1667+ Compile / scalacOptions += "-Yno-stdlib-patches",
1668+ Compile / scalacOptions ++= Seq(
1669+ // Needed so that the library sources are visible when `dotty.tools.dotc.core.Definitions#init` is called
1670+ "-sourcepath", (Compile / sourceDirectories).value.map(_.getCanonicalPath).distinct.mkString(File.pathSeparator),
1671+ ),
1672+ // Make sure that the produced artifacts have the minimum JVM version in the bytecode
1673+ Compile / javacOptions ++= Seq("--target", Versions.minimumJVMVersion),
1674+ Compile / scalacOptions ++= Seq("--java-output-version", Versions.minimumJVMVersion),
1675+ // Packaging configuration of the stdlib
1676+ Compile / packageBin / publishArtifact := true,
1677+ Compile / packageDoc / publishArtifact := false,
1678+ Compile / packageSrc / publishArtifact := true,
1679+ // Only publish compilation artifacts, no test artifacts
1680+ Test / publishArtifact := false,
1681+ // Do not allow to publish this project for now
1682+ publish / skip := false,
1683+ // Project specific target folder. sbt doesn't like having two projects using the same target folder
1684+ target := target.value / "scala-library-cc",
1685+ // we need to have the `scala-library` artifact in the classpath for `ScalaLibraryPlugin` to work
1686+ // this was the only way to not get the artifact evicted by sbt. Even a custom configuration didn't work
1687+ // NOTE: true is the default value, just making things clearer here
1688+ managedScalaInstance := true,
1689+ // Configure the nonbootstrapped compiler
1690+ scalaInstance := {
1691+ val externalCompilerDeps = (`scala3-compiler-nonbootstrapped` / Compile / externalDependencyClasspath).value.map(_.data).toSet
1692+
1693+ // IMPORTANT: We need to use actual jars to form the ScalaInstance and not
1694+ // just directories containing classfiles because sbt maintains a cache of
1695+ // compiler instances. This cache is invalidated based on timestamps
1696+ // however this is only implemented on jars, directories are never
1697+ // invalidated.
1698+ val tastyCore = (`tasty-core-nonbootstrapped` / Compile / packageBin).value
1699+ val scalaLibrary = (`scala-library-nonbootstrapped` / Compile / packageBin).value
1700+ val scala3Interfaces = (`scala3-interfaces` / Compile / packageBin).value
1701+ val scala3Compiler = (`scala3-compiler-nonbootstrapped` / Compile / packageBin).value
1702+
1703+ Defaults.makeScalaInstance(
1704+ dottyNonBootstrappedVersion,
1705+ libraryJars = Array(scalaLibrary),
1706+ allCompilerJars = Seq(tastyCore, scala3Interfaces, scala3Compiler) ++ externalCompilerDeps,
1707+ allDocJars = Seq.empty,
1708+ state.value,
1709+ scalaInstanceTopLoader.value
1710+ )
1711+ },
1712+ scalaCompilerBridgeBinaryJar := {
1713+ Some((`scala3-sbt-bridge-nonbootstrapped` / Compile / packageBin).value)
1714+ },
1715+ )
1716+
16501717 // ==============================================================================================
16511718 // =================================== SCALA STANDARD LIBRARY ===================================
16521719 // ==============================================================================================
0 commit comments