mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-07 05:24:46 +01:00
sign release apks outside of gradle
My sign-inside-gradle is an uncommon trick and unnecessary. Better to follow the old convention of using jarsigner and zipalign.
This commit is contained in:
parent
ef2da21bbe
commit
acf7097fda
3 changed files with 43 additions and 55 deletions
|
@ -1,5 +1,3 @@
|
|||
import groovy.swing.SwingBuilder
|
||||
|
||||
def INITIAL_CLIENT_VERS = 8
|
||||
def VERSION_CODE_BASE = 114
|
||||
def VERSION_NAME = '4.4.118'
|
||||
|
@ -85,16 +83,6 @@ android {
|
|||
}
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
storeFile file(System.getenv("HOME") + "/.keystore")
|
||||
keyAlias "mykey"
|
||||
|
||||
// These two lines make gradle believe that the signingConfigs
|
||||
// section is complete. Without them, tasks like installRelease
|
||||
// will not be available!
|
||||
storePassword "notReal"
|
||||
keyPassword "notReal"
|
||||
}
|
||||
debug {
|
||||
def path = System.getenv("DEBUG_KEYSTORE_PATH")
|
||||
if (! path) {
|
||||
|
@ -109,7 +97,6 @@ android {
|
|||
|
||||
buildTypes {
|
||||
release {
|
||||
signingConfig signingConfigs.release
|
||||
debuggable false
|
||||
minifyEnabled false // PENDING
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
|
@ -237,43 +224,6 @@ task cleanNDK(type: Exec) {
|
|||
commandLine lst
|
||||
}
|
||||
|
||||
gradle.taskGraph.whenReady { taskGraph ->
|
||||
if ( taskGraph.hasTask(':app:validateSigningXw4Release') ) {
|
||||
def pass
|
||||
if (System.getenv("ANDROID_RELEASE_PASSWORD")) {
|
||||
pass = System.getenv("ANDROID_RELEASE_PASSWORD")
|
||||
} else if ( null != System.console() ) {
|
||||
pass = System.console().readPassword("\nPlease enter key passphrase: ")
|
||||
pass = new String(pass)
|
||||
} else {
|
||||
new SwingBuilder().edt {
|
||||
dialog(modal: true, // Otherwise the build will continue running before you closed the dialog
|
||||
title: 'Enter password', // Dialog title
|
||||
alwaysOnTop: true, // pretty much what the name says
|
||||
resizable: false, // Don't allow the user to resize the dialog
|
||||
locationRelativeTo: null, // Place dialog in center of the screen
|
||||
pack: true, // We need to pack the dialog (so it will take the size of it's children
|
||||
show: true // Let's show it
|
||||
) {
|
||||
vbox { // Put everything below each other
|
||||
label(text: "Please enter key passphrase:")
|
||||
input = passwordField();
|
||||
button(defaultButton: true, text: 'OK', actionPerformed: {
|
||||
pass = new String(input.password); // Set pass variable to value of input field
|
||||
// println "myPass: $myPass"
|
||||
|
||||
dispose(); // Close dialog
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
android.signingConfigs.release.storePassword = pass
|
||||
android.signingConfigs.release.keyPassword = pass
|
||||
}
|
||||
}
|
||||
|
||||
// def getVersionName() {
|
||||
// try {
|
||||
// def stdout = new ByteArrayOutputStream()
|
||||
|
|
|
@ -15,11 +15,7 @@ usage() {
|
|||
}
|
||||
|
||||
do_build() {
|
||||
WD=$(pwd)
|
||||
cd $(dirname $0)/../
|
||||
rm -rf bin/ gen/
|
||||
./gradlew clean assembleXw4Rel
|
||||
cd $WD
|
||||
(cd $(dirname $0)/../ && ./gradlew clean assembleXw4Rel)
|
||||
}
|
||||
|
||||
while [ "$#" -gt 0 ]; do
|
||||
|
@ -58,6 +54,9 @@ fi
|
|||
|
||||
if [ -z "$FILES" ]; then
|
||||
do_build
|
||||
for f in $(dirname $0)/../app/build/outputs/apk/*-unsigned-*.apk; do
|
||||
$(dirname $0)/sign-align.sh --apk $f
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -n "$TAGNAME" ]; then
|
||||
|
|
39
xwords4/android/scripts/sign-align.sh
Executable file
39
xwords4/android/scripts/sign-align.sh
Executable file
|
@ -0,0 +1,39 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -u -e
|
||||
|
||||
APKS=''
|
||||
XW_WWW_PATH=${XW_WWW_PATH:-''}
|
||||
LIST_FILE=1
|
||||
|
||||
usage() {
|
||||
[ $# -gt 0 ] && echo "ERROR: $1"
|
||||
echo "usage: $0 [--apk path/to/unsigned.apk]*"
|
||||
}
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
--apk)
|
||||
[ -e $2 ] || usage "no such file $2"
|
||||
APKS="$APKS $2"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
usage "Unexpected flag $1"
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
for APK in $APKS; do
|
||||
if [ ${APK/-unsigned} == $APK ]; then
|
||||
echo "$APK not unsigned; skipping"
|
||||
continue
|
||||
fi
|
||||
APK_SIGNED=/tmp/$$_tmp.apk
|
||||
cp $APK $APK_SIGNED
|
||||
jarsigner -verbose -digestalg SHA1 -keystore ~/.keystore $APK_SIGNED mykey
|
||||
rm -f ${APK/-unsigned/-signed}
|
||||
zipalign -v 4 $APK_SIGNED ${APK/-unsigned/-signed}
|
||||
rm -f $APK_SIGNED
|
||||
done
|
Loading…
Reference in a new issue