diff --git a/xwords4/android/XWords4/build.gradle b/xwords4/android/XWords4/build.gradle index 86a066d72..f40725db5 100644 --- a/xwords4/android/XWords4/build.gradle +++ b/xwords4/android/XWords4/build.gradle @@ -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 } diff --git a/xwords4/android/scripts/common_targets.xml b/xwords4/android/scripts/common_targets.xml index 63b664dbf..951d3bc7f 100644 --- a/xwords4/android/scripts/common_targets.xml +++ b/xwords4/android/scripts/common_targets.xml @@ -58,10 +58,12 @@ - + + + " + 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 < $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. diff --git a/xwords4/android/scripts/ndksetup.sh b/xwords4/android/scripts/ndksetup.sh index 0b437e54f..05d6ec201 100755 --- a/xwords4/android/scripts/ndksetup.sh +++ b/xwords4/android/scripts/ndksetup.sh @@ -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