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

signApk for variants.

This commit is contained in:
Cedric Beust 2015-11-21 23:23:53 -08:00
parent f574274c9e
commit c004431946

View file

@ -59,6 +59,10 @@ public class AndroidPlugin @Inject constructor(val javaCompiler: JavaCompiler)
addVariantTasks(project, "generateR", runBefore = listOf("compile"), addVariantTasks(project, "generateR", runBefore = listOf("compile"),
runTask = { taskGenerateRFile(project) }) runTask = { taskGenerateRFile(project) })
addVariantTasks(project, "generateDex", runAfter = listOf("compile"), runBefore = listOf("assemble"),
runTask = { taskGenerateDex(project) })
addVariantTasks(project, "signApk", runAfter = listOf("generateDex"), runBefore = listOf("assemble"),
runTask = { taskSignApk(project) })
} }
context.pluginInfo.classpathContributors.add(this) context.pluginInfo.classpathContributors.add(this)
@ -292,7 +296,8 @@ public class AndroidPlugin @Inject constructor(val javaCompiler: JavaCompiler)
const val TASK_GENERATE_DEX = "generateDex" const val TASK_GENERATE_DEX = "generateDex"
} }
@Task(name = TASK_GENERATE_DEX, description = "Generate the dex file", runAfter = arrayOf("compile")) @Task(name = TASK_GENERATE_DEX, description = "Generate the dex file", runBefore = arrayOf("assemble"),
runAfter = arrayOf("compile"))
fun taskGenerateDex(project: Project): TaskResult { fun taskGenerateDex(project: Project): TaskResult {
// //
// Call dx to generate classes.dex // Call dx to generate classes.dex
@ -336,7 +341,7 @@ public class AndroidPlugin @Inject constructor(val javaCompiler: JavaCompiler)
*/ */
@Task(name = "signApk", description = "Sign the apk file", runAfter = arrayOf(TASK_GENERATE_DEX), @Task(name = "signApk", description = "Sign the apk file", runAfter = arrayOf(TASK_GENERATE_DEX),
runBefore = arrayOf("assemble")) runBefore = arrayOf("assemble"))
fun signApk(project: Project): TaskResult { fun taskSignApk(project: Project): TaskResult {
val apk = apk(project, context.variant.shortArchiveName) val apk = apk(project, context.variant.shortArchiveName)
val temporaryApk = temporaryApk(project, context.variant.shortArchiveName) val temporaryApk = temporaryApk(project, context.variant.shortArchiveName)
RunCommand("jarsigner").run(listOf( RunCommand("jarsigner").run(listOf(