Skip to content

Instantly share code, notes, and snippets.

@peterkuterna
Forked from jpeddicord/build.gradle
Created June 10, 2013 07:13
Show Gist options
  • Save peterkuterna/5747033 to your computer and use it in GitHub Desktop.
Save peterkuterna/5747033 to your computer and use it in GitHub Desktop.
// additional required configuration to hook into the build script
android {
signingConfigs {
release
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
// specify signing properties on the command line
if (hasProperty('storeFile')) {
println 'Generating a signed package.'
android.signingConfigs.release.storeFile = file(storeFile)
android.signingConfigs.release.storePassword = storePassword
android.signingConfigs.release.keyAlias = keyAlias
android.signingConfigs.release.keyPassword = keyPassword
} else {
android.buildTypes.release.signingConfig = null
}
#!/bin/bash
if [[ $# -ne 1 ]]; then
echo "Usage: $0 keystore"
exit 1
fi
if [[ ! -f $1 ]]; then
echo "$1 doesn't exist or isn't a keystore"
exit 1
fi
read -s -p "Keystore Password: " STORE_PASS
echo
read -p "Key Alias: " KEY_ALIAS
read -s -p "Key Password: " KEY_PASS
echo
export ORG_GRADLE_PROJECT_storeFile="$1"
export ORG_GRADLE_PROJECT_storePassword="$STORE_PASS"
export ORG_GRADLE_PROJECT_keyAlias="$KEY_ALIAS"
export ORG_GRADLE_PROJECT_keyPassword="$KEY_PASS"
./gradlew signingReport
read -p "Is this correct? [y/n] " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
./gradlew build
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment