com.alexvasilkov.AndroidSignPlugin.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of android_sign Show documentation
Show all versions of android_sign Show documentation
AndroidGradleSignPlugin is a Gradle plugin for signing Android app with release keystore using command line prompt
package com.alexvasilkov
import org.gradle.api.Project
import org.gradle.api.Plugin
class AndroidSignPlugin implements Plugin {
void apply(Project project) {
project.task('askForPasswords') << {
// Must create String because System.readPassword() returns char[]
def storePw = new String(System.console().readPassword("\nKeystore password: "))
def keyPw = new String(System.console().readPassword("Key password: "))
project.android.signingConfigs.release.storePassword = storePw
project.android.signingConfigs.release.keyPassword = keyPw
}
project.configure(project) {
if (it.hasProperty("android")) {
tasks.whenTaskAdded { theTask ->
if (theTask.name.equals("packageRelease")
&& it.android.hasProperty("signingConfigs")
&& it.android.signingConfigs.hasProperty("release")) {
it.android.signingConfigs.release.storePassword = "-"
it.android.signingConfigs.release.keyPassword = "-"
theTask.dependsOn "askForPasswords"
}
}
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy