@@ -7,7 +7,6 @@ val dokkaSiteVersion = "0.1.9"
77libraryDependencies ++= Seq (
88 " org.scala-lang" %% " scala3-tasty-inspector" % scalaVersion.value,
99
10-
1110 " com.virtuslab.dokka" % " dokka-site" % dokkaSiteVersion,
1211 " org.scala-sbt" % " io_2.13" % " 1.3.4" ,
1312 " com.vladsch.flexmark" % " flexmark-all" % flexmarkVersion,
@@ -17,10 +16,14 @@ libraryDependencies ++= Seq(
1716) // a a
1817
1918val 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
2322
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+ }
2427
2528// Uncomment to debug dokka processing (require to run debug in listen mode on 5005 port)
2629// javaOptions.in(run) += "-agentlib:jdwp=transport=dt_socket,server=n,address=localhost:5005,suspend=y"
@@ -29,19 +32,23 @@ fork.in(run) := true
2932Compile / mainClass := Some (" dotty.dokka.Main" )
3033
3134
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 {
4240 streams.value.log.error(" Dotty lib wasn't found" )
4341 } 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
4543 }
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)
4653}.value
4754
0 commit comments