Merge pull request #3071 from eed3si9n/fport/3014

[fport] Check for regular file in Package.makeJar
This commit is contained in:
eugene yokota 2017-04-04 15:23:43 -07:00 committed by GitHub
commit a2b0037f64
3 changed files with 16 additions and 2 deletions

View File

@ -94,8 +94,13 @@ object Package {
ManifestAttributes((attribKeys zip attribVals) ++ { homepage map (h => (IMPLEMENTATION_URL, h.toString)) }: _*)
}
def makeJar(sources: Seq[(File, String)], jar: File, manifest: Manifest, log: Logger): Unit = {
log.info("Packaging " + jar.getAbsolutePath + " ...")
IO.delete(jar)
val path = jar.getAbsolutePath
log.info("Packaging " + path + " ...")
if (jar.exists)
if (jar.isFile)
IO.delete(jar)
else
sys.error(path + " exists, but is not a regular file")
log.debug(sourcesDebugString(sources))
IO.jar(sources, jar, manifest)
log.info("Done packaging.")

View File

@ -0,0 +1,5 @@
lazy val root = (project in file("."))
.settings(
name := "delete-target",
scalaVersion := "2.12.1"
)

View File

@ -0,0 +1,4 @@
$ mkdir target/scala-2.12/delete-target_2.12-0.1-SNAPSHOT.jar
$ touch target/scala-2.12/delete-target_2.12-0.1-SNAPSHOT.jar/hello
-> package
$ exists target/scala-2.12/delete-target_2.12-0.1-SNAPSHOT.jar/hello