@@ -136,7 +136,7 @@ object Build {
136136
137137 val fetchScalaJSSource = taskKey[File ](" Fetch the sources of Scala.js" )
138138
139- val aritfactsForScala3Documentation = taskKey[Seq [File ]](" All artifacts to document " )
139+ val artifactsForScala3Documentation = taskKey[Seq [File ]](" Artifacts to be documented by Scala3doc " )
140140
141141 lazy val SourceDeps = config(" sourcedeps" )
142142
@@ -1160,7 +1160,6 @@ object Build {
11601160
11611161 lazy val `scala3doc` = project.in(file(" scala3doc" )).asScala3doc
11621162 lazy val `scala3doc-test` = project.in(file(" scala3doc-test" )).asScala3docTest
1163- lazy val `scala3doc-example-project` = project.in(file(" scala3doc-example-project" )).asDocExampleProject
11641163
11651164 // sbt plugin to use Dotty in your own build, see
11661165 // https://github.com/lampepfl/scala3-example-project for usage.
@@ -1449,78 +1448,59 @@ object Build {
14491448 settings(commonBenchmarkSettings).
14501449 enablePlugins(JmhPlugin )
14511450
1452- def commonScala3DocSettings = commonBootstrappedSettings ++ Seq (
1453- scalaVersion := dottyVersion,
1451+ def commonScala3docSettings = Seq (
14541452 resolvers += Resolver .jcenterRepo,
14551453 resolvers += Resolver .bintrayRepo(" kotlin" , " kotlin-dev" ),
14561454 resolvers += Resolver .bintrayRepo(" virtuslab" , " dokka" ),
14571455 )
14581456
1459- def asScala3doc : Project =
1460- project.
1461- settings(commonScala3DocSettings ).
1457+ def asScala3doc : Project =
1458+ project.settings(commonBootstrappedSettings).
1459+ settings(commonScala3docSettings ).
14621460 dependsOn(`scala3-compiler-bootstrapped`).
14631461 dependsOn(`scala3-tasty-inspector`).
1464- settings(aritfactsForScala3Documentation := Seq (
1465- // All projects below will be put co generated documentaiton for Scala 3
1466- classDirectory.in(`scala3-interfaces`).in(Compile ).value,
1467- classDirectory.in(`tasty-core`).in(Compile ).value,
1468- classDirectory.in(`scala3-library`).in(Compile ).value,
1469- // TODO this one fails to load using TASTY
1470- // classDirectory.in(`stdlib-bootstrapped`).in(Compile).value,
1462+ settings(artifactsForScala3Documentation := Seq (
1463+ // All projects below will be used to generated documentation for Scala 3
1464+ classDirectory.in(`scala3-interfaces`).in(Compile ).value,
1465+ classDirectory.in(`tasty-core`).in(Compile ).value,
1466+ classDirectory.in(`scala3-library`).in(Compile ).value,
1467+ // TODO this one fails to load using TASTY
1468+ // classDirectory.in(`stdlib-bootstrapped`).in(Compile).value,
14711469 ))
14721470
1473- def asScala3docTest : Project =
1474- project.
1475- settings(commonScala3DocSettings).
1476- dependsOn(`scala3doc`)
1477-
1478- def asDocExampleProject : Project = project.
1479- settings(commonBootstrappedSettings0).
1480- dependsOn(`scala3-compiler-bootstrapped`).
1481- settings(
1482- Compile / scalaSource := baseDirectory.value / " src/main/scala" ,
1483- Test / scalaSource := baseDirectory.value / " src/test/scala" ,
1484- Compile / resourceDirectory := baseDirectory.value / " src/main/resources" ,
1485- Test / resourceDirectory := baseDirectory.value / " src/test/resources" ,
1486-
1487- name := " scala3doc-example-project" ,
1488- description := " Example SBT project that is documented using Scala3doc" ,
1489- version := " 0.1.0-SNAPSHOT" ,
1490- scalaVersion := dottyVersion,
1491-
1492- useScala3doc := true ,
1493- scala3docOptions ++= Seq (" --name" , " example-project" ),
1494- Compile / doc / target := file(" out/doc/example-project" ),
1495-
1496- // we cannot set
1497- doc/ scalaInstance := {
1498- val externalNonBootstrappedDeps = externalDependencyClasspath.in(`scala3doc`, Compile ).value
1499- val scalaLibrary = findArtifact(externalNonBootstrappedDeps, " scala-library" )
1500-
1501- // IMPORTANT: We need to use actual jars to form the ScalaInstance and not
1502- // just directories containing classfiles because sbt maintains a cache of
1503- // compiler instances. This cache is invalidated based on timestamps
1504- // however this is only implemented on jars, directories are never
1505- // invalidated.
1506- val tastyCore = packageBin.in(`tasty-core`, Compile ).value
1507- val dottyLibrary = packageBin.in(`scala3-library-bootstrapped`, Compile ).value
1508- val dottyInterfaces = packageBin.in(`scala3-interfaces`, Compile ).value
1509- val dottyCompiler = packageBin.in(`scala3-compiler-bootstrapped`, Compile ).value
1510- val doctool = packageBin.in(`scala3doc`, Compile ).value
1511-
1512- val allJars = Seq (tastyCore, dottyLibrary, dottyInterfaces, dottyCompiler, doctool) ++ externalNonBootstrappedDeps.map(_.data)
1513-
1514- makeScalaInstance(
1515- state.value,
1516- scalaVersion.value,
1517- scalaLibrary,
1518- dottyLibrary,
1519- dottyCompiler,
1520- allJars
1521- )
1522- },
1523- )
1471+ def asScala3docTest : Project =
1472+ project.settings(commonBootstrappedSettings0).
1473+ settings(commonScala3docSettings).
1474+ dependsOn(`scala3doc`).
1475+ settings(
1476+ Compile / doc/ target := baseDirectory.value / " ../out/doc" / name.value,
1477+ doc/ scalaInstance := {
1478+ val externalNonBootstrappedDeps = externalDependencyClasspath.in(`scala3doc`, Compile ).value
1479+ val scalaLibrary = findArtifact(externalNonBootstrappedDeps, " scala-library" )
1480+
1481+ // IMPORTANT: We need to use actual jars to form the ScalaInstance and not
1482+ // just directories containing classfiles because sbt maintains a cache of
1483+ // compiler instances. This cache is invalidated based on timestamps
1484+ // however this is only implemented on jars, directories are never
1485+ // invalidated.
1486+ val tastyCore = packageBin.in(`tasty-core`, Compile ).value
1487+ val dottyLibrary = packageBin.in(`scala3-library-bootstrapped`, Compile ).value
1488+ val dottyInterfaces = packageBin.in(`scala3-interfaces`, Compile ).value
1489+ val dottyCompiler = packageBin.in(`scala3-compiler-bootstrapped`, Compile ).value
1490+ val doctool = packageBin.in(`scala3doc`, Compile ).value
1491+
1492+ val allJars = Seq (tastyCore, dottyLibrary, dottyInterfaces, dottyCompiler, doctool) ++ externalNonBootstrappedDeps.map(_.data)
1493+
1494+ makeScalaInstance(
1495+ state.value,
1496+ scalaVersion.value,
1497+ scalaLibrary,
1498+ dottyLibrary,
1499+ dottyCompiler,
1500+ allJars
1501+ )
1502+ },
1503+ )
15241504
15251505 def asDist (implicit mode : Mode ): Project = project.
15261506 enablePlugins(PackPlugin ).
0 commit comments