@@ -7,7 +7,6 @@ val dokkaSiteVersion = "0.1.9"
7
7
libraryDependencies ++= Seq (
8
8
" org.scala-lang" %% " scala3-tasty-inspector" % scalaVersion.value,
9
9
10
-
11
10
" com.virtuslab.dokka" % " dokka-site" % dokkaSiteVersion,
12
11
" org.scala-sbt" % " io_2.13" % " 1.3.4" ,
13
12
" com.vladsch.flexmark" % " flexmark-all" % flexmarkVersion,
@@ -17,10 +16,14 @@ libraryDependencies ++= Seq(
17
16
) // a a
18
17
19
18
val generateSelfDocumentation = inputKey[Unit ](" Generate example documentation" )
20
- generateSelfDocumentation := {
21
- run .in(Compile ).fullInput( " -o output/self -t target/scala-0.27/classes -d documentation -n scala3doc -s src/main/scala=https://github.com/lampepfl/scala3doc/tree/master/src/main/scala#L " ).evaluated // TODO #35 proper sbt integration
22
- }
19
+ generateSelfDocumentation := Def .inputTaskDyn {
20
+ runSelfDocumentation(classDirectory .in(Compile ).value.getAbsolutePath)
21
+ }.evaluated
23
22
23
+ def runSelfDocumentation (classDir : String ) = Def .taskDyn {
24
+ val mapping = " src/main/scala=https://github.com/lampepfl/scala3doc/tree/master/src/main/scala#L"
25
+ run.in(Compile ).toTask(s " -o output/self -t $classDir -d documentation -n scala3doc -s $mapping" )
26
+ }
24
27
25
28
// Uncomment to debug dokka processing (require to run debug in listen mode on 5005 port)
26
29
// javaOptions.in(run) += "-agentlib:jdwp=transport=dt_socket,server=n,address=localhost:5005,suspend=y"
@@ -29,19 +32,23 @@ fork.in(run) := true
29
32
Compile / mainClass := Some (" dotty.dokka.Main" )
30
33
31
34
32
- // TODO #35 proper sbt integration
33
- val generateDottyLibDocumentation = taskKey[Unit ](" Generate documentation for dotty lib" )
34
- generateDottyLibDocumentation := Def .taskDyn {
35
- val dotttyLib = fullClasspath.in(Compile ).value.find{ a =>
36
- val info = a.get(moduleID.key)
37
- info.nonEmpty &&
38
- info.get.organization == " ch.epfl.lamp" &&
39
- info.get.name.startsWith(" dotty-library" )
40
- }
41
- if (dotttyLib.isEmpty) Def .task {
35
+
36
+ def generateDottyDocsFromClasspath (artifacts : Seq [String ]) = Def .taskDyn {
37
+ val roots = artifacts.mkString(java.io.File .pathSeparator)
38
+ val mapping = " =https://github.com/lampepfl/dotty/tree/master#L"
39
+ if (artifacts.isEmpty) Def .task {
42
40
streams.value.log.error(" Dotty lib wasn't found" )
43
41
} else Def .task {
44
- run.in(Compile ).toTask(s " -o output/stdLib -t ${dotttyLib.get.data} -d dotty-docs/docs -n dotty-lib -s library/src=https://github.com/lampepfl/dotty/tree/master/library/src#L " ).value
42
+ run.in(Compile ).toTask(s " -o output/stdLib -t $roots -d dotty-docs/docs -n dotty-lib -s $mapping " ).value
45
43
}
44
+ }
45
+
46
+ val generateScala3Documentation = taskKey[Unit ](" Generate documentation for dotty lib" )
47
+ generateScala3Documentation := Def .taskDyn {
48
+ val dotttyJars = Build .aritfactsForScala3Documentation.value.map(_.toString)
49
+
50
+ streams.value.log.info(s " Documenting classes from: \n ${dotttyJars.mkString(" \n " )}" )
51
+
52
+ generateDottyDocsFromClasspath(dotttyJars)
46
53
}.value
47
54
0 commit comments