Commit 0e15f39a authored by Adrien's avatar Adrien

add a goToFileFolder method to avoid difficulties while signing

parent 2848a2ad
......@@ -31,10 +31,12 @@ class MacCodeSign {
throw Throwable()
}
goToFileFolder(file)
logger.info("Signing osx application...")
val signResult = ProcessBuilder()
.inheritIO()
.command("codesign", "--deep", "-s", "Bonitasoft", file.canonicalPath)
.command("codesign", "--deep", "-s", "Bonitasoft", file.name)
.start()
.waitFor()
if (signResult != 0) {
......@@ -42,11 +44,8 @@ class MacCodeSign {
}
var newZipFile = zip(file);
deleteApplication(file)
logger.info("Osx application has been signed successfully")
return newZipFile
}
......@@ -56,10 +55,12 @@ class MacCodeSign {
throw Throwable("Failed to delete temp file $zipFile")
}
goToFileFolder(file)
logger.info("Signing macOS installer...")
var signResult = ProcessBuilder()
.inheritIO()
.command("codesign", "--deep", "-s", "Bonitasoft", file.canonicalPath)
.command("codesign", "--deep", "-s", "Bonitasoft", file.name)
.start()
.waitFor()
if (signResult != 0) {
......@@ -126,23 +127,30 @@ class MacCodeSign {
}
fun zip(file: File): File {
val zipPath: String = file.parentFile.canonicalPath + separator + file.nameWithoutExtension + ".zip"
ProcessBuilder()
.inheritIO()
.command("zip", zipPath, "-r", file.canonicalPath)
.command("zip", file.nameWithoutExtension + ".zip", "-r", file.name)
.start()
.waitFor()
var zipFile = File(zipPath)
var zipFile = File(file.parentFile.canonicalPath + separator + file.nameWithoutExtension + ".zip")
if (!zipFile.exists()) {
throw Throwable("failed to zip $file")
}
return zipFile
}
fun goToFileFolder(file: File) {
ProcessBuilder()
.inheritIO()
.command("cd", file.parentFile.canonicalPath)
.start()
.waitFor()
}
fun deleteApplication(application: File) {
ProcessBuilder()
.inheritIO()
.command("rm", "-r", application.canonicalPath)
.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