Commit 4af2fc11 authored by Adrien's avatar Adrien

use the directory method from process builder instead of soing some weird stuff with cd

parent 19708232
......@@ -31,11 +31,10 @@ class MacCodeSign {
throw Throwable()
}
goToFileFolder(file)
logger.info("Signing osx application...")
val signResult = ProcessBuilder()
.inheritIO()
.directory(file.parentFile)
.command("codesign", "--deep", "-s", "Bonitasoft", file.name)
.start()
.waitFor()
......@@ -55,11 +54,10 @@ class MacCodeSign {
throw Throwable("Failed to delete temp file $zipFile")
}
goToFileFolder(file)
logger.info("Signing macOS installer...")
var signResult = ProcessBuilder()
.inheritIO()
.directory(file.parentFile)
.command("codesign", "--deep", "-s", "Bonitasoft", file.name)
.start()
.waitFor()
......@@ -72,7 +70,8 @@ class MacCodeSign {
var dmgPath = file.parentFile.canonicalPath + separator + file.nameWithoutExtension + ".dmg"
val buildDmgResult = ProcessBuilder()
.inheritIO()
.command("hdiutil", "create", "-volname", dmgName, "-srcfolder", file.canonicalPath, "-ov", "-format", "UDZO", dmgPath)
.directory(file.parentFile)
.command("hdiutil", "create", "-volname", dmgName, "-srcfolder", file.name, "-ov", "-format", "UDZO", dmgName + ".dmg")
.start()
.waitFor()
var dmg = File(dmgPath);
......@@ -83,7 +82,8 @@ class MacCodeSign {
logger.info("Signing macOS dmg...")
signResult = ProcessBuilder()
.inheritIO()
.command("codesign", "-s", "Bonitasoft", dmgPath)
.directory(dmg.parentFile)
.command("codesign", "-s", "Bonitasoft", dmg.name)
.start()
.waitFor()
if (signResult != 0) {
......@@ -106,7 +106,8 @@ class MacCodeSign {
fun unzip(zipFile: File): File {
ProcessBuilder()
.inheritIO()
.command("unzip", zipFile.canonicalPath, "-d", zipFile.parentFile.canonicalPath)
.directory(zipFile.parentFile)
.command("unzip", zipFile.name)
.start()
.waitFor()
......@@ -120,6 +121,7 @@ class MacCodeSign {
fun zip(file: File): File {
ProcessBuilder()
.inheritIO()
.directory(file.parentFile)
.command("zip", file.nameWithoutExtension + ".zip", "-r", file.name)
.start()
.waitFor()
......@@ -130,17 +132,10 @@ class MacCodeSign {
return zipFile
}
fun goToFileFolder(file: File) {
ProcessBuilder()
.inheritIO()
.command("cd", file.parentFile.canonicalPath)
.start()
.waitFor()
}
fun deleteApplication(application: File) {
ProcessBuilder()
.inheritIO()
.directory(application.parentFile)
.command("rm", "-r", application.name)
.start()
.waitFor()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment