Skip to content

Commit 5c738b8

Browse files
committed
Streamline generateStableScala3Documentation configuration - made it on Scala3 config instead of using hacky, manually constructed paths used in the past to build API/docs of different compiler version.
1 parent a31accb commit 5c738b8

File tree

1 file changed

+17
-35
lines changed

1 file changed

+17
-35
lines changed

project/Build.scala

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2636,16 +2636,29 @@ object Build {
26362636

26372637
generateStableScala3Documentation := Def.inputTaskDyn {
26382638
val extraArgs = spaceDelimited("<version>").parsed
2639-
val version = extraArgs.head
2639+
val version = baseVersion
2640+
// In the early days of scaladoc there was a practice to precompile artifacts of Scala 3 and generate docs using different version of scaladoc
2641+
// It's no longer needed after its stablisation.
2642+
// Allow to use explcit version check to detect using incorrect revision during release process
2643+
extraArgs.headOption.foreach { explicitVersion =>
2644+
assert(
2645+
explicitVersion == version,
2646+
s"Version of the build ($version) does not match the explicit verion ($explicitVersion)"
2647+
)
2648+
}
26402649

26412650
val docs = IO.createTemporaryDirectory
26422651
IO.copyDirectory(file("docs"), docs)
26432652
IO.delete(docs / "_blog")
26442653
IO.move(docs / "sidebar.reference.yml", docs / "sidebar.yml")
26452654

2646-
val config = stableScala3(extraArgs.head)
2647-
.map {
2648-
_.add(SiteRoot(docs.getAbsolutePath))
2655+
val config = Def.task {
2656+
Scala3.value
2657+
.add(ProjectVersion(version))
2658+
.add(Revision(version))
2659+
.add(OutputDir(s"scaladoc/output/${version}"))
2660+
.add(SiteRoot(docs.getAbsolutePath))
2661+
.remove[ApiSubdirectory]
26492662
}
26502663
generateDocumentation(config)
26512664
}.evaluated,
@@ -3371,35 +3384,4 @@ object ScaladocConfigs {
33713384
.withTargets(roots)
33723385
}
33733386

3374-
def stableScala3(version: String) = Def.task {
3375-
val scalaLibrarySrc = s"out/bootstrap/scala2-library-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/src_managed"
3376-
val dottyLibrarySrc = "library/src"
3377-
Scala3.value
3378-
.add(defaultSourceLinks(version + "-bin-SNAPSHOT-nonbootstrapped", version).value)
3379-
.add(ProjectVersion(version))
3380-
.add(SnippetCompiler(
3381-
List(
3382-
s"$dottyLibrarySrc/scala/quoted=compile",
3383-
s"$dottyLibrarySrc/scala/compiletime=compile",
3384-
s"$dottyLibrarySrc/scala/util=compile",
3385-
s"$dottyLibrarySrc/scala/util/control=compile"
3386-
)
3387-
))
3388-
.add(CommentSyntax(List(
3389-
s"$dottyLibrarySrc=markdown",
3390-
s"$scalaLibrarySrc=wiki",
3391-
"wiki"
3392-
)))
3393-
.add(DocRootContent(s"$scalaLibrarySrc/rootdoc.txt"))
3394-
.withTargets(
3395-
Seq(
3396-
s"out/bootstrap/scala2-library-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/classes",
3397-
s"out/bootstrap/scala3-library-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/classes",
3398-
s"tmp/interfaces/target/classes",
3399-
s"out/bootstrap/tasty-core-bootstrapped/scala-$version-bin-SNAPSHOT-nonbootstrapped/classes"
3400-
)
3401-
)
3402-
.remove[SiteRoot]
3403-
.remove[ApiSubdirectory]
3404-
}
34053387
}

0 commit comments

Comments
 (0)