Skip to content

Commit 1a4894e

Browse files
committed
chore: add scaladoc to the new build
1 parent 746ebc8 commit 1a4894e

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",
@@ -2368,6 +2368,86 @@ object Build {
23682368
}.taskValue,
23692369
)
23702370

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

0 commit comments

Comments
 (0)