more gradle improvements. Seems to build a usable .apk, but isn't

doing release/debug right yet.
This commit is contained in:
Eric House 2015-11-05 20:19:07 -08:00
parent 7aff11d7b0
commit 9f28e5c350
4 changed files with 78 additions and 14 deletions

View file

@ -53,8 +53,9 @@ android {
res.srcDirs "src/${dir}/res"
}
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
assets.srcDirs = ['assets']
res.srcDirs = ['res']
res.srcDirs = ['res']
jniLibs.srcDir 'libs' // use the jni .so compiled from the manual ndk-build command
jni.srcDirs = [] // disable automatic ndk-build call
}
@ -65,25 +66,55 @@ android {
lintOptions {
abortOnError false
}
signingConfigs {
release {
String password = System.getenv("KEYSTORE_PASSWORD")
if (null == password || ''.equals(password)) {
password = new String(System.console().readPassword("\n\$ Enter keystore password: "))
}
storePassword password
keyPassword password
storeFile "${System.properties['user.home']}${File.separator}.keystore" as File
keyAlias 'mykey'
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}
}
task genVers(type: Exec) {
workingDir './'
commandLine '../scripts/genvers.sh', VARIANT_NAME,
INITIAL_CLIENT_VERS, CHAT_ENABLED, THUMBNAIL_ENABLED
INITIAL_CLIENT_VERS, CHAT_ENABLED, THUMBNAIL_ENABLED
}
task mkImages(type: Exec) {
workingDir './'
commandLine '../scripts/mkimages.sh'
commandLine '../scripts/mkimages.sh'
}
task copyStrings(type: Exec) {
workingDir './'
commandLine '../scripts/copy-strings.py'
commandLine '../scripts/copy-strings.py'
}
task myPreBuild(dependsOn: ['genVers', 'mkImages', 'copyStrings']) {
task ndkSetup(type: Exec) {
commandLine "../scripts/ndksetup.sh"
}
task genGcmid(type: Exec) {
commandLine '../scripts/gen_gcmid.sh',
'-o', "src/org/eehouse/android/$VARIANT_NAME/GCMConsts.java",
'-v', "$VARIANT_NAME"
}
task myPreBuild(dependsOn: ['genVers', 'ndkSetup', 'mkImages', 'copyStrings', 'mkXml', 'genGcmid']) {
}
task ndkBuild(type: Exec) {
@ -92,9 +123,14 @@ task ndkBuild(type: Exec) {
"INITIAL_CLIENT_VERS=$INITIAL_CLIENT_VERS", "VARIANT=$VARIANT_NAME", 'V=1'
}
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn myPreBuild
task mkXml(type: Exec) {
commandLine '../scripts/mk_xml.py', '-o',
"src/org/eehouse/android/$VARIANT_NAME/loc/LocIDsData.java",
'-t', "debug", '-v', "$VARIANT_NAME"
}
preBuild.dependsOn myPreBuild
tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn ndkBuild
}

View file

@ -58,10 +58,12 @@
<arg value="${VARIANT_NAME}"/>
</exec>
<exec dir="." executable="../scripts/gen_gcmid.sh"
output="src/org/eehouse/android/${VARIANT_NAME}/GCMConsts.java"
<exec dir="." executable="../scripts/gen_gcmid.sh"
logError="true" failonerror="true"
>
<arg value="-o"/>
<arg value="src/org/eehouse/android/${VARIANT_NAME}/GCMConsts.java"/>
<arg value="-v"/>
<arg value="${VARIANT_NAME}"/>
</exec>
<exec dir="." executable="../scripts/genvers.sh" output="/dev/null"

View file

@ -4,6 +4,31 @@ set -e -u
GCM_SENDER_ID=${GCM_SENDER_ID:-""}
CRITTERCISM_APP_ID=${CRITTERCISM_APP_ID:-""}
OUTFILE=""
VARIANT=""
usage() {
echo "usage: $0 -o outfile -v <variant>"
exit 1
}
while [ $# -gt 0 ]; do
case $1 in
-o)
OUTFILE=$2
shift
;;
-v)
VARIANT=$2
shift
;;
*)
echo "unexpected param $1"
usage
;;
esac
shift
done
if [ -z "$GCM_SENDER_ID" ]; then
echo "GCM_SENDER_ID empty; GCM use will be disabled" >&2
@ -12,9 +37,12 @@ if [ -z "$CRITTERCISM_APP_ID" ]; then
echo "CRITTERCISM_APP_ID empty; Crittercism will not be enabled" >&2
fi
PKG=$1
[ -z "$VARIANT" ] && usage
[ -z "$OUTFILE" ] && usage
cat <<EOF
PKG=$VARIANT
cat <<EOF > $OUTFILE
// Auto-generated: DO NOT CHECK THIS IN until questions about
// obscuring various ids are cleared up. For now they're not meant
// to be committed to public repos.

View file

@ -9,9 +9,7 @@ XWORDS_DEBUG_X86ONLY=${XWORDS_DEBUG_X86ONLYx:-""}
echo "# Generated by $0; do not edit!!!" > $TMP_MK
if [ "$1" = "release" ]; then
echo "APP_ABI := armeabi x86" >> $TMP_MK
elif [ -n "$XWORDS_DEBUG_ARMONLY" ]; then
if [ -n "$XWORDS_DEBUG_ARMONLY" ]; then
echo "APP_ABI := armeabi" >> $TMP_MK
elif [ -n "$XWORDS_DEBUG_X86ONLY" ]; then
echo "APP_ABI := x86" >> $TMP_MK