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(version: String): ModuleID = libraryDependency(Organization, version)
|
||||||
|
|
||||||
def libraryDependency(org: String, version: String): ModuleID = {
|
def libraryDependency(org: String, version: String): ModuleID =
|
||||||
if (isScala3(version))
|
if isScala3(version) then
|
||||||
ModuleID(org, Scala3LibraryID, version).withCrossVersion(CrossVersion.binary)
|
ModuleID(org, Scala3LibraryID, version)
|
||||||
else
|
.withCrossVersion(CrossVersion.binary)
|
||||||
ModuleID(org, LibraryID, version)
|
.platform(Platform.jvm)
|
||||||
}
|
else ModuleID(org, LibraryID, version).platform(Platform.jvm)
|
||||||
|
|
||||||
private[sbt] def docToolDependencies(
|
private[sbt] def docToolDependencies(
|
||||||
org: String,
|
org: String,
|
||||||
|
|
@ -79,6 +79,7 @@ object ScalaArtifacts {
|
||||||
ModuleID(org, ScaladocID, version)
|
ModuleID(org, ScaladocID, version)
|
||||||
.withConfigurations(Some(Configurations.ScalaDocTool.name + "->default(compile)"))
|
.withConfigurations(Some(Configurations.ScalaDocTool.name + "->default(compile)"))
|
||||||
.withCrossVersion(CrossVersion.binary)
|
.withCrossVersion(CrossVersion.binary)
|
||||||
|
.platform(Platform.jvm)
|
||||||
)
|
)
|
||||||
else Seq.empty
|
else Seq.empty
|
||||||
|
|
||||||
|
|
@ -91,6 +92,7 @@ object ScalaArtifacts {
|
||||||
ModuleID(org, Scala3CompilerID, version)
|
ModuleID(org, Scala3CompilerID, version)
|
||||||
.withConfigurations(Some(Configurations.ScalaTool.name + "->default(compile)"))
|
.withConfigurations(Some(Configurations.ScalaTool.name + "->default(compile)"))
|
||||||
.withCrossVersion(CrossVersion.binary)
|
.withCrossVersion(CrossVersion.binary)
|
||||||
|
.platform(Platform.jvm)
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
Seq(
|
Seq(
|
||||||
|
|
@ -99,9 +101,11 @@ object ScalaArtifacts {
|
||||||
)
|
)
|
||||||
|
|
||||||
private[this] def scala2ToolDependency(org: String, id: String, version: String): ModuleID =
|
private[this] def scala2ToolDependency(org: String, id: String, version: String): ModuleID =
|
||||||
ModuleID(org, id, version).withConfigurations(
|
ModuleID(org, id, version)
|
||||||
Some(Configurations.ScalaTool.name + "->default,optional(default)")
|
.withConfigurations(
|
||||||
)
|
Some(Configurations.ScalaTool.name + "->default,optional(default)")
|
||||||
|
)
|
||||||
|
.platform(Platform.jvm)
|
||||||
}
|
}
|
||||||
|
|
||||||
object SbtArtifacts {
|
object SbtArtifacts {
|
||||||
|
|
|
||||||
|
|
@ -742,10 +742,13 @@ private[sbt] object IvySbt {
|
||||||
case "" | Platform.jvm => m
|
case "" | Platform.jvm => m
|
||||||
case _ => m.withName(s"${m.name}_$platformName")
|
case _ => m.withName(s"${m.name}_$platformName")
|
||||||
(m: ModuleID) =>
|
(m: ModuleID) =>
|
||||||
(platform, m.platformOpt) match
|
m.crossVersion match
|
||||||
case (Some(p), None) => addSuffix(m, p)
|
case _: Disabled => m
|
||||||
case (_, Some(p)) => addSuffix(m, p)
|
case _ =>
|
||||||
case _ => m
|
(platform, m.platformOpt) match
|
||||||
|
case (Some(p), None) => addSuffix(m, p)
|
||||||
|
case (_, Some(p)) => addSuffix(m, p)
|
||||||
|
case _ => m
|
||||||
}
|
}
|
||||||
|
|
||||||
private def toIvyArtifact(
|
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") {
|
test("None platform can specify .platform(sjs1) depenency") {
|
||||||
cleanCache()
|
cleanCache()
|
||||||
val m = module(
|
val m = module(
|
||||||
|
|
@ -64,6 +78,7 @@ object PlatformResolutionSpec extends BaseIvySpecification {
|
||||||
|
|
||||||
def exampleModuleId(v: String): ModuleID = ("com.example" % "foo" % v % Compile)
|
def exampleModuleId(v: String): ModuleID = ("com.example" % "foo" % v % Compile)
|
||||||
def scopt = ("com.github.scopt" %% "scopt" % "4.1.0" % Compile)
|
def scopt = ("com.github.scopt" %% "scopt" % "4.1.0" % Compile)
|
||||||
|
def junit = ("junit" % "junit" % "4.13.1" % Compile)
|
||||||
override val resolvers = Vector(
|
override val resolvers = Vector(
|
||||||
Resolver.mavenCentral,
|
Resolver.mavenCentral,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue