Skip to content

Commit c7b70e1

Browse files
committed
Add integration tests for scala3doc
1 parent 84bef51 commit c7b70e1

File tree

13 files changed

+62
-45
lines changed

13 files changed

+62
-45
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: 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: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,24 @@ object DottyPlugin extends AutoPlugin {
353353
Def.valueStrict { scalaInstance.taskValue }
354354
}.value,
355355

356-
// We need more stuff on the classpath to run the `doc` task.
356+
// Configuration for the doctool
357+
resolvers ++= Seq(
358+
Resolver.jcenterRepo,
359+
Resolver.bintrayRepo("kotlin", "kotlin-dev"),
360+
Resolver.bintrayRepo("virtuslab", "dokka"),
361+
),
362+
useScala3doc := false,
363+
scala3docOptions := Seq("-n", name.value),
364+
Compile / doc / scalacOptions := {
365+
val s3dOpts = scala3docOptions.value.map("--+DOC+" + _)
366+
val s3cOpts = (Compile / doc / scalacOptions).value
367+
if (isDotty.value && useScala3doc.value) {
368+
s3dOpts ++ s3cOpts
369+
} else {
370+
s3cOpts
371+
}
372+
},
373+
// We need to add doctool classes to the classpath so they can be called
357374
scalaInstance in doc := Def.taskDyn {
358375
if (isDotty.value)
359376
dottyScalaInstanceTask(scala3Artefact(scalaVersion.value, "doc"))

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+
}
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.

0 commit comments

Comments
 (0)