Skip to content

Commit

Permalink
breaking: remove keystore password prompt (apache#1048)
Browse files Browse the repository at this point in the history
  • Loading branch information
breautek authored and wedgberto committed May 17, 2022
1 parent 5ba12dd commit 3b85131
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 47 deletions.
24 changes: 2 additions & 22 deletions bin/templates/project/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,9 @@ android {
release {
// These must be set or Gradle will complain (even if they are overridden).
keyAlias = ""
keyPassword = "__unset" // And these must be set to non-empty in order to have the signing step added to the task graph.
keyPassword = ""
storeFile = null
storePassword = "__unset"
storePassword = ""
}
}
buildTypes {
Expand Down Expand Up @@ -350,26 +350,6 @@ dependencies {
// SUB-PROJECT DEPENDENCIES END
}

def promptForReleaseKeyPassword() {
if (!cdvReleaseSigningPropertiesFile) {
return;
}
if ('__unset'.equals(android.signingConfigs.release.storePassword)) {
android.signingConfigs.release.storePassword = privateHelpers.promptForPassword('Enter key store password: ')
}
if ('__unset'.equals(android.signingConfigs.release.keyPassword)) {
android.signingConfigs.release.keyPassword = privateHelpers.promptForPassword('Enter key password: ');
}
}

gradle.taskGraph.whenReady { taskGraph ->
taskGraph.getAllTasks().each() { task ->
if(['validateReleaseSigning', 'validateSigningRelease', 'validateSigningArmv7Release', 'validateSigningX76Release'].contains(task.name)) {
promptForReleaseKeyPassword()
}
}
}

def addSigningProps(propsFilePath, signingConfig) {
def propsFile = file(propsFilePath)
def props = new Properties()
Expand Down
25 changes: 0 additions & 25 deletions framework/cordova.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -131,30 +131,6 @@ def doExtractStringFromManifest(name) {
return matcher.group(1)
}

def doPromptForPassword(msg) {
if (System.console() == null) {
def ret = null
new SwingBuilder().edt {
dialog(modal: true, title: 'Enter password', alwaysOnTop: true, resizable: false, locationRelativeTo: null, pack: true, show: true) {
vbox {
label(text: msg)
def input = passwordField()
button(defaultButton: true, text: 'OK', actionPerformed: {
ret = input.password;
dispose();
})
}
}
}
if (!ret) {
throw new GradleException('User canceled build')
}
return new String(ret)
} else {
return System.console().readPassword('\n' + msg);
}
}

def doGetConfigXml() {
def xml = file("src/main/res/xml/config.xml").getText()
// Disable namespace awareness since Cordova doesn't use them properly
Expand Down Expand Up @@ -183,7 +159,6 @@ ext {
privateHelpers.findLatestInstalledBuildTools = { doFindLatestInstalledBuildTools('19.1.0') }
privateHelpers.extractIntFromManifest = { name -> doExtractIntFromManifest(name) }
privateHelpers.extractStringFromManifest = { name -> doExtractStringFromManifest(name) }
privateHelpers.promptForPassword = { msg -> doPromptForPassword(msg) }
privateHelpers.ensureValueExists = { filePath, props, key -> doEnsureValueExists(filePath, props, key) }

// These helpers can be used by plugins / projects and will not change.
Expand Down

0 comments on commit 3b85131

Please sign in to comment.