@@ -1174,7 +1174,7 @@ object Build {
1174
1174
val testDocumentationRoot = taskKey[String ](" Root directory where tests documentation are stored" )
1175
1175
val generateSelfDocumentation = taskKey[Unit ](" Generate example documentation" )
1176
1176
// Note: the two tasks below should be one, but a bug in Tasty prevents that
1177
- val generateScala3Documentation = taskKey [Unit ](" Generate documentation for dotty lib" )
1177
+ val generateScala3Documentation = inputKey [Unit ](" Generate documentation for dotty lib" )
1178
1178
val generateScala3StdlibDocumentation = taskKey[Unit ](" Generate documentation for Scala3 standard library" )
1179
1179
val generateTestcasesDocumentation = taskKey[Unit ](" Generate documentation for testcases, usefull for debugging tests" )
1180
1180
lazy val `scala3doc` = project.in(file(" scala3doc" )).asScala3doc
@@ -1469,12 +1469,11 @@ object Build {
1469
1469
enablePlugins(JmhPlugin )
1470
1470
1471
1471
def asScala3doc : Project = {
1472
- def generateDocumentation (targets : String , name : String , outDir : String , params : String = " " ) = Def .taskDyn {
1472
+ def generateDocumentation (targets : String , name : String , outDir : String , ref : String , params : String = " " ) = Def .taskDyn {
1473
1473
val projectVersion = version.value
1474
- val sourcesAndRevision = s " -s github://lampepfl/dotty --projectVersion $projectVersion"
1475
- run.in(Compile ).toTask(
1476
- s """ -d scala3doc/output/ $outDir -t $targets -n " $name" $sourcesAndRevision $params"""
1477
- )
1474
+ val sourcesAndRevision = s " -s github://lampepfl/dotty --revision $ref --projectVersion $projectVersion"
1475
+ val cmd = s """ -d $outDir -t $targets -n " $name" $sourcesAndRevision $params"""
1476
+ run.in(Compile ).toTask(cmd)
1478
1477
}
1479
1478
1480
1479
def joinProducts (products : Seq [java.io.File ]): String =
@@ -1509,14 +1508,17 @@ object Build {
1509
1508
fork.in(test) := true ,
1510
1509
baseDirectory.in(run) := baseDirectory.in(ThisBuild ).value,
1511
1510
generateSelfDocumentation := Def .taskDyn {
1512
- val revision = VersionUtil .gitHash
1513
1511
generateDocumentation(
1514
1512
classDirectory.in(Compile ).value.getAbsolutePath,
1515
- " scala3doc" , " self" ,
1516
- s " -p scala3doc/documentation --projectLogo scala3doc/documentation/logo.svg --revision $revision" ,
1517
- )
1513
+ " scala3doc" , " scala3doc/output/self" , VersionUtil .gitHash,
1514
+ " -p scala3doc/documentation --projectLogo scala3doc/documentation/logo.svg" )
1518
1515
}.value,
1519
- generateScala3Documentation := Def .taskDyn {
1516
+
1517
+ generateScala3Documentation := Def .inputTaskDyn {
1518
+ val dottydocExtraArgs = spaceDelimited(" [output]" ).parsed
1519
+ val dest = file(dottydocExtraArgs.headOption.getOrElse(" scala3doc/output/scala3" )).getAbsoluteFile
1520
+ val majorVersion = (scalaBinaryVersion in LocalProject (" scala3-library-bootstrapped" )).value
1521
+
1520
1522
val dottyJars : Seq [java.io.File ] = Seq (
1521
1523
(`scala3-interfaces`/ Compile / products).value,
1522
1524
(`tasty-core-bootstrapped`/ Compile / products).value,
@@ -1526,8 +1528,16 @@ object Build {
1526
1528
val roots = joinProducts(dottyJars)
1527
1529
1528
1530
if (dottyJars.isEmpty) Def .task { streams.value.log.error(" Dotty lib wasn't found" ) }
1529
- else generateDocumentation(roots, " Scala 3" , " scala3" , " -p scala3doc/scala3-docs --projectLogo scala3doc/scala3-docs/logo.svg --revision master" )
1530
- }.value,
1531
+ else Def .task{
1532
+ IO .write(dest / " versions" / " latest-nightly-base" , majorVersion)
1533
+
1534
+ // This file is used by GitHub Pages when the page is available in a custom domain
1535
+ IO .write(dest / " CNAME" , " dotty.epfl.ch" )
1536
+ }.dependsOn(generateDocumentation(
1537
+ roots, " Scala 3" , dest.getAbsolutePath, " master" ,
1538
+ " -p scala3doc/scala3-docs --projectLogo scala3doc/scala3-docs/logo.svg" ))
1539
+ }.evaluated,
1540
+
1531
1541
1532
1542
generateScala3StdlibDocumentation:= Def .taskDyn {
1533
1543
val dottyJars : Seq [java.io.File ] = Seq (
@@ -1537,11 +1547,16 @@ object Build {
1537
1547
val roots = joinProducts(dottyJars)
1538
1548
1539
1549
if (dottyJars.isEmpty) Def .task { streams.value.log.error(" Dotty lib wasn't found" ) }
1540
- else generateDocumentation(roots, " Scala 3" , " scala3-stdlib" , " -p scala3doc/scala3-docs --syntax wiki --projectLogo scala3doc/scala3-docs/logo.svg --revision master" )
1550
+ else generateDocumentation(
1551
+ roots, " Scala 3" , " scala3doc/output/scala3-stdlib" , " maser" ,
1552
+ " -p scala3doc/scala3-docs --syntax wiki --projectLogo scala3doc/scala3-docs/logo.svg "
1553
+ )
1541
1554
}.value,
1555
+
1542
1556
generateTestcasesDocumentation := Def .taskDyn {
1543
- generateDocumentation(Build .testcasesOutputDir.in(Test ).value, " Scala3doc testcases" , " testcases" , " --revision master" )
1557
+ generateDocumentation(Build .testcasesOutputDir.in(Test ).value, " Scala3doc testcases" , " scala3doc/output/ testcases" , " master" )
1544
1558
}.value,
1559
+
1545
1560
buildInfoKeys in Test := Seq [BuildInfoKey ](
1546
1561
Build .testcasesOutputDir.in(Test ),
1547
1562
Build .testcasesSourceRoot.in(Test ),
0 commit comments