[1.x] Fix #9190: avoid leaving partial jar after interrupted package (#9196)

Resource and JAR atomicity is pushed down into sbt/io 1.12.0-SNAPSHOT
(IO.copyFile, IO.transfer, IO.jar/zip stage to a sibling temp file and
atomic-move into place). Bump sbt's io dependency to consume that.

In Package.makeJar, stop deleting the existing JAR before calling IO.jar.
Atomic IO.jar replaces the destination only after the staged JAR is
complete, so deleting up front would just destroy the last good artifact
on interrupt without changing the failure mode.

Generated-by: Codex (gpt-5.5) and Claude Sonnet 4.6
This commit is contained in:
Anatolii Kmetiuk 2026-05-07 14:23:36 +09:00 committed by GitHub
parent f2d97b703e
commit 2fe2e10cc9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 4 deletions

View File

@ -221,9 +221,7 @@ object Package {
val path = jar.getAbsolutePath
log.debug("Packaging " + path + " ...")
if (jar.exists)
if (jar.isFile)
IO.delete(jar)
else
if (!jar.isFile)
sys.error(path + " exists, but is not a regular file")
log.debug(sourcesDebugString(sources))
IO.jar(sources, jar, manifest, time)

View File

@ -13,7 +13,7 @@ object Dependencies {
sys.env.get("BUILD_VERSION") orElse sys.props.get("sbt.build.version")
// sbt modules
private val ioVersion = nightlyVersion.getOrElse("1.10.5")
private val ioVersion = nightlyVersion.getOrElse("1.12.0")
private val lmVersion =
sys.props.get("sbt.build.lm.version").orElse(nightlyVersion).getOrElse("1.12.2")
val zincVersion = nightlyVersion.getOrElse("1.12.0")