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