Skip to content

Commit 44cc8cd

Browse files
Support Scala Native 0.5.x changes in publishing artifacts (#2460)
1 parent 031e768 commit 44cc8cd

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

modules/options/src/main/scala/scala/build/options/ScalaNativeOptions.scala

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,19 @@ final case class ScalaNativeOptions(
115115
def platformSuffix: String =
116116
"native" + ScalaVersion.nativeBinary(finalVersion).getOrElse(finalVersion)
117117

118-
def nativeDependencies(scalaVersion: String): Seq[AnyDependency] =
118+
def nativeDependencies(scalaVersion: String): Seq[AnyDependency] = {
119+
// https://github.com/scala-native/scala-native/pull/3326
120+
val scalalibVersion =
121+
if (finalVersion.startsWith("0.4.")) finalVersion
122+
else s"$scalaVersion+$finalVersion"
123+
// Since 0.5.x Scala Native requires explicit dependency on javalib
124+
// See https://github.com/scala-native/scala-native/pull/3566
125+
val javalib = dep"org.scala-native::javalib::$finalVersion"
119126
if (scalaVersion.startsWith("2."))
120-
Seq(dep"org.scala-native::scalalib::$finalVersion")
127+
Seq(dep"org.scala-native::scalalib::$scalalibVersion", javalib)
121128
else
122-
Seq(dep"org.scala-native::scala3lib::$finalVersion")
129+
Seq(dep"org.scala-native::scala3lib::$scalalibVersion", javalib)
130+
}
123131

124132
def compilerPlugins: Seq[AnyDependency] =
125133
Seq(dep"org.scala-native:::nscplugin:$finalVersion")

0 commit comments

Comments
 (0)