From 49b04257d3f37acbd68e316ad4b34bf08e010866 Mon Sep 17 00:00:00 2001 From: Eric House Date: Thu, 1 Mar 2012 18:16:04 -0800 Subject: [PATCH 1/6] tweak date format --- xwords4/relay/scripts/showgames.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xwords4/relay/scripts/showgames.php b/xwords4/relay/scripts/showgames.php index 568ab4bb3..b3372b279 100644 --- a/xwords4/relay/scripts/showgames.php +++ b/xwords4/relay/scripts/showgames.php @@ -7,7 +7,7 @@ Date: Thu, 1 Mar 2012 22:10:41 -0800 Subject: [PATCH 2/6] add variant support --- xwords4/android/scripts/arelease.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/xwords4/android/scripts/arelease.sh b/xwords4/android/scripts/arelease.sh index a91818670..6de4bd4e7 100755 --- a/xwords4/android/scripts/arelease.sh +++ b/xwords4/android/scripts/arelease.sh @@ -4,19 +4,19 @@ set -u -e TAGNAME="" FILES="" +VARIANT="XWords4" XW_WWW_PATH=${XW_WWW_PATH:-""} usage() { echo "Error: $*" - echo "usage: $0 [--tag ] []" >&2 + echo "usage: $0 [--tag ] [--variant variant] []" >&2 exit 1 } do_build() { WD=$(pwd) - cd $(dirname $0)/../XWords4/ + cd $(dirname $0)/../${VARIANT}/ touch jni/Android.mk - ../scripts/ndkbuild.sh -j3 rm -rf bin/ gen/ ant release cd $WD @@ -24,10 +24,15 @@ do_build() { while [ "$#" -gt 0 ]; do case $1 in - --tag) TAGNAME=$2 + --tag) + TAGNAME=$2 git describe $TAGNAME || usage "$TAGNAME not a valid git tag" shift ;; + --variant) + VARIANT=$2 + shift + ;; *) FILES="$1" ;; From 542f10a3e559b56c270ae4ea24e6bf859e3cb965 Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 2 Mar 2012 05:49:25 -0800 Subject: [PATCH 3/6] improvements to work with variants -- though jni still doesn't compile. --- xwords4/android/scripts/arelease_clone.sh | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/xwords4/android/scripts/arelease_clone.sh b/xwords4/android/scripts/arelease_clone.sh index 05685377a..6bdac1da3 100755 --- a/xwords4/android/scripts/arelease_clone.sh +++ b/xwords4/android/scripts/arelease_clone.sh @@ -3,13 +3,14 @@ set -e -u usage () { - echo "usage: $(basename $0) [--tag tagname | --branch branchname]" + echo "usage: $(basename $0) [--tag tagname | --branch branchname] [--variant variant]" echo " # (uses current branch as default)" exit 0 } TAG="" BRANCH="" +VARIANT="XWords4" while [ 0 -lt $# ] ; do case $1 in @@ -21,6 +22,10 @@ while [ 0 -lt $# ] ; do BRANCH=$2 shift ;; + --variant) + VARIANT=$2 + shift + ;; *) usage ;; @@ -28,6 +33,8 @@ while [ 0 -lt $# ] ; do shift done +echo "VARIANT=$VARIANT" + if [ -n "$TAG" ]; then if ! git tag | grep -w "$TAG"; then echo "tag $TAG not found" @@ -37,7 +44,7 @@ elif [ -z $BRANCH ]; then BRANCH=$(git branch | grep '^*' | sed 's,^.* ,,') fi -echo "building with ${TAG}${BRANCH}" +echo "building $VARIANT with ${TAG}${BRANCH}" BUILDIR=/tmp/$(basename $0)_build_$$ SRCDIR=$(pwd)/$(dirname $0)/../../../ @@ -49,9 +56,11 @@ cd $BUILDIR git clone $SRCDIR BUILD cd BUILD git checkout ${TAG}${BRANCH} -./xwords4/android/scripts/setup_local_props.sh -./xwords4/android/scripts/arelease.sh -cp *.apk /tmp +cd ./xwords4/android/${VARIANT} +../scripts/setup_local_props.sh +../scripts/arelease.sh --variant ${VARIANT} +mkdir /tmp/releases_${VARIANT} +cp *.apk /tmp/releases_${VARIANT} cd $CURDIR rm -rf $BUILDIR From 319c9da2583a10adf22f47865c1f9b81c787943e Mon Sep 17 00:00:00 2001 From: Eric House Date: Mon, 5 Mar 2012 19:07:49 -0800 Subject: [PATCH 4/6] add -pre-clean that invokes the jni's 'make clean' --- xwords4/android/XWords4-dbg/build.xml | 6 ++++++ xwords4/android/XWords4/build.xml | 6 ++++++ xwords4/android/scripts/arelease.sh | 3 +-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/xwords4/android/XWords4-dbg/build.xml b/xwords4/android/XWords4-dbg/build.xml index 648b99617..bd032d3d9 100644 --- a/xwords4/android/XWords4-dbg/build.xml +++ b/xwords4/android/XWords4-dbg/build.xml @@ -49,6 +49,12 @@ + + + + + + diff --git a/xwords4/android/XWords4/build.xml b/xwords4/android/XWords4/build.xml index 10246e391..fadaa26a4 100644 --- a/xwords4/android/XWords4/build.xml +++ b/xwords4/android/XWords4/build.xml @@ -49,6 +49,12 @@ + + + + + + diff --git a/xwords4/android/scripts/arelease.sh b/xwords4/android/scripts/arelease.sh index 6de4bd4e7..100c0ce64 100755 --- a/xwords4/android/scripts/arelease.sh +++ b/xwords4/android/scripts/arelease.sh @@ -16,9 +16,8 @@ usage() { do_build() { WD=$(pwd) cd $(dirname $0)/../${VARIANT}/ - touch jni/Android.mk rm -rf bin/ gen/ - ant release + ant clean release cd $WD } From 79be6654dcd57775e8ff76419d4a55a05aec813d Mon Sep 17 00:00:00 2001 From: Eric House Date: Mon, 5 Mar 2012 19:16:03 -0800 Subject: [PATCH 5/6] -p to allow multiple runs --- xwords4/android/scripts/arelease_clone.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xwords4/android/scripts/arelease_clone.sh b/xwords4/android/scripts/arelease_clone.sh index 6bdac1da3..2edab13fe 100755 --- a/xwords4/android/scripts/arelease_clone.sh +++ b/xwords4/android/scripts/arelease_clone.sh @@ -59,7 +59,7 @@ git checkout ${TAG}${BRANCH} cd ./xwords4/android/${VARIANT} ../scripts/setup_local_props.sh ../scripts/arelease.sh --variant ${VARIANT} -mkdir /tmp/releases_${VARIANT} +mkdir -p /tmp/releases_${VARIANT} cp *.apk /tmp/releases_${VARIANT} cd $CURDIR From edf13be4c80ef93459f54c754d3e2172e10006f4 Mon Sep 17 00:00:00 2001 From: Eric House Date: Mon, 5 Mar 2012 20:04:32 -0800 Subject: [PATCH 6/6] I'm getting a crash on 2.1 in the simulator when calling DeleteGlobalRef then NewGlobalRef on the same ref. So use a temp to reverse the order. May fix reported crash as well. --- xwords4/android/XWords4/jni/anddict.c | 6 +++--- xwords4/android/XWords4/jni/drawwrapper.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/xwords4/android/XWords4/jni/anddict.c b/xwords4/android/XWords4/jni/anddict.c index 626124106..9b9b06362 100644 --- a/xwords4/android/XWords4/jni/anddict.c +++ b/xwords4/android/XWords4/jni/anddict.c @@ -139,9 +139,9 @@ andMakeBitmap( AndDictionaryCtxt* ctxt, XP_U8 const** ptrp, } JNIEnv* env = ctxt->env; - bitmap = and_util_makeJBitmap( ctxt->jniutil, nCols, nRows, colors ); - (*env)->DeleteLocalRef( env, bitmap ); - bitmap = (*env)->NewGlobalRef( env, bitmap ); + jobject tmp = and_util_makeJBitmap( ctxt->jniutil, nCols, nRows, colors ); + bitmap = (*env)->NewGlobalRef( env, tmp ); + (*env)->DeleteLocalRef( env, tmp ); XP_FREE( ctxt->super.mpool, colors ); #endif } diff --git a/xwords4/android/XWords4/jni/drawwrapper.c b/xwords4/android/XWords4/jni/drawwrapper.c index 05c3ea01b..7aef50ddb 100644 --- a/xwords4/android/XWords4/jni/drawwrapper.c +++ b/xwords4/android/XWords4/jni/drawwrapper.c @@ -56,9 +56,9 @@ makeJRect( AndDraw* draw, int indx, const XP_Rect* rect ) (*env)->DeleteLocalRef( env, rclass ); + draw->jCache[indx] = (*env)->NewGlobalRef( env, robj ); (*env)->DeleteLocalRef( env, robj ); - robj = (*env)->NewGlobalRef( env, robj ); - draw->jCache[indx] = robj; + robj = draw->jCache[indx]; } else { setInt( env, robj, "left", rect->left ); setInt( env, robj, "top", rect->top ); @@ -81,9 +81,9 @@ makeDSI( AndDraw* draw, int indx, const DrawScoreInfo* dsi ) dsiobj = (*env)->NewObject( env, rclass, initId ); (*env)->DeleteLocalRef( env, rclass ); + draw->jCache[indx] = (*env)->NewGlobalRef( env, dsiobj ); (*env)->DeleteLocalRef( env, dsiobj ); - dsiobj = (*env)->NewGlobalRef( env, dsiobj ); - draw->jCache[indx] = dsiobj; + dsiobj = draw->jCache[indx]; } setInt( env, dsiobj, "playerNum", dsi->playerNum );