mirror of https://github.com/sbt/sbt.git
Don't apply platform substitution to %
This commit is contained in:
parent
47ef80eadf
commit
6fee91bbff
|
|
@ -57,12 +57,12 @@ object ScalaArtifacts {
|
|||
|
||||
def libraryDependency(version: String): ModuleID = libraryDependency(Organization, version)
|
||||
|
||||
def libraryDependency(org: String, version: String): ModuleID = {
|
||||
if (isScala3(version))
|
||||
ModuleID(org, Scala3LibraryID, version).withCrossVersion(CrossVersion.binary)
|
||||
else
|
||||
ModuleID(org, LibraryID, version)
|
||||
}
|
||||
def libraryDependency(org: String, version: String): ModuleID =
|
||||
if isScala3(version) then
|
||||
ModuleID(org, Scala3LibraryID, version)
|
||||
.withCrossVersion(CrossVersion.binary)
|
||||
.platform(Platform.jvm)
|
||||
else ModuleID(org, LibraryID, version).platform(Platform.jvm)
|
||||
|
||||
private[sbt] def docToolDependencies(
|
||||
org: String,
|
||||
|
|
@ -79,6 +79,7 @@ object ScalaArtifacts {
|
|||
ModuleID(org, ScaladocID, version)
|
||||
.withConfigurations(Some(Configurations.ScalaDocTool.name + "->default(compile)"))
|
||||
.withCrossVersion(CrossVersion.binary)
|
||||
.platform(Platform.jvm)
|
||||
)
|
||||
else Seq.empty
|
||||
|
||||
|
|
@ -91,6 +92,7 @@ object ScalaArtifacts {
|
|||
ModuleID(org, Scala3CompilerID, version)
|
||||
.withConfigurations(Some(Configurations.ScalaTool.name + "->default(compile)"))
|
||||
.withCrossVersion(CrossVersion.binary)
|
||||
.platform(Platform.jvm)
|
||||
)
|
||||
else
|
||||
Seq(
|
||||
|
|
@ -99,9 +101,11 @@ object ScalaArtifacts {
|
|||
)
|
||||
|
||||
private[this] def scala2ToolDependency(org: String, id: String, version: String): ModuleID =
|
||||
ModuleID(org, id, version).withConfigurations(
|
||||
Some(Configurations.ScalaTool.name + "->default,optional(default)")
|
||||
)
|
||||
ModuleID(org, id, version)
|
||||
.withConfigurations(
|
||||
Some(Configurations.ScalaTool.name + "->default,optional(default)")
|
||||
)
|
||||
.platform(Platform.jvm)
|
||||
}
|
||||
|
||||
object SbtArtifacts {
|
||||
|
|
|
|||
|
|
@ -742,10 +742,13 @@ private[sbt] object IvySbt {
|
|||
case "" | Platform.jvm => m
|
||||
case _ => m.withName(s"${m.name}_$platformName")
|
||||
(m: ModuleID) =>
|
||||
(platform, m.platformOpt) match
|
||||
case (Some(p), None) => addSuffix(m, p)
|
||||
case (_, Some(p)) => addSuffix(m, p)
|
||||
case _ => m
|
||||
m.crossVersion match
|
||||
case _: Disabled => m
|
||||
case _ =>
|
||||
(platform, m.platformOpt) match
|
||||
case (Some(p), None) => addSuffix(m, p)
|
||||
case (_, Some(p)) => addSuffix(m, p)
|
||||
case _ => m
|
||||
}
|
||||
|
||||
private def toIvyArtifact(
|
||||
|
|
|
|||
|
|
@ -27,6 +27,20 @@ object PlatformResolutionSpec extends BaseIvySpecification {
|
|||
)
|
||||
}
|
||||
|
||||
test("sjs1 platform resolves % as JVM") {
|
||||
cleanCache()
|
||||
val m = module(
|
||||
exampleModuleId("0.6.0"),
|
||||
deps = Vector(junit),
|
||||
Some(scala2_13),
|
||||
platform = Some(sjs1),
|
||||
)
|
||||
assert(
|
||||
update(m).configurations.head.modules.map(_.toString).mkString
|
||||
contains "junit:junit:4.13.1"
|
||||
)
|
||||
}
|
||||
|
||||
test("None platform can specify .platform(sjs1) depenency") {
|
||||
cleanCache()
|
||||
val m = module(
|
||||
|
|
@ -64,6 +78,7 @@ object PlatformResolutionSpec extends BaseIvySpecification {
|
|||
|
||||
def exampleModuleId(v: String): ModuleID = ("com.example" % "foo" % v % Compile)
|
||||
def scopt = ("com.github.scopt" %% "scopt" % "4.1.0" % Compile)
|
||||
def junit = ("junit" % "junit" % "4.13.1" % Compile)
|
||||
override val resolvers = Vector(
|
||||
Resolver.mavenCentral,
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue