Skip to content

Commit 35bada9

Browse files
committed
Rename scala3doc to scaladoc in sbt plugin
1 parent 84c950f commit 35bada9

File tree

5 files changed

+27
-24
lines changed

5 files changed

+27
-24
lines changed

community-build/src/scala/dotty/communitybuild/projects.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,12 @@ final case class SbtCommunityProject(
162162

163163
override val publishCommand = if sbtPublishCommand eq null then null else
164164
val disableDocCommand =
165-
if sbtDocCommand eq null then "" else "set every usescaladoc := false;"
165+
if sbtDocCommand eq null then "" else "set every useScaladoc := false;"
166166
s"$baseCommand$disableDocCommand$sbtPublishCommand"
167167
override val docCommand =
168168
if sbtDocCommand eq null then null else
169169
val cmd = if sbtDocCommand.startsWith(";") then sbtDocCommand else s";$sbtDocCommand"
170-
s"$baseCommand set every usescaladoc := true; set every doc/logLevel := Level.Warn $cmd "
170+
s"$baseCommand set every useScaladoc := true; set every doc/logLevel := Level.Warn $cmd "
171171

172172
override val runCommandsArgs: List[String] =
173173
// Run the sbt command with the compiler version and sbt plugin set in the build

project/Build.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,10 +1229,10 @@ object Build {
12291229
// Note: the two tasks below should be one, but a bug in Tasty prevents that
12301230
val generatescaladocumentation = inputKey[Unit]("Generate documentation for dotty lib")
12311231
val generateTestcasesDocumentation = taskKey[Unit]("Generate documentation for testcases, usefull for debugging tests")
1232-
lazy val `scaladoc` = project.in(file("scaladoc")).asscaladoc
1233-
lazy val `scaladoc-testcases` = project.in(file("scaladoc-testcases")).asscaladocTestcases
1232+
lazy val `scaladoc` = project.in(file("scaladoc")).asScaladoc
1233+
lazy val `scaladoc-testcases` = project.in(file("scaladoc-testcases")).asScaladocTestcases
12341234

1235-
lazy val `scaladoc-js` = project.in(file("scaladoc-js")).asscaladocJs
1235+
lazy val `scaladoc-js` = project.in(file("scaladoc-js")).asScaladocJs
12361236

12371237
// sbt plugin to use Dotty in your own build, see
12381238
// https://github.com/lampepfl/scala3-example-project for usage.
@@ -1531,7 +1531,7 @@ object Build {
15311531
settings(commonBenchmarkSettings).
15321532
enablePlugins(JmhPlugin)
15331533

1534-
def asscaladoc: Project = {
1534+
def asScaladoc: Project = {
15351535
def generateDocumentation(targets: String, name: String, outDir: String, ref: String, params: String = "") = Def.taskDyn {
15361536
val projectVersion = version.value
15371537
IO.createDirectory(file(outDir))
@@ -1570,7 +1570,7 @@ object Build {
15701570
Test / test := (Test / test).dependsOn(compile.in(Compile).in(`scaladoc-testcases`)).value,
15711571
testcasesOutputDir.in(Test) := joinProducts((`scaladoc-testcases`/Compile/products).value),
15721572
testcasesSourceRoot.in(Test) := (baseDirectory.in(`scaladoc-testcases`).value / "src").getAbsolutePath.toString,
1573-
Compile / mainClass := Some("dotty.dokka.Main"),
1573+
Compile / mainClass := Some("dotty.tools.scaladoc.Main"),
15741574
baseDirectory.in(run) := baseDirectory.in(ThisBuild).value,
15751575
generateSelfDocumentation := Def.taskDyn {
15761576
generateDocumentation(
@@ -1636,7 +1636,7 @@ object Build {
16361636
Build.testDocumentationRoot,
16371637
),
16381638
Compile / buildInfoKeys := Seq[BuildInfoKey](version),
1639-
Compile / buildInfoPackage := "dotty.dokka",
1639+
Compile / buildInfoPackage := "dotty.tools.scaladoc",
16401640
Compile / resourceGenerators += Def.task {
16411641
val jsDestinationFile = (Compile / resourceManaged).value / "dotty_res" / "scripts" / "searchbar.js"
16421642
sbt.IO.copyFile((fullOptJS in Compile in `scaladoc-js`).value.data, jsDestinationFile)
@@ -1651,17 +1651,17 @@ object Build {
16511651
}.apply(Set(cssSourceFile)).toSeq
16521652
}.taskValue,
16531653
testDocumentationRoot := (baseDirectory.value / "test-documentations").getAbsolutePath,
1654-
buildInfoPackage in Test := "dotty.dokka.test",
1654+
buildInfoPackage in Test := "dotty.tools.scaladoc.test",
16551655
BuildInfoPlugin.buildInfoScopedSettings(Test),
16561656
BuildInfoPlugin.buildInfoScopedSettings(Compile),
16571657
BuildInfoPlugin.buildInfoDefaultSettings,
16581658
)
16591659
}
16601660

1661-
def asscaladocTestcases: Project =
1661+
def asScaladocTestcases: Project =
16621662
project.dependsOn(`scala3-compiler-bootstrapped`).settings(commonBootstrappedSettings)
16631663

1664-
def asscaladocJs: Project =
1664+
def asScaladocJs: Project =
16651665
project.
16661666
enablePlugins(MyScalaJSPlugin).
16671667
dependsOn(`scala3-library-bootstrappedJS`).

sbt-dotty/sbt-test/sbt-dotty/scaladoc/build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ scalaVersion := sys.props("plugin.scalaVersion")
33
lazy val assertUsingscaladoc = taskKey[Unit]("")
44

55
assertUsingscaladoc := {
6-
assert(usescaladoc.value)
6+
assert(useScaladoc.value)
77
}

sbt-dotty/src/dotty/tools/sbtplugin/DottyPlugin.scala

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ object DottyPlugin extends AutoPlugin {
2323
val isDotty = settingKey[Boolean]("Is this project compiled with Dotty?")
2424
val isDottyJS = settingKey[Boolean]("Is this project compiled with Dotty and Scala.js?")
2525

26-
val usescaladoc = settingKey[Boolean]("Use scaladoc as the documentation tool")
26+
val useScaladoc = settingKey[Boolean]("Use scaladoc as the documentation tool")
2727
val tastyFiles = taskKey[Seq[File]]("List all testy files")
2828

2929
// NOTE:
@@ -370,18 +370,21 @@ object DottyPlugin extends AutoPlugin {
370370
}.value,
371371

372372
// Configuration for the doctool
373-
resolvers ++= (if(!usescaladoc.value) Nil else Seq(Resolver.jcenterRepo)),
374-
usescaladoc := {
373+
resolvers ++= (if(!useScaladoc.value) Nil else Seq(Resolver.jcenterRepo)),
374+
useScaladoc := {
375375
val v = scalaVersion.value
376376
v.startsWith("3.0.0") && !v.startsWith("3.0.0-M1") && !v.startsWith("3.0.0-M2")
377377
},
378378
// We need to add doctool classes to the classpath so they can be called
379379
scalaInstance in doc := Def.taskDyn {
380380
if (isDotty.value)
381-
if (usescaladoc.value)
382-
dottyScalaInstanceTask("scaladoc")
383-
else
384-
dottyScalaInstanceTask(scala3Artefact(scalaVersion.value, "doc"))
381+
if (useScaladoc.value) {
382+
val v = scalaVersion.value
383+
val shouldUseScala3doc =
384+
v.startsWith("3.0.0-M1") || v.startsWith("3.0.0-M2") || v.startsWith("3.0.0-M3") || v.startsWith("3.0.0-RC1-bin-20210")
385+
val name = if (shouldUseScala3doc) "scala3doc" else "scaladoc"
386+
dottyScalaInstanceTask(name)
387+
} else dottyScalaInstanceTask(scala3Artefact(scalaVersion.value, "doc"))
385388
else
386389
Def.valueStrict { (scalaInstance in doc).taskValue }
387390
}.value,
@@ -455,7 +458,7 @@ object DottyPlugin extends AutoPlugin {
455458
},
456459
sources := Def.taskDyn[Seq[File]] {
457460
val originalSources = sources.value
458-
if (isDotty.value && usescaladoc.value && originalSources.nonEmpty)
461+
if (isDotty.value && useScaladoc.value && originalSources.nonEmpty)
459462
Def.task { tastyFiles.value }
460463
else Def.task { originalSources }
461464
}.value,
@@ -489,9 +492,9 @@ object DottyPlugin extends AutoPlugin {
489492
dependencyRes.update(descriptor, updateConfig, warningConfig, log) match {
490493
case Right(report) =>
491494
report
492-
case _ =>
495+
case Left(warning) =>
493496
throw new MessageOnlyException(
494-
s"Couldn't retrieve `$moduleID`.")
497+
s"Couldn't retrieve `$moduleID` : ${warning.resolveException.getMessage}.")
495498
}
496499
}
497500

scaladoc/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ You can also find the result of building the same sites for latest `master` at:
7373
### Testing
7474

7575
Most tests rely on comparing signatures (of classes, methods, objects etc.) extracted from the generated documentation
76-
to signatures found in source files. Such tests are defined using [MultipleFileTest](test/dotty/tools/scala3doc/MultipleFileTest.scala) class
77-
and its subtypes (such as [SingleFileTest](test/dotty/tools/scala3doc/SingleFileTest.scala))
76+
to signatures found in source files. Such tests are defined using [MultipleFileTest](test/dotty/tools/scaladoc/MultipleFileTest.scala) class
77+
and its subtypes (such as [SingleFileTest](test/dotty/tools/scaladoc/SingleFileTest.scala))
7878

7979
WARNING: As the classes mentioned above are likely to evolve, the description below might easily get out of date.
8080
In case of any discrepancies rely on the source files instead.

0 commit comments

Comments
 (0)