Skip to content

Commit

Permalink
Foolproof 'assemblyOutputPath'
Browse files Browse the repository at this point in the history
  • Loading branch information
hygt committed Mar 15, 2024
1 parent f2a9845 commit a92bc6f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main/scala/sbtassembly/Assembly.scala
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,15 @@ object Assembly {
.getOrElse(System.currentTimeMillis())

timed(Level.Debug, "Create jar") {
IO.delete(output)
createJar(output, jarEntriesToWrite, jarManifest, localTime)
if (output.isDirectory) {
val invalidPath = output.toPath.toAbsolutePath.normalize
log.error(s"Attempted to overwrite existing directory: $invalidPath")
log.error("Update 'assemblyOutputPath' key or manually delete the corresponding path.")
throw new RuntimeException("Exiting task")
} else {
IO.delete(output)
createJar(output, jarEntriesToWrite, jarManifest, localTime)
}
}
val fullSha1 = timed(Level.Debug, "Hash newly-built Jar") {
hash(output)
Expand Down

0 comments on commit a92bc6f

Please sign in to comment.