Skip to content

Commit 3828975

Browse files
authored
fix: allow to generate the documentation of the stdlib (#24574)
Based on @bracevac remarks here #24434 (comment) We do not need to add `-sourcepath` when generating the scaladoc since compiling with `-from-tasty` (what scaladoc does) will put the TASTy in the classpath. This means that the compiler will be happy and will find the symbols. Closes #24434 Supersedes #24569, #24510. Thanks Oliver for taking the time to analyze the issue in depth.
2 parents fe49539 + 96b4a20 commit 3828975

File tree

2 files changed

+28
-7
lines changed

2 files changed

+28
-7
lines changed

.github/workflows/stdlib.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,3 +722,25 @@ jobs:
722722
- name: Run Community Build C
723723
run: |
724724
./project/scripts/sbt "community-build/testOnly dotty.communitybuild.CommunityBuildTestC"
725+
726+
#################################################################################################
727+
######################################## GENERATE DOCS ##########################################
728+
#################################################################################################
729+
730+
scala-library-docs:
731+
runs-on: ubuntu-latest
732+
needs : [scala-library-bootstrapped, scaladoc]
733+
steps:
734+
- name: Git Checkout
735+
uses: actions/checkout@v6
736+
737+
- name: Set up JDK 17
738+
uses: actions/setup-java@v5
739+
with:
740+
distribution: 'temurin'
741+
java-version: 17
742+
cache: 'sbt'
743+
744+
- uses: sbt/setup-sbt@v1
745+
- name: Generate Documentation of the Standard Library
746+
run: ./project/scripts/sbt scala-library-bootstrapped/doc

project/Build.scala

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,8 +1239,8 @@ object Build {
12391239
// Add the source directories for the stdlib (non-boostrapped)
12401240
Compile / unmanagedSourceDirectories := Seq(baseDirectory.value / "src"),
12411241
Compile / unmanagedSourceDirectories += baseDirectory.value / "src-non-bootstrapped",
1242-
Compile / scalacOptions += "-Yno-stdlib-patches",
1243-
Compile / scalacOptions ++= Seq(
1242+
Compile / compile / scalacOptions += "-Yno-stdlib-patches",
1243+
Compile / compile / scalacOptions ++= Seq(
12441244
// Needed so that the library sources are visible when `dotty.tools.dotc.core.Definitions#init` is called
12451245
"-sourcepath", (Compile / sourceDirectories).value.map(_.getCanonicalPath).distinct.mkString(File.pathSeparator),
12461246
),
@@ -1312,7 +1312,6 @@ object Build {
13121312
lazy val `scala-library-bootstrapped` = project.in(file("library"))
13131313
.enablePlugins(ScalaLibraryPlugin)
13141314
.settings(publishSettings)
1315-
.settings(disableDocSetting) // TODO now produces empty JAR to satisfy Sonatype, see https://github.com/scala/scala3/issues/24434
13161315
.settings(
13171316
name := "scala-library-bootstrapped",
13181317
moduleName := "scala-library",
@@ -1331,8 +1330,8 @@ object Build {
13311330
// Add the source directories for the stdlib (non-boostrapped)
13321331
Compile / unmanagedSourceDirectories := Seq(baseDirectory.value / "src"),
13331332
Compile / unmanagedSourceDirectories += baseDirectory.value / "src-bootstrapped",
1334-
Compile / scalacOptions += "-Yno-stdlib-patches",
1335-
Compile / scalacOptions ++= Seq(
1333+
Compile / compile / scalacOptions += "-Yno-stdlib-patches",
1334+
Compile / compile / scalacOptions ++= Seq(
13361335
// Needed so that the library sources are visible when `dotty.tools.dotc.core.Definitions#init` is called
13371336
"-sourcepath", (Compile / sourceDirectories).value.map(_.getCanonicalPath).distinct.mkString(File.pathSeparator),
13381337
),
@@ -1465,9 +1464,9 @@ object Build {
14651464
Compile / unmanagedSourceDirectories := Seq(baseDirectory.value / "src"),
14661465
Compile / unmanagedSourceDirectories ++=
14671466
(`scala-library-bootstrapped` / Compile / unmanagedSourceDirectories).value,
1468-
Compile / scalacOptions += "-Yno-stdlib-patches",
1467+
Compile / compile / scalacOptions += "-Yno-stdlib-patches",
14691468
// Configure the source maps to point to GitHub for releases
1470-
Compile / scalacOptions ++= {
1469+
Compile / compile / scalacOptions ++= {
14711470
if (isRelease) {
14721471
val baseURI = (LocalRootProject / baseDirectory).value.toURI
14731472
val dottyVersion = version.value

0 commit comments

Comments
 (0)