1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 16:28:12 -07:00

Handle jar signer errors.

This commit is contained in:
Cedric Beust 2015-11-27 23:13:02 -08:00
parent 2febea27a7
commit 1b472cd625
2 changed files with 10 additions and 4 deletions

View file

@ -23,6 +23,7 @@ open class RunCommand(val command: String) {
* This field is used to specify how errors are caught. * This field is used to specify how errors are caught.
*/ */
var useErrorStreamAsErrorIndicator = true var useErrorStreamAsErrorIndicator = true
var useInputStreamAsErrorIndicator = false
fun useErrorStreamAsErrorIndicator(f: Boolean) : RunCommand { fun useErrorStreamAsErrorIndicator(f: Boolean) : RunCommand {
useErrorStreamAsErrorIndicator = f useErrorStreamAsErrorIndicator = f
@ -52,6 +53,9 @@ open class RunCommand(val command: String) {
if (useErrorStreamAsErrorIndicator && ! hasErrors) { if (useErrorStreamAsErrorIndicator && ! hasErrors) {
hasErrors = hasErrors || hasErrorStream hasErrors = hasErrors || hasErrorStream
} }
if (useInputStreamAsErrorIndicator && ! hasErrors) {
hasErrors = hasErrors || process.inputStream.available() > 0
}
if (! hasErrors) { if (! hasErrors) {
successCallback(fromStream(process.inputStream)) successCallback(fromStream(process.inputStream))

View file

@ -308,17 +308,19 @@ public class AndroidPlugin @Inject constructor(val javaCompiler: JavaCompiler, v
throw KobaltException("No signingConfig found for product type $buildType") throw KobaltException("No signingConfig found for product type $buildType")
} }
val success = RunCommand("jarsigner").run(listOf( val success = RunCommand("jarsigner").apply {
// useInputStreamAsErrorIndicator = true
}.run(listOf(
"-keystore", signingConfig.storeFile, "-keystore", signingConfig.storeFile,
"-storepass", signingConfig.storePassword, "-storepass", signingConfig.storePassword,
"-keypass", signingConfig.keyPassword, "-keypass", signingConfig.keyPassword,
"-signedjar", apk, "-signedjar", apk,
temporaryApk, temporaryApk,
signingConfig.keyAlias signingConfig.keyAlias
)) ))
log(1, "Created $apk") log(1, "Created $apk")
return TaskResult(success == 0) return TaskResult(success == 0)
} }
@Task(name = "install", description = "Install the apk file", runAfter = arrayOf(TASK_GENERATE_DEX, "assemble")) @Task(name = "install", description = "Install the apk file", runAfter = arrayOf(TASK_GENERATE_DEX, "assemble"))