Skip to content

Commit 42aae72

Browse files
authored
Merge pull request sbt#359 from adpi2/scala3doc
Add scala3doc artifact
2 parents 4fab9e0 + ec34dd7 commit 42aae72

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

core/src/main/scala/sbt/librarymanagement/ConfigurationExtra.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ object Configurations {
4848
lazy val Pom = Configuration.of("Pom", "pom")
4949

5050
lazy val ScalaTool = Configuration.of("ScalaTool", "scala-tool").hide
51+
lazy val ScalaDocTool = Configuration.of("ScalaDocTool", "scala-doc-tool").hide
5152
lazy val CompilerPlugin = Configuration.of("CompilerPlugin", "plugin").hide
5253
lazy val Component = Configuration.of("Component", "component").hide
5354

core/src/main/scala/sbt/librarymanagement/ScalaArtifacts.scala

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,22 @@ object ScalaArtifacts {
1313
final val Scala3CompilerID = "scala3-compiler"
1414
final val Scala3InterfacesID = "scala3-interfaces"
1515
final val TastyCoreID = "tasty-core"
16+
final val Scala3DocID = "scala3doc"
17+
final val Scala3TastyInspectorID = "scala3-tasty-inspector"
1618

1719
private[sbt] final val Scala3LibraryPrefix = Scala3LibraryID + "_"
1820
private[sbt] final val Scala3CompilerPrefix = Scala3CompilerID + "_"
1921
private[sbt] final val TastyCorePrefix = TastyCoreID + "_"
22+
private[sbt] final val Scala3DocPrefix = Scala3DocID + "_"
23+
private[sbt] final val Scala3TastyInspectorPrefix = Scala3TastyInspectorID + "_"
2024

2125
def isScala2Artifact(name: String): Boolean = {
2226
name == LibraryID || name == CompilerID || name == ReflectID || name == ActorsID || name == ScalapID
2327
}
2428
def isScala3Artifact(name: String): Boolean = {
2529
name.startsWith(Scala3LibraryPrefix) || name.startsWith(Scala3CompilerPrefix) ||
26-
name.startsWith(TastyCorePrefix) || name == Scala3InterfacesID
30+
name.startsWith(TastyCorePrefix) || name == Scala3InterfacesID ||
31+
name.startsWith(Scala3DocPrefix) || name.startsWith(Scala3TastyInspectorPrefix)
2732
}
2833

2934
def isScala3(scalaVersion: String): Boolean = scalaVersion.startsWith("3.")
@@ -48,6 +53,18 @@ object ScalaArtifacts {
4853
ModuleID(org, LibraryID, version)
4954
}
5055

56+
private[sbt] def docToolDependencies(
57+
org: String,
58+
version: String
59+
): Seq[ModuleID] =
60+
if (isScala3(version)) {
61+
Seq(
62+
ModuleID(org, Scala3DocID, version)
63+
.withConfigurations(Some(Configurations.ScalaDocTool.name + "->default(compile)"))
64+
.withCrossVersion(CrossVersion.binary)
65+
)
66+
} else Seq.empty
67+
5168
private[sbt] def toolDependencies(
5269
org: String,
5370
version: String
@@ -60,11 +77,11 @@ object ScalaArtifacts {
6077
)
6178
else
6279
Seq(
63-
scalaToolDependency(org, CompilerID, version),
64-
scalaToolDependency(org, LibraryID, version)
80+
scala2ToolDependency(org, CompilerID, version),
81+
scala2ToolDependency(org, LibraryID, version)
6582
)
6683

67-
private[this] def scalaToolDependency(org: String, id: String, version: String): ModuleID =
84+
private[this] def scala2ToolDependency(org: String, id: String, version: String): ModuleID =
6885
ModuleID(org, id, version).withConfigurations(
6986
Some(Configurations.ScalaTool.name + "->default,optional(default)")
7087
)

0 commit comments

Comments
 (0)