Skip to content

Commit 0b4cbeb

Browse files
committed
Change scala3doc parameter names
Clean up Build.scala and scala3doc.yaml
1 parent f94494e commit 0b4cbeb

File tree

4 files changed

+33
-30
lines changed

4 files changed

+33
-30
lines changed

.github/workflows/scala3doc.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ jobs:
99
build:
1010
runs-on: ubuntu-latest
1111
container: lampepfl/dotty:2020-04-24
12-
13-
steps:
1412

13+
steps:
14+
- name: Git Checkout
1515
- uses: actions/checkout@v2
16-
- run: git fetch --prune --unshallow --tags
1716

1817
- name: Cache Coursier
1918
uses: actions/cache@v1

project/Build.scala

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,13 @@ object Build {
213213
}
214214
)
215215

216+
lazy val disableDocSetting =
217+
// Disable scaladoc generation, it's way too slow and we'll replace it
218+
// by dottydoc anyway. We still publish an empty -javadoc.jar to make
219+
// sonatype happy.
220+
sources in (Compile, doc) := Seq()
221+
222+
216223
lazy val commonSettings = publishSettings ++ Seq(
217224
scalaSource in Compile := baseDirectory.value / "src",
218225
scalaSource in Test := baseDirectory.value / "test",
@@ -221,11 +228,6 @@ object Build {
221228
resourceDirectory in Compile := baseDirectory.value / "resources",
222229
resourceDirectory in Test := baseDirectory.value / "test-resources",
223230

224-
// Disable scaladoc generation, it's way too slow and we'll replace it
225-
// by dottydoc anyway. We still publish an empty -javadoc.jar to make
226-
// sonatype happy.
227-
sources in (Compile, doc) := Seq(),
228-
229231
// Prevent sbt from rewriting our dependencies
230232
scalaModuleInfo ~= (_.map(_.withOverrideScalaVersion(false))),
231233

@@ -244,7 +246,8 @@ object Build {
244246
crossPaths := false,
245247
// Do not depend on the Scala library
246248
autoScalaLibrary := false,
247-
excludeFromIDE := true
249+
excludeFromIDE := true,
250+
disableDocSetting
248251
)
249252

250253
// Settings used when compiling dotty (both non-bootstrapped and bootstrapped)
@@ -258,6 +261,8 @@ object Build {
258261
moduleName ~= { _.stripSuffix("-scala2") },
259262
version := dottyVersion,
260263
target := baseDirectory.value / ".." / "out" / "scala-2" / name.value,
264+
265+
disableDocSetting
261266
)
262267

263268
// Settings used when compiling dotty with the reference compiler
@@ -267,13 +272,12 @@ object Build {
267272
version := dottyNonBootstrappedVersion,
268273
scalaVersion := referenceVersion,
269274
excludeFromIDE := true,
275+
276+
disableDocSetting
270277
)
271278

272279
// Settings used when compiling dotty with a non-bootstrapped dotty
273-
lazy val commonBootstrappedSettings = commonBootstrappedSettings0 ++ Seq(
274-
disableDocSetting,
275-
)
276-
lazy val commonBootstrappedSettings0 = commonDottySettings ++ Seq(
280+
lazy val commonBootstrappedSettings = commonDottySettings ++ Seq(
277281
unmanagedSourceDirectories in Compile += baseDirectory.value / "src-bootstrapped",
278282

279283
version := dottyVersion,
@@ -331,6 +335,8 @@ object Build {
331335
},
332336
// sbt-dotty defines `scalaInstance in doc` so we need to override it manually
333337
scalaInstance in doc := scalaInstance.value,
338+
339+
disableDocSetting,
334340
)
335341

336342
lazy val commonBenchmarkSettings = Seq(
@@ -1158,7 +1164,7 @@ object Build {
11581164

11591165
val testcasesOutputDir = taskKey[String]("Root directory where tests classses are generated")
11601166
val testcasesSourceRoot = taskKey[String]("Root directory where tests sources are generated")
1161-
val generateSelfDocumentation = inputKey[Unit]("Generate example documentation")
1167+
val generateSelfDocumentation = taskKey[Unit]("Generate example documentation")
11621168
val generateScala3Documentation = taskKey[Unit]("Generate documentation for dotty lib")
11631169
val generateTestcasesDocumentation = taskKey[Unit]("Generate documentation for testcases, usefull for debugging tests")
11641170
lazy val `scala3doc` = project.in(file("scala3doc")).asScala3doc
@@ -1203,6 +1209,7 @@ object Build {
12031209
publishLocal in `scala3-staging`,
12041210
publishLocal in `scala3-tasty-inspector`,
12051211
publishLocal in `scala3-doc-bootstrapped`,
1212+
publishLocal in `scala3doc`,
12061213
publishLocal in `scala3-bootstrapped` // Needed because sbt currently hardcodes the dotty artifact
12071214
).evaluated
12081215
)
@@ -1404,7 +1411,7 @@ object Build {
14041411
def asDottyRoot(implicit mode: Mode): Project = project.withCommonSettings.
14051412
aggregate(`scala3-interfaces`, dottyLibrary, dottyCompiler, tastyCore, dottyDoc, `scala3-sbt-bridge`).
14061413
bootstrappedAggregate(`scala3-language-server`, `scala3-staging`, `scala3-tasty-inspector`,
1407-
`scala3-library-bootstrappedJS`).
1414+
`scala3-library-bootstrappedJS`, scala3doc).
14081415
dependsOn(tastyCore).
14091416
dependsOn(dottyCompiler).
14101417
dependsOn(dottyLibrary).
@@ -1454,19 +1461,18 @@ object Build {
14541461
def asScala3doc: Project = {
14551462
def generateDocumentation(targets: String, name: String, outDir: String, params: String = "") = Def.taskDyn {
14561463
val sourceMapping = "=https://github.com/lampepfl/dotty/tree/master#L"
1457-
run.in(Compile).toTask(s""" -o output/$outDir -t $targets -n "$name" -s $sourceMapping $params""")
1464+
run.in(Compile).toTask(s""" -d output/$outDir -t $targets -n "$name" -s $sourceMapping $params""")
14581465
}
14591466

14601467
project.settings(commonBootstrappedSettings).
14611468
dependsOn(`scala3-compiler-bootstrapped`).
14621469
dependsOn(`scala3-tasty-inspector`).
14631470
settings(
1471+
// Needed to download dokka and its dependencies
14641472
resolvers += Resolver.jcenterRepo,
1465-
resolvers += Resolver.bintrayRepo("kotlin", "kotlin-dev"),
1473+
// Needed to download dokka-site
14661474
resolvers += Resolver.bintrayRepo("virtuslab", "dokka"),
14671475
libraryDependencies ++= Seq(
1468-
"org.scala-lang" %% "scala3-tasty-inspector" % scalaVersion.value,
1469-
14701476
"com.virtuslab.dokka" % "dokka-site" % "0.1.9",
14711477
"com.vladsch.flexmark" % "flexmark-all" % "0.42.12",
14721478
"nl.big-o" % "liqp" % "0.6.7",
@@ -1475,17 +1481,15 @@ object Build {
14751481
"org.jetbrains.dokka" % "dokka-test-api" % "1.4.10.2" % "test",
14761482
"com.novocode" % "junit-interface" % "0.11" % "test",
14771483
),
1478-
test.in(Test) := test.in(Test).dependsOn(compile.in(Compile).in(`scala3doc-testcases`)).value,
1484+
Test / test := (Test / test).dependsOn(compile.in(Compile).in(`scala3doc-testcases`)).value,
14791485
testcasesOutputDir.in(Test) := classDirectory.in(Compile).in(`scala3doc-testcases`).value.getAbsolutePath.toString,
14801486
testcasesSourceRoot.in(Test) := (baseDirectory.in(`scala3doc-testcases`).value / "src").getAbsolutePath.toString,
1481-
fork.in(run) := true,
14821487
Compile / mainClass := Some("dotty.dokka.Main"),
14831488
// There is a bug in dokka that prevents parallel tests withing the same jvm
14841489
fork.in(test) := true,
1485-
Test / parallelExecution := false,
1486-
generateSelfDocumentation := Def.inputTaskDyn {
1487-
generateDocumentation(classDirectory.in(Compile).value.getAbsolutePath, "scala3doc", "self", "-d documentation")
1488-
}.evaluated,
1490+
generateSelfDocumentation := Def.taskDyn {
1491+
generateDocumentation(classDirectory.in(Compile).value.getAbsolutePath, "scala3doc", "self", "-p documentation")
1492+
}.value,
14891493
generateScala3Documentation := Def.taskDyn {
14901494
val dottyJars = Seq(
14911495
// All projects below will be used to generated documentation for Scala 3
@@ -1497,8 +1501,8 @@ object Build {
14971501
)
14981502
val roots = dottyJars.map(_.toString).mkString(java.io.File.pathSeparator)
14991503

1500-
if (dottyJars.isEmpty) Def.task { streams.value.log.error("Dotty lib wasn't found") }
1501-
else generateDocumentation(roots, "Scala 3", "stdLib", "-d dotty-docs/docs")
1504+
if (dottyJars.isEmpty) Def.task { streams.value.log.error("Dotty lib wasn't found") }
1505+
else generateDocumentation(roots, "Scala 3", "stdLib", "-p dotty-docs/docs")
15021506
}.value,
15031507
generateTestcasesDocumentation := Def.taskDyn {
15041508
generateDocumentation(Build.testcasesOutputDir.in(Test).value, "Scala3doc testcases", "testcases")

scala3doc/src/dotty/dokka/Main.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class RawArgs:
2121
@COption(name="--tastyRoots", required = true, aliases = Array("-t"), usage="Roots where tools should look for tasty files")
2222
protected var tastyRoots: String = null
2323

24-
@COption(name="--output",required = true, aliases = Array("-o"), usage="Output to generate documentation to")
24+
@COption(name="--dest",required = true, aliases = Array("-d"), usage="Output to generate documentation to")
2525
protected var output: String = "output"
2626

2727
@COption(name="--classpath", aliases = Array("--cp", "-c"), usage="Classpath to load dependencies from")
@@ -30,7 +30,7 @@ class RawArgs:
3030
@COption(name="--name", required = true, aliases = Array("-n"), usage="Name of module in generated documentation")
3131
protected var name: String = "main"
3232

33-
@COption(name="--docs", aliases = Array("-d"), usage="Root of project docs")
33+
@COption(name="--docs", aliases = Array("-p"), usage="Root of project docs")
3434
private var docsRoot: String = null
3535

3636
@COption(name="--sources", handler = classOf[StringArrayOptionHandler], aliases = Array("-s"), usage = "Links to source files provided in convention: local_directory=remote_directory#line_suffix")

scala3doc/src/dotty/tools/dottydoc/Main.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ object Main extends Driver {
5757
// we extract some settings from Dotty options since that's how SBT passes them
5858
"--name", ctx.settings.projectName.value,
5959
"--projectTitle", ctx.settings.projectName.value,
60-
"--output", ctx.settings.outputDir.value.toString,
60+
"--dest", ctx.settings.outputDir.value.toString,
6161
)
6262

6363
val allArgs = requiredArgs ++ dokkaStrArgs

0 commit comments

Comments
 (0)