Skip to content

Commit 2fd9812

Browse files
committed
Disable expected links testing on main. Regenerate reference documentation links on docs generation.
1 parent 8d3083b commit 2fd9812

File tree

3 files changed

+23
-2048
lines changed

3 files changed

+23
-2048
lines changed

.github/workflows/scaladoc.yaml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,11 @@ jobs:
5252
- name: Generate testcases documentation
5353
run: ./project/scripts/sbt scaladoc/generateTestcasesDocumentation
5454

55-
- name: Generate reference documentation and check links stability
56-
run: |
57-
./project/scripts/sbt scaladoc/generateReferenceDocumentation
58-
./project/scripts/docsLinksStability ./scaladoc/output/reference ./project/scripts/expected-links/reference-expected-links.txt
55+
- name: Generate reference documentation
56+
run: ./project/scripts/sbt scaladoc/generateReferenceDocumentation --no-regenerate-expected-links
5957

60-
- name: Generate Scala 3 documentation and check links stability
61-
run: |
62-
./project/scripts/sbt scaladoc/generateScalaDocumentation
63-
./project/scripts/docsLinksStability ./scaladoc/output/scala3 ./project/scripts/expected-links/scala3-expected-links.txt
58+
- name: Generate Scala 3 documentation
59+
run: ./project/scripts/sbt scaladoc/generateScalaDocumentation
6460

6561
- name: Generate documentation for example project using dotty-sbt
6662
run: ./project/scripts/sbt "sbt-test/scripted sbt-dotty/scaladoc"

project/Build.scala

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,7 @@ object Build {
12521252
val generateScalaDocumentation = inputKey[Unit]("Generate documentation for dotty lib")
12531253
val generateTestcasesDocumentation = taskKey[Unit]("Generate documentation for testcases, usefull for debugging tests")
12541254

1255-
val generateReferenceDocumentation = taskKey[Unit]("Generate language reference documentation for Scala 3")
1255+
val generateReferenceDocumentation = inputKey[Unit]("Generate language reference documentation for Scala 3")
12561256

12571257
lazy val `scaladoc-testcases` = project.in(file("scaladoc-testcases")).
12581258
dependsOn(`scala3-compiler-bootstrapped`).
@@ -1376,7 +1376,12 @@ object Build {
13761376
generateDocumentation(Testcases)
13771377
}.value,
13781378

1379-
generateReferenceDocumentation := Def.taskDyn {
1379+
generateReferenceDocumentation := Def.inputTaskDyn {
1380+
val shouldRegenerateExpectedLinks = spaceDelimited("[--no-regenerate-expected-links]").parsed match {
1381+
case "--no-regenerate-expected-links" :: rest => false
1382+
case _ => true
1383+
}
1384+
13801385
val temp = IO.createTemporaryDirectory
13811386
IO.copyDirectory(file("docs"), temp / "docs")
13821387
IO.delete(temp / "docs" / "_blog")
@@ -1399,8 +1404,18 @@ object Build {
13991404
.withTargets(List("___fake___.scala"))
14001405
}
14011406

1402-
generateDocumentation(languageReferenceConfig)
1403-
}.value,
1407+
val expectedLinksRegeneration = Def.task {
1408+
if (shouldRegenerateExpectedLinks) {
1409+
val script = (file("project") / "scripts" / "regenerateExpectedLinks").toString
1410+
val outputDir = languageReferenceConfig.value.get[OutputDir].get.value
1411+
val expectedLinksFile = (file("project") / "scripts" / "expected-links" / "reference-expected-links.txt").toString
1412+
import _root_.scala.sys.process._
1413+
s"$script $outputDir $expectedLinksFile" !
1414+
}
1415+
}
1416+
1417+
expectedLinksRegeneration.dependsOn(generateDocumentation(languageReferenceConfig))
1418+
}.evaluated,
14041419

14051420
Test / buildInfoKeys := Seq[BuildInfoKey](
14061421
(Test / Build.testcasesOutputDir),

0 commit comments

Comments
 (0)