@@ -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" ) ||
@@ -1182,7 +1216,6 @@ object Build {
1182
1216
val generateSelfDocumentation = taskKey[Unit ](" Generate example documentation" )
1183
1217
// Note: the two tasks below should be one, but a bug in Tasty prevents that
1184
1218
val generateScala3Documentation = inputKey[Unit ](" Generate documentation for dotty lib" )
1185
- val generateScala3StdlibDocumentation = taskKey[Unit ](" Generate documentation for Scala3 standard library" )
1186
1219
val generateTestcasesDocumentation = taskKey[Unit ](" Generate documentation for testcases, usefull for debugging tests" )
1187
1220
lazy val `scala3doc` = project.in(file(" scala3doc" )).asScala3doc
1188
1221
lazy val `scala3doc-testcases` = project.in(file(" scala3doc-testcases" )).asScala3docTestcases
@@ -1489,7 +1522,7 @@ object Build {
1489
1522
}
1490
1523
1491
1524
def joinProducts (products : Seq [java.io.File ]): String =
1492
- products.iterator.map(_.getAbsolutePath.toString).mkString(java.io. File .pathSeparator )
1525
+ products.iterator.map(_.getAbsolutePath.toString).mkString(" " )
1493
1526
1494
1527
val dokkaVersion = " 1.4.10.2"
1495
1528
@@ -1532,12 +1565,12 @@ object Build {
1532
1565
val majorVersion = (scalaBinaryVersion in LocalProject (" scala3-library-bootstrapped" )).value
1533
1566
1534
1567
val dottyJars : Seq [java.io.File ] = Seq (
1568
+ (`stdlib-bootstrapped`/ Compile / products).value,
1535
1569
(`scala3-interfaces`/ Compile / products).value,
1536
1570
(`tasty-core-bootstrapped`/ Compile / products).value,
1537
- (`scala3-library-bootstrapped`/ Compile / products).value,
1538
1571
).flatten
1539
1572
1540
- val roots = dottyJars.mkString( " " )
1573
+ val roots = joinProducts(dottyJars )
1541
1574
1542
1575
if (dottyJars.isEmpty) Def .task { streams.value.log.error(" Dotty lib wasn't found" ) }
1543
1576
else Def .task{
@@ -1547,24 +1580,9 @@ object Build {
1547
1580
IO .write(dest / " CNAME" , " dotty.epfl.ch" )
1548
1581
}.dependsOn(generateDocumentation(
1549
1582
roots, " Scala 3" , dest.getAbsolutePath, " master" ,
1550
- " -siteroot scala3doc/scala3-docs -project-logo scala3doc/scala3-docs/logo.svg" ))
1583
+ " -comment-syntax wiki - siteroot scala3doc/scala3-docs -project-logo scala3doc/scala3-docs/logo.svg" ))
1551
1584
}.evaluated,
1552
1585
1553
-
1554
- generateScala3StdlibDocumentation:= Def .taskDyn {
1555
- val dottyJars : Seq [java.io.File ] = Seq (
1556
- (`stdlib-bootstrapped`/ Compile / products).value,
1557
- ).flatten
1558
-
1559
- val roots = joinProducts(dottyJars)
1560
-
1561
- if (dottyJars.isEmpty) Def .task { streams.value.log.error(" Dotty lib wasn't found" ) }
1562
- else generateDocumentation(
1563
- roots, " Scala 3" , " scala3doc/output/scala3-stdlib" , " maser" ,
1564
- " -siteroot scala3doc/scala3-docs -comment-syntax wiki -project-logo scala3doc/scala3-docs/logo.svg "
1565
- )
1566
- }.value,
1567
-
1568
1586
generateTestcasesDocumentation := Def .taskDyn {
1569
1587
generateDocumentation(Build .testcasesOutputDir.in(Test ).value, " Scala3doc testcases" , " scala3doc/output/testcases" , " master" )
1570
1588
}.value,
0 commit comments