@@ -841,6 +841,16 @@ object Build {
841
841
settings(
842
842
moduleName := " scala-library" ,
843
843
javaOptions := (javaOptions in `scala3-compiler-bootstrapped`).value,
844
+ Compile / scalacOptions += " -Yerased-terms" ,
845
+ Compile / scalacOptions ++= {
846
+ Seq (
847
+ " -sourcepath" ,
848
+ Seq (
849
+ (Compile / sourceManaged).value / " scala-library-src" ,
850
+ (Compile / sourceManaged).value / " dotty-library-src" ,
851
+ ).mkString(File .pathSeparator),
852
+ )
853
+ },
844
854
scalacOptions -= " -Xfatal-warnings" ,
845
855
ivyConfigurations += SourceDeps .hide,
846
856
transitiveClassifiers := Seq (" sources" ),
@@ -870,6 +880,30 @@ object Build {
870
880
((trgDir ** " *.scala" ) +++ (trgDir ** " *.java" )).get.toSet
871
881
} (Set (scalaLibrarySourcesJar)).toSeq
872
882
}.taskValue,
883
+ sourceGenerators in Compile += Def .task {
884
+ val s = streams.value
885
+ val cacheDir = s.cacheDirectory
886
+ val trgDir = (sourceManaged in Compile ).value / " dotty-library-src"
887
+
888
+ // NOTE `sourceDirectory` is used for actual copying,
889
+ // but `sources` are used as cache keys
890
+ val dottyLibSourceDir = (`scala3-library-bootstrapped`/ sourceDirectory).value
891
+ val dottyLibSources = (`scala3-library-bootstrapped`/ Compile / sources).value
892
+
893
+ val cachedFun = FileFunction .cached(
894
+ cacheDir / s " copyDottyLibrarySrc " ,
895
+ FilesInfo .lastModified,
896
+ FilesInfo .exists,
897
+ ) { _ =>
898
+ s.log.info(s " Copying scala3-library sources from $dottyLibSourceDir to $trgDir... " )
899
+ if (trgDir.exists) IO .delete(trgDir)
900
+ IO .copyDirectory(dottyLibSourceDir, trgDir)
901
+
902
+ ((trgDir ** " *.scala" ) +++ (trgDir ** " *.java" )).get.toSet
903
+ }
904
+
905
+ cachedFun(dottyLibSources.toSet).toSeq
906
+ }.taskValue,
873
907
sources in Compile ~= (_.filterNot(file =>
874
908
// sources from https://github.com/scala/scala/tree/2.13.x/src/library-aux
875
909
file.getPath.endsWith(" scala-library-src/scala/Any.scala" ) ||
@@ -1489,7 +1523,7 @@ object Build {
1489
1523
}
1490
1524
1491
1525
def joinProducts (products : Seq [java.io.File ]): String =
1492
- products.iterator.map(_.getAbsolutePath.toString).mkString(java.io. File .pathSeparator )
1526
+ products.iterator.map(_.getAbsolutePath.toString).mkString(" " )
1493
1527
1494
1528
val dokkaVersion = " 1.4.10.2"
1495
1529
@@ -1537,7 +1571,7 @@ object Build {
1537
1571
(`scala3-library-bootstrapped`/ Compile / products).value,
1538
1572
).flatten
1539
1573
1540
- val roots = dottyJars.mkString( " " )
1574
+ val roots = joinProducts(dottyJars )
1541
1575
1542
1576
if (dottyJars.isEmpty) Def .task { streams.value.log.error(" Dotty lib wasn't found" ) }
1543
1577
else Def .task{
@@ -1554,6 +1588,8 @@ object Build {
1554
1588
generateScala3StdlibDocumentation:= Def .taskDyn {
1555
1589
val dottyJars : Seq [java.io.File ] = Seq (
1556
1590
(`stdlib-bootstrapped`/ Compile / products).value,
1591
+ (`scala3-interfaces`/ Compile / products).value,
1592
+ (`tasty-core-bootstrapped`/ Compile / products).value,
1557
1593
).flatten
1558
1594
1559
1595
val roots = joinProducts(dottyJars)
0 commit comments