Merge pull request #7234 from adpi2/fix-7233

[1.9.x] Fix #7233: copy artifact files of sbt plugin
This commit is contained in:
eugene yokota 2023-05-04 12:47:28 -04:00 committed by GitHub
commit 3d1349a37d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -2857,7 +2857,14 @@ object Classpaths {
val legacyPackages = packaged(defaultPackages).value
def addSuffix(a: Artifact): Artifact = a.withName(crossVersion(a.name))
val packages = legacyPackages.map { case (artifact, file) => addSuffix(artifact) -> file }
def copyArtifact(artifact: Artifact, file: File): (Artifact, File) = {
val nameWithSuffix = crossVersion(artifact.name)
val targetFile =
new File(file.getParentFile, file.name.replace(artifact.name, nameWithSuffix))
IO.copyFile(file, targetFile)
artifact.withName(nameWithSuffix) -> targetFile
}
val packages = legacyPackages.map { case (artifact, file) => copyArtifact(artifact, file) }
val legacyPackagedArtifacts = Def
.ifS(sbtPluginPublishLegacyMavenStyle.toTask)(packaged(defaultArtifactTasks))(
Def.task(Map.empty[Artifact, File])