Skip to content

Commit

Permalink
Erase things in working dir in publish
Browse files Browse the repository at this point in the history
Working dir is a directory of our own, this shouldn't be a problem.

This was making 'scala-cli publish local -w .' fail with
file-already-exists exceptions.
  • Loading branch information
alexarchambault committed Dec 21, 2022
1 parent fb4fd62 commit d40d72d
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -517,15 +517,15 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
}
val content = Library.libraryJar(build, mainClassOpt)
val dest = workingDir / org / s"$moduleName-$ver.jar"
os.write(dest, content, createFolders = true)
os.write.over(dest, content, createFolders = true)
dest
}

val sourceJarOpt =
if (publishOptions.contextual(isCi).sourceJar.getOrElse(true)) {
val content = PackageCmd.sourceJar(build, now.toEpochMilli)
val sourceJar = workingDir / org / s"$moduleName-$ver-sources.jar"
os.write(sourceJar, content, createFolders = true)
os.write.over(sourceJar, content, createFolders = true)
Some(sourceJar)
}
else
Expand All @@ -538,7 +538,7 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
case Some(docBuild) =>
val docJarPath = value(PackageCmd.docJar(docBuild, logger, Nil))
val docJar = workingDir / org / s"$moduleName-$ver-javadoc.jar"
os.copy(docJarPath, docJar, createFolders = true)
os.copy.over(docJarPath, docJar, createFolders = true)
Some(docJar)
}
else
Expand Down

0 comments on commit d40d72d

Please sign in to comment.