Skip to content

Commit 89df9bd

Browse files
committed
Add integration tests for scala3doc
1 parent 75f3617 commit 89df9bd

File tree

14 files changed

+45
-47
lines changed

14 files changed

+45
-47
lines changed

.github/workflows/scala3doc.yaml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,24 @@ jobs:
3333
java-version: 11
3434

3535
- name: Compile and test
36-
run: sbt scala3doc/test
36+
run: ./project/scripts/sbt scala3doc/test
3737

3838
- name: Locally publish self
39-
run: sbt scala3doc/publishLocal
39+
run: ./project/scripts/sbt scala3doc/publishLocal
4040

4141
- name: Generate test documentation
42-
run: sbt scala3doc/generateSelfDocumentation
42+
run: ./project/scripts/sbt scala3doc/generateSelfDocumentation
4343

4444
- name: Generate Scala 3 documentation
45-
run: sbt scala3doc/generateScala3Documentation
45+
run: |
46+
./project/scripts/sbt sbt-dotty/publishLocal scala3-bootstrapped/publishLocal
47+
VERSION=$(./project/scripts/sbt "show sbt-dotty/version" | tail -1 | sed 's/\[info\] //')
48+
echo Using sbt-dotty version: $VERSION
49+
echo 'addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "'$VERSION'")' > scala3doc/example-project/project/dotty.sbt
50+
51+
SCALA_VERSION=$(./project/scripts/sbt "show scala3-bootstrapped/version" | tail -1 | sed 's/\[info\] //')
52+
echo Using scala version: $SCALA_VERSION
53+
echo 'scalaVersion := "'$SCALA_VERSION'"' > scala3doc/example-project/dotty.sbt
54+
55+
cd scala3doc/example-project
56+
sbt doc
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
> run
22
> doc
33
> clean
4-
> 'set useScala3doc := true'
5-
> doc
64
> 'set initialCommands := "1 + 1" '
75
# FIXME: does not work on the CI
86
#> console
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
scalaVersion := sys.props("plugin.scalaVersion")
2+
3+
useScala3doc := true
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % sys.props("plugin.version"))
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package hello
2+
/** Hello, world! */
3+
object Hello {
4+
def main(args: Array[String]): Unit = {
5+
val dotty: Int | String = "dotty"
6+
println(s"Hello $dotty!")
7+
}
8+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
> doc
2+

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ object DottyPlugin extends AutoPlugin {
363363
Resolver.bintrayRepo("virtuslab", "dokka"),
364364
),
365365
useScala3doc := false,
366-
scala3docOptions := Seq.empty,
366+
scala3docOptions := Seq("-n", name.value),
367367
Compile / doc / scalacOptions := {
368368
val s3dOpts = scala3docOptions.value.map("--+DOC+" + _)
369369
val s3cOpts = (Compile / doc / scalacOptions).value

scala3doc/.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
# root where we generate documentation
2-
output
3-
4-
2+
output

scala3doc/build.sbt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,9 @@ generateScala3Documentation := Def.taskDyn {
5252
generateDottyDocsFromClasspath(dotttyJars)
5353
}.value
5454

55+
val prepareExampleProject = taskKey[Unit]("Prepare example projet for interaction test")
56+
prepareExampleProject := {
57+
58+
59+
60+
}

scala3doc/example-project/.gitignore

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,2 @@
1-
.DS_Store
2-
*.class
3-
*.log
4-
*~
5-
6-
# sbt specific
7-
dist/*
8-
target/
9-
lib_managed/
10-
src_managed/
11-
project/boot/
12-
project/plugins/project/
13-
project/local-plugins.sbt
14-
.history
15-
16-
# Scala-IDE specific
17-
.scala_dependencies
18-
.cache
19-
.classpath
20-
.project
21-
.settings
22-
classes/
23-
24-
# idea
25-
.idea
26-
.idea_modules
27-
/.worksheet/
1+
dotty.sbt
2+
project/dotty.sbt

scala3doc/example-project/.travis.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

scala3doc/example-project/default.sbt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
scalaVersion := "Do fail!"
2+
3+
useScala3doc := true

scala3doc/example-project/project/plugins.sbt

Lines changed: 0 additions & 1 deletion
This file was deleted.

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,11 @@ object Main extends Driver {
5757
"--output", ctx.settings.outputDir.value.toString,
5858
)
5959

60+
val allArgs = requiredArgs ++ dokkaStrArgs
61+
println(s"Running scala3doc with arguments: $allArgs")
6062
val parser = org.kohsuke.args4j.CmdLineParser(dokkaRawArgs)
6163
try {
62-
parser.parseArgument(requiredArgs ++ dokkaStrArgs : _*)
64+
parser.parseArgument(allArgs : _*)
6365
} catch {
6466
case ex: org.kohsuke.args4j.CmdLineException =>
6567
// compiler errors are reported in SBT

0 commit comments

Comments
 (0)