Skip to content

Commit aea22ab

Browse files
authored
chore: add scaladoc to the new build (#23750)
Add the artifacts for `scaladoc` using the new build
2 parents c164f5f + 96f1c7c commit aea22ab

File tree

3 files changed

+101
-1
lines changed

3 files changed

+101
-1
lines changed

.github/workflows/stdlib.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,25 @@ jobs:
262262
- name: Compile `scala3-library` for Scala.js
263263
run: ./project/scripts/sbt scala3-library-sjs/compile
264264

265+
scaladoc:
266+
runs-on: ubuntu-latest
267+
## Add when we add support for caching here
268+
##needs: [scala3-compiler-bootstrapped, scala3-tasty-inspector]
269+
steps:
270+
- name: Git Checkout
271+
uses: actions/checkout@v5
272+
273+
- name: Set up JDK 17
274+
uses: actions/setup-java@v4
275+
with:
276+
distribution: 'temurin'
277+
java-version: 17
278+
cache: 'sbt'
279+
- uses: sbt/setup-sbt@v1
280+
281+
- name: Compile `scaladoc`
282+
run: ./project/scripts/sbt scaladoc-new/compile
283+
265284
#################################################################################################
266285
########################################### TEST JOBS ###########################################
267286
#################################################################################################

build.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ val `tasty-core-bootstrapped-new` = Build.`tasty-core-bootstrapped-new`
3838
val `tasty-core-bootstrapped` = Build.`tasty-core-bootstrapped`
3939
val `tasty-core-scala2` = Build.`tasty-core-scala2`
4040
val scaladoc = Build.scaladoc
41+
val `scaladoc-new` = Build.`scaladoc-new`
4142
val `scaladoc-testcases` = Build.`scaladoc-testcases`
4243
val `scaladoc-js-common` = Build.`scaladoc-js-common`
4344
val `scaladoc-js-main` = Build.`scaladoc-js-main`

project/Build.scala

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1454,7 +1454,7 @@ object Build {
14541454
lazy val `scala3-bootstrapped-new` = project
14551455
.aggregate(`scala3-interfaces`, `scala3-library-bootstrapped-new` , `scala-library-bootstrapped`,
14561456
`tasty-core-bootstrapped-new`, `scala3-compiler-bootstrapped-new`, `scala3-sbt-bridge-bootstrapped`,
1457-
`scala3-staging-new`, `scala3-tasty-inspector-new`, `scala-library-sjs`, `scala3-library-sjs`)
1457+
`scala3-staging-new`, `scala3-tasty-inspector-new`, `scala-library-sjs`, `scala3-library-sjs`, `scaladoc-new`)
14581458
.settings(
14591459
name := "scala3-bootstrapped",
14601460
moduleName := "scala3-bootstrapped",
@@ -2383,6 +2383,86 @@ object Build {
23832383
}.taskValue,
23842384
)
23852385

2386+
// ==============================================================================================
2387+
// ========================================== SCALADOC ==========================================
2388+
// ==============================================================================================
2389+
2390+
/* Configuration of the org.scala-lang:scaladoc_3:*.**.**-bootstrapped project */
2391+
lazy val `scaladoc-new` = project.in(file("scaladoc"))
2392+
.dependsOn(`scala3-compiler-bootstrapped-new`, `scala3-tasty-inspector-new`)
2393+
.settings(
2394+
name := "scaladoc",
2395+
moduleName := "scaladoc",
2396+
version := dottyVersion,
2397+
versionScheme := Some("semver-spec"),
2398+
scalaVersion := referenceVersion, // nonbootstrapped artifacts are compiled with the reference compiler (already officially published)
2399+
crossPaths := true, // org.scala-lang:scaladoc has a crosspath
2400+
// sbt shouldn't add stdlib automatically, we depend on `scala3-library-nonbootstrapped`
2401+
autoScalaLibrary := false,
2402+
Compile / unmanagedSourceDirectories := Seq(baseDirectory.value / "src"),
2403+
Compile / resourceDirectory := baseDirectory.value / "resources",
2404+
// Add all the necessary resource generators
2405+
Compile / resourceGenerators ++= Seq(
2406+
generateStaticAssetsTask.taskValue,
2407+
bundleCSS.taskValue
2408+
),
2409+
// All the dependencies needed by the doctool
2410+
libraryDependencies ++= Dependencies.flexmarkDeps ++ Seq(
2411+
"nl.big-o" % "liqp" % "0.8.2",
2412+
"org.jsoup" % "jsoup" % "1.17.2", // Needed to process .html files for static site
2413+
Dependencies.`jackson-dataformat-yaml`,
2414+
"com.github.sbt" % "junit-interface" % "0.13.3" % Test,
2415+
),
2416+
// NOTE: The only difference here is that we drop `-Werror` and semanticDB for now
2417+
Compile / scalacOptions := Seq("-deprecation", "-feature", "-unchecked", "-encoding", "UTF8", "-language:implicitConversions"),
2418+
Compile / scalacOptions += "-experimental",
2419+
// TODO: Enable these flags when the new stdlib is explicitelly null checked
2420+
//Compile / scalacOptions ++= Seq("-Yexplicit-nulls", "-Wsafe-init"),
2421+
// Make sure that the produced artifacts have the minimum JVM version in the bytecode
2422+
Compile / javacOptions ++= Seq("--release", Versions.minimumJVMVersion),
2423+
Compile / scalacOptions ++= Seq("--java-output-version", Versions.minimumJVMVersion),
2424+
// Packaging configuration of the stdlib
2425+
Compile / packageBin / publishArtifact := true,
2426+
Compile / packageDoc / publishArtifact := false,
2427+
Compile / packageSrc / publishArtifact := true,
2428+
// Only publish compilation artifacts, no test artifacts
2429+
Test / publishArtifact := false,
2430+
// Do not allow to publish this project for now
2431+
publish / skip := false,
2432+
//
2433+
Compile / mainClass := Some("dotty.tools.scaladoc.Main"),
2434+
Compile / buildInfoKeys := Seq[BuildInfoKey](version),
2435+
Compile / buildInfoPackage := "dotty.tools.scaladoc",
2436+
BuildInfoPlugin.buildInfoScopedSettings(Compile),
2437+
BuildInfoPlugin.buildInfoDefaultSettings,
2438+
// Configure to use the non-bootstrapped compiler
2439+
scalaInstance := {
2440+
val externalCompilerDeps = (`scala3-compiler-nonbootstrapped` / Compile / externalDependencyClasspath).value.map(_.data).toSet
2441+
2442+
// IMPORTANT: We need to use actual jars to form the ScalaInstance and not
2443+
// just directories containing classfiles because sbt maintains a cache of
2444+
// compiler instances. This cache is invalidated based on timestamps
2445+
// however this is only implemented on jars, directories are never
2446+
// invalidated.
2447+
val tastyCore = (`tasty-core-nonbootstrapped` / Compile / packageBin).value
2448+
val scalaLibrary = (`scala-library-nonbootstrapped` / Compile / packageBin).value
2449+
val scala3Interfaces = (`scala3-interfaces` / Compile / packageBin).value
2450+
val scala3Compiler = (`scala3-compiler-nonbootstrapped` / Compile / packageBin).value
2451+
2452+
Defaults.makeScalaInstance(
2453+
dottyNonBootstrappedVersion,
2454+
libraryJars = Array(scalaLibrary),
2455+
allCompilerJars = Seq(tastyCore, scala3Interfaces, scala3Compiler) ++ externalCompilerDeps,
2456+
allDocJars = Seq.empty,
2457+
state.value,
2458+
scalaInstanceTopLoader.value
2459+
)
2460+
},
2461+
scalaCompilerBridgeBinaryJar := {
2462+
Some((`scala3-sbt-bridge-nonbootstrapped` / Compile / packageBin).value)
2463+
},
2464+
)
2465+
23862466
def dottyLibrary(implicit mode: Mode): Project = mode match {
23872467
case NonBootstrapped => `scala3-library`
23882468
case Bootstrapped => `scala3-library-bootstrapped`

0 commit comments

Comments
 (0)