@@ -841,6 +841,16 @@ object Build {
841841 settings(
842842 moduleName := " scala-library" ,
843843 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+ },
844854 scalacOptions -= " -Xfatal-warnings" ,
845855 ivyConfigurations += SourceDeps .hide,
846856 transitiveClassifiers := Seq (" sources" ),
@@ -870,6 +880,30 @@ object Build {
870880 ((trgDir ** " *.scala" ) +++ (trgDir ** " *.java" )).get.toSet
871881 } (Set (scalaLibrarySourcesJar)).toSeq
872882 }.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,
873907 sources in Compile ~= (_.filterNot(file =>
874908 // sources from https://github.com/scala/scala/tree/2.13.x/src/library-aux
875909 file.getPath.endsWith(" scala-library-src/scala/Any.scala" ) ||
@@ -1182,7 +1216,6 @@ object Build {
11821216 val generateSelfDocumentation = taskKey[Unit ](" Generate example documentation" )
11831217 // Note: the two tasks below should be one, but a bug in Tasty prevents that
11841218 val generateScala3Documentation = inputKey[Unit ](" Generate documentation for dotty lib" )
1185- val generateScala3StdlibDocumentation = taskKey[Unit ](" Generate documentation for Scala3 standard library" )
11861219 val generateTestcasesDocumentation = taskKey[Unit ](" Generate documentation for testcases, usefull for debugging tests" )
11871220 lazy val `scala3doc` = project.in(file(" scala3doc" )).asScala3doc
11881221 lazy val `scala3doc-testcases` = project.in(file(" scala3doc-testcases" )).asScala3docTestcases
@@ -1489,7 +1522,7 @@ object Build {
14891522 }
14901523
14911524 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(" " )
14931526
14941527 val dokkaVersion = " 1.4.10.2"
14951528
@@ -1532,12 +1565,12 @@ object Build {
15321565 val majorVersion = (scalaBinaryVersion in LocalProject (" scala3-library-bootstrapped" )).value
15331566
15341567 val dottyJars : Seq [java.io.File ] = Seq (
1568+ (`stdlib-bootstrapped`/ Compile / products).value,
15351569 (`scala3-interfaces`/ Compile / products).value,
15361570 (`tasty-core-bootstrapped`/ Compile / products).value,
1537- (`scala3-library-bootstrapped`/ Compile / products).value,
15381571 ).flatten
15391572
1540- val roots = dottyJars.mkString( " " )
1573+ val roots = joinProducts(dottyJars )
15411574
15421575 if (dottyJars.isEmpty) Def .task { streams.value.log.error(" Dotty lib wasn't found" ) }
15431576 else Def .task{
@@ -1547,24 +1580,9 @@ object Build {
15471580 IO .write(dest / " CNAME" , " dotty.epfl.ch" )
15481581 }.dependsOn(generateDocumentation(
15491582 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" ))
15511584 }.evaluated,
15521585
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-
15681586 generateTestcasesDocumentation := Def .taskDyn {
15691587 generateDocumentation(Build .testcasesOutputDir.in(Test ).value, " Scala3doc testcases" , " scala3doc/output/testcases" , " master" )
15701588 }.value,
0 commit comments