mirror of https://github.com/sbt/sbt.git
Fix #7285: use legacy Maven style on publishLocal
This commit is contained in:
parent
ca09ee96fd
commit
dd00e143f2
|
|
@ -2835,14 +2835,21 @@ object Classpaths {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
private val publishSbtPluginMavenStyle = Def.task {
|
private lazy val publishSbtPluginMavenStyle = Def.task(sbtPlugin.value && publishMavenStyle.value)
|
||||||
sbtPlugin.value && publishMavenStyle.value
|
private lazy val packagedDefaultArtifacts = packaged(defaultArtifactTasks)
|
||||||
}
|
private lazy val emptyArtifacts = Def.task(Map.empty[Artifact, File])
|
||||||
|
|
||||||
val jvmPublishSettings: Seq[Setting[_]] = Seq(
|
val jvmPublishSettings: Seq[Setting[_]] = Seq(
|
||||||
artifacts := artifactDefs(defaultArtifactTasks).value,
|
artifacts := artifactDefs(defaultArtifactTasks).value,
|
||||||
packagedArtifacts := Def
|
packagedArtifacts := Def
|
||||||
.ifS(publishSbtPluginMavenStyle)(mavenArtifactsOfSbtPlugin)(packaged(defaultArtifactTasks))
|
.ifS(publishSbtPluginMavenStyle)(mavenArtifactsOfSbtPlugin)(packagedDefaultArtifacts)
|
||||||
.value,
|
.value,
|
||||||
|
// publishLocal needs legacy artifacts (see https://github.com/sbt/sbt/issues/7285)
|
||||||
|
publishLocal / packagedArtifacts ++= {
|
||||||
|
if (sbtPlugin.value && !sbtPluginPublishLegacyMavenStyle.value) {
|
||||||
|
packagedDefaultArtifacts.value
|
||||||
|
} else Map.empty[Artifact, File]
|
||||||
|
}
|
||||||
) ++ RemoteCache.projectSettings
|
) ++ RemoteCache.projectSettings
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -2867,9 +2874,7 @@ object Classpaths {
|
||||||
}
|
}
|
||||||
val packages = legacyPackages.map { case (artifact, file) => copyArtifact(artifact, file) }
|
val packages = legacyPackages.map { case (artifact, file) => copyArtifact(artifact, file) }
|
||||||
val legacyPackagedArtifacts = Def
|
val legacyPackagedArtifacts = Def
|
||||||
.ifS(sbtPluginPublishLegacyMavenStyle.toTask)(packaged(defaultArtifactTasks))(
|
.ifS(sbtPluginPublishLegacyMavenStyle.toTask)(packagedDefaultArtifacts)(emptyArtifacts)
|
||||||
Def.task(Map.empty[Artifact, File])
|
|
||||||
)
|
|
||||||
.value
|
.value
|
||||||
packages + (addSuffix(legacyArtifact) -> pom) ++ legacyPackagedArtifacts
|
packages + (addSuffix(legacyArtifact) -> pom) ++ legacyPackagedArtifacts
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,18 @@ lazy val testMaven2 = project.in(file("test-maven-2"))
|
||||||
).value
|
).value
|
||||||
)
|
)
|
||||||
|
|
||||||
|
lazy val testLocal2 = project.in(file("test-local-2"))
|
||||||
|
.settings(
|
||||||
|
addSbtPlugin("org.example" % "sbt-plugin-2" % "0.1.0-SNAPSHOT"),
|
||||||
|
checkUpdate := checkUpdateDef(
|
||||||
|
"sbt-plugin-2.jar", // resolved from local repository
|
||||||
|
"sbt-plugin-example-diamond_2.12_1.0-0.5.0.jar",
|
||||||
|
"sbt-plugin-example-left_2.12_1.0-0.3.0.jar",
|
||||||
|
"sbt-plugin-example-right_2.12_1.0-0.3.0.jar",
|
||||||
|
"sbt-plugin-example-bottom_2.12_1.0-0.3.0.jar",
|
||||||
|
).value
|
||||||
|
)
|
||||||
|
|
||||||
lazy val checkPackagedArtifacts = taskKey[Unit]("check the packaged artifacts")
|
lazy val checkPackagedArtifacts = taskKey[Unit]("check the packaged artifacts")
|
||||||
lazy val checkPublish = taskKey[Unit]("check publish")
|
lazy val checkPublish = taskKey[Unit]("check publish")
|
||||||
lazy val checkUpdate = taskKey[Unit]("check update")
|
lazy val checkUpdate = taskKey[Unit]("check update")
|
||||||
|
|
|
||||||
|
|
@ -17,3 +17,8 @@
|
||||||
> testMaven2 / checkUpdate
|
> testMaven2 / checkUpdate
|
||||||
> set testMaven2 / useCoursier := false
|
> set testMaven2 / useCoursier := false
|
||||||
> testMaven2 / checkUpdate
|
> testMaven2 / checkUpdate
|
||||||
|
|
||||||
|
> sbtPlugin2 / publishLocal
|
||||||
|
> testLocal2 / checkUpdate
|
||||||
|
> set testLocal2 / useCoursier := false
|
||||||
|
> testLocal2 / checkUpdate
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue