-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reorganize and clean up some build files (#168)
* Reorganize and clean up some build files * Revert to wpilibsuite
- Loading branch information
Showing
7 changed files
with
262 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import groovy.json.JsonSlurper | ||
|
||
ext.notarize = { File application, String id, String username, String password -> | ||
// Step 1: archive the application. | ||
println "Archiving application..." | ||
exec { commandLine "ditto", "-c", "-k", "--keepParent", application.getAbsolutePath(), "/tmp/archive.zip" } | ||
|
||
// Step 2: submit application for notarization. | ||
println "Submitting application to notarization service..." | ||
def stdout = new ByteArrayOutputStream() | ||
def result = exec { | ||
commandLine "xcrun", "altool", "--output-format", "json", "--notarize-app", "-f", "/tmp/archive.zip", | ||
"--primary-bundle-id", id, "-u", username, "-p", password | ||
standardOutput = stdout | ||
ignoreExitValue(true) | ||
} | ||
|
||
if (result.exitValue != 0) { | ||
println stdout.toString() | ||
return | ||
} | ||
|
||
// Step 3: process the request UUID. | ||
def parser = new JsonSlurper() | ||
def object = parser.parseText(stdout.toString()) | ||
def uuid = object["notarization-upload"]["RequestUUID"] as String | ||
println "Submitted application with UUID: $uuid" | ||
|
||
// Step 4: wait until notarization is complete. | ||
def success = false | ||
String[] args = ["xcrun", "altool", "--output-format", "json", "--notarization-info", uuid, | ||
"-u", username, "-p", password] | ||
|
||
for (int i = 0; i < 40; i++) { | ||
stdout = new ByteArrayOutputStream() | ||
result = exec { | ||
commandLine args | ||
standardOutput = stdout | ||
ignoreExitValue(true) | ||
} | ||
|
||
if (result.exitValue != 0) { | ||
println stdout.toString() | ||
return | ||
} | ||
|
||
def response = parser.parseText(stdout.toString())["notarization-info"] | ||
def exit = false | ||
|
||
switch (response["Status"] as String) { | ||
case "in progress": | ||
println "Notarization is in progress..." | ||
break | ||
case "invalid": | ||
exit = true | ||
println "Notarization was invalid: ${response["Status Message"] as String}" | ||
break | ||
case "success": | ||
exit = true | ||
success = true | ||
println "Notarization succeeded!" | ||
break | ||
default: | ||
exit = true | ||
println "Unknown status" | ||
break | ||
} | ||
|
||
if (exit) break | ||
Thread.sleep(30000) | ||
} | ||
|
||
if (!success) throw new GradleException("The notarization failed!") | ||
|
||
// Step 5: staple the notarization ticket. | ||
println "Stapling notarization ticket..." | ||
exec { commandLine "xcrun", "stapler", "staple", "-v", application.getAbsolutePath() } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.