Skip to content

Commit 709df8f

Browse files
committed
sbt-dotty: pick jars correctly even when source/docs are published
Previously this failed because we picked multiple jars when we were only excepting the binary jar.
1 parent 28a64a8 commit 709df8f

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

sbt-dotty/src/dotty/tools/sbtplugin/DottyPlugin.scala

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -172,21 +172,15 @@ object DottyPlugin extends AutoPlugin {
172172

173173
scalaCompilerBridgeBinaryJar := Def.settingDyn {
174174
if (isDotty.value) Def.task {
175-
val dottyBridgeArtifacts = fetchArtifactsOf(
175+
val updateReport = fetchArtifactsOf(
176176
scalaOrganization.value % "dotty-sbt-bridge" % scalaVersion.value,
177177
dependencyResolution.value,
178178
scalaModuleInfo.value,
179179
updateConfiguration.value,
180180
(unresolvedWarningConfiguration in update).value,
181181
streams.value.log,
182-
).allFiles
183-
val jars = dottyBridgeArtifacts.filter(art => art.getName.startsWith("dotty-sbt-bridge") && art.getName.endsWith(".jar")).toArray
184-
if (jars.size == 0)
185-
throw new MessageOnlyException("No jar found for dotty-sbt-bridge")
186-
else if (jars.size > 1)
187-
throw new MessageOnlyException(s"Multiple jars found for dotty-sbt-bridge: ${jars.toList}")
188-
else
189-
jars.headOption
182+
)
183+
Option(getJar(updateReport, scalaOrganization.value, "dotty-sbt-bridge", scalaVersion.value))
190184
}
191185
else Def.task {
192186
None: Option[File]
@@ -380,7 +374,7 @@ object DottyPlugin extends AutoPlugin {
380374
updateReport.select(
381375
configurationFilter(Runtime.name),
382376
moduleFilter(organization, name, revision),
383-
artifactFilter(extension = "jar")
377+
artifactFilter(extension = "jar", classifier = "")
384378
)
385379
}
386380

0 commit comments

Comments
 (0)