mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-09 05:24:44 +01:00
Merge branch 'android_branch' into relay_noconn
Conflicts: xwords4/android/XWords4-dbg/AndroidManifest.xml xwords4/android/XWords4-dbg/res/layout/.gitignore xwords4/android/XWords4-dbg/src/org/eehouse/android/xw4dbg/.gitignore
This commit is contained in:
commit
265ac48b88
4 changed files with 93 additions and 56 deletions
|
@ -56,9 +56,9 @@
|
||||||
<uses-feature android:name="android.hardware.nfc" android:required="false" />
|
<uses-feature android:name="android.hardware.nfc" android:required="false" />
|
||||||
|
|
||||||
<!-- GCM stuff -->
|
<!-- GCM stuff -->
|
||||||
<permission android:name="org.eehouse.android.xw4.permission.C2D_MESSAGE"
|
<permission android:name="org.eehouse.android.xw4dbg.permission.C2D_MESSAGE"
|
||||||
android:protectionLevel="signature" />
|
android:protectionLevel="signature" />
|
||||||
<uses-permission android:name="org.eehouse.android.xw4.permission.C2D_MESSAGE" />
|
<uses-permission android:name="org.eehouse.android.xw4dbg.permission.C2D_MESSAGE" />
|
||||||
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
|
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
|
||||||
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
|
@ -252,7 +252,7 @@
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
|
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
|
||||||
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
|
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
|
||||||
<category android:name="org.eehouse.android.xw4" />
|
<category android:name="org.eehouse.android.xw4dbg" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
|
|
|
@ -3,35 +3,37 @@
|
||||||
set -e -u
|
set -e -u
|
||||||
|
|
||||||
INDEX=0
|
INDEX=0
|
||||||
|
DRYRUN=''
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo "usage: $0 [--help] [-n <index>]"
|
[ $# -gt 0 ] && echo "ERROR: $1"
|
||||||
|
echo "usage: $0 [--dry-run] [--help] [-n <index>]"
|
||||||
echo "uninstall crosswords from the <index>th device"
|
echo "uninstall crosswords from the <index>th device"
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ ! -e build.xml ]; then
|
while :; do
|
||||||
usage "No build.xml; please run me from the top android directory"
|
WD=$(pwd)
|
||||||
fi
|
if [ -e ${WD}/AndroidManifest.xml ]; then
|
||||||
|
break
|
||||||
|
elif [ ${WD} = '/' ]; then
|
||||||
|
usage "reached / without finding AndroidManifest.xml"
|
||||||
|
else
|
||||||
|
cd ..
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
DIRNAME=$(basename $(pwd))
|
PACK=$(grep 'package=\".*\..*\.*\"' ${WD}/AndroidManifest.xml | sed 's,^.*package="\(.*\)".*$,\1,')
|
||||||
case $DIRNAME in
|
|
||||||
XWords4-bt)
|
if [ -z "${PACK}" ]; then
|
||||||
PKG=xw4bt
|
usage "unable to find package in ${WD}/AndroidManifest.xml"
|
||||||
;;
|
fi
|
||||||
XWords4-dbg)
|
|
||||||
PKG=xw4dbg
|
|
||||||
;;
|
|
||||||
XWords4)
|
|
||||||
PKG=xw4
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
usage "running in unexpected directory $DIRNAME"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
while [ $# -ge 1 ]; do
|
while [ $# -ge 1 ]; do
|
||||||
case $1 in
|
case $1 in
|
||||||
|
--dry-run)
|
||||||
|
DRYRUN=1
|
||||||
|
;;
|
||||||
-n)
|
-n)
|
||||||
shift
|
shift
|
||||||
INDEX=$1
|
INDEX=$1
|
||||||
|
@ -44,4 +46,5 @@ done
|
||||||
|
|
||||||
SERIAL="$(adb devices | grep 'device$' | sed -n "$((1+INDEX)) p" | awk '{print $1}')"
|
SERIAL="$(adb devices | grep 'device$' | sed -n "$((1+INDEX)) p" | awk '{print $1}')"
|
||||||
|
|
||||||
adb -s $SERIAL uninstall org.eehouse.android.${PKG}
|
echo "adb -s $SERIAL uninstall $PACK"
|
||||||
|
[ -z "$DRYRUN" ] && adb -s $SERIAL uninstall $PACK
|
||||||
|
|
|
@ -4,6 +4,7 @@ import re, sys, os, getopt
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
||||||
g_formats = {}
|
g_formats = {}
|
||||||
|
g_verbose = 0
|
||||||
|
|
||||||
def usage(msg=''):
|
def usage(msg=''):
|
||||||
print
|
print
|
||||||
|
@ -20,8 +21,6 @@ def associate( formats, name, fmt ):
|
||||||
else:
|
else:
|
||||||
forName = set()
|
forName = set()
|
||||||
formats[name] = forName
|
formats[name] = forName
|
||||||
if fmt in forName:
|
|
||||||
print "Warning: %s duplicated in %s" % (fmt, name)
|
|
||||||
forName.add(fmt)
|
forName.add(fmt)
|
||||||
# print 'added', fmt, 'to', name
|
# print 'added', fmt, 'to', name
|
||||||
|
|
||||||
|
@ -40,39 +39,64 @@ def checkFormats( formats ):
|
||||||
if not foundDigit:
|
if not foundDigit:
|
||||||
break
|
break
|
||||||
if curSet == testSet:
|
if curSet == testSet:
|
||||||
print name, "is ok"
|
if 0 < g_verbose: print name, "is ok"
|
||||||
else:
|
else:
|
||||||
print 'ERROR: sets different for', name, curSet, testSet
|
print 'WARNING: sets different for', name, curSet, testSet
|
||||||
|
|
||||||
|
def checkLangFormats( engData, langData, lang ):
|
||||||
|
for key in langData:
|
||||||
|
if not key in engData:
|
||||||
|
print 'WARNING: key', key, 'in', lang, 'but not in English'
|
||||||
|
elif not engData[key] == langData[key]:
|
||||||
|
print 'ERROR: set mismatch', key, 'from', lang, engData[key], 'vs', langData[key]
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
def getForElem( data, pat, elem, name ):
|
||||||
|
splits = re.split( pat, elem.text )
|
||||||
|
nParts = len(splits)
|
||||||
|
if 1 < nParts:
|
||||||
|
for ii in range(nParts):
|
||||||
|
part = splits[ii]
|
||||||
|
if re.match( pat, part ):
|
||||||
|
associate( data, name, part )
|
||||||
|
|
||||||
|
def getFormats( doc, pat, lang ):
|
||||||
|
result = {}
|
||||||
|
for elem in doc.findall('string'):
|
||||||
|
getForElem( result, pat, elem, elem.get('name') )
|
||||||
|
for elem in doc.findall('plurals'):
|
||||||
|
name = elem.get('name')
|
||||||
|
for elem in elem.findall('item'):
|
||||||
|
quantity = elem.get('quantity')
|
||||||
|
if not elem.text or 0 == len(elem.text):
|
||||||
|
print 'plurals', name, 'has empty quantity', quantity, \
|
||||||
|
'in file', lang
|
||||||
|
sys.exit(1)
|
||||||
|
else:
|
||||||
|
getForElem( result, pat, elem, name + '/' + quantity )
|
||||||
|
return result
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
if 1 < len(sys.argv): usage()
|
if 1 < len(sys.argv): usage()
|
||||||
|
parser = etree.XMLParser(remove_blank_text=True, encoding="utf-8")
|
||||||
|
|
||||||
wd = os.path.dirname(sys.argv[0])
|
wd = os.path.dirname(sys.argv[0])
|
||||||
path = wd + '/../XWords4/res/values/strings.xml'
|
|
||||||
|
|
||||||
# Load English
|
# Load English
|
||||||
engFormats = {}
|
path = wd + '/../XWords4/res/values/strings.xml'
|
||||||
parser = etree.XMLParser(remove_blank_text=True, encoding="utf-8")
|
|
||||||
doc = etree.parse(path, parser)
|
doc = etree.parse(path, parser)
|
||||||
pat = re.compile( '(%\d\$[sd])', re.DOTALL | re.MULTILINE )
|
pat = re.compile( '(%\d\$[sd])', re.DOTALL | re.MULTILINE )
|
||||||
for typ in ['string', 'item']:
|
engFormats = getFormats( doc, pat, 'en' )
|
||||||
for elem in doc.findall(typ):
|
|
||||||
splits = re.split( pat, elem.text )
|
|
||||||
nParts = len(splits)
|
|
||||||
if 1 < nParts:
|
|
||||||
for ii in range(nParts):
|
|
||||||
part = splits[ii]
|
|
||||||
if re.match( pat, part ):
|
|
||||||
associate( engFormats, elem.get('name'), part )
|
|
||||||
checkFormats( engFormats )
|
checkFormats( engFormats )
|
||||||
|
|
||||||
|
path = wd + '/../XWords4/res_src'
|
||||||
for subdir, dirs, files in os.walk(path):
|
for subdir, dirs, files in os.walk(path):
|
||||||
for file in [file for file in files if file == "strings.xml" \
|
for file in [file for file in files if file == "strings.xml" \
|
||||||
and not subdir.endswith('/values')]:
|
and not subdir.endswith('/values')]:
|
||||||
print file, subdir
|
doc = etree.parse( subdir + '/' + file, parser )
|
||||||
|
forLang = getFormats( doc, pat, subdir )
|
||||||
|
checkLangFormats( engFormats, forLang, subdir )
|
||||||
|
sys.exit(0)
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -2,25 +2,21 @@
|
||||||
|
|
||||||
set -u -e
|
set -u -e
|
||||||
|
|
||||||
DIRS=""
|
DIR=""
|
||||||
VARIANT=""
|
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
[ $# -ge 1 ] && echo "ERROR: $1"
|
[ $# -ge 1 ] && echo "ERROR: $1"
|
||||||
echo "usage: $0 [--dest-dir <dir>]*"
|
echo "usage: $0 [--dir <dir>]"
|
||||||
|
echo " uses variant parent of CWD as default if not provided"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
while [ $# -ge 1 ]; do
|
while [ $# -ge 1 ]; do
|
||||||
echo "\"$1\""
|
echo "\"$1\""
|
||||||
case $1 in
|
case $1 in
|
||||||
--variant-name)
|
--dir)
|
||||||
shift
|
shift
|
||||||
VARIANT=$1
|
DIR="$DIR $1"
|
||||||
;;
|
|
||||||
--dest-dir)
|
|
||||||
shift
|
|
||||||
DIRS="$DIRS $1"
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
usage "unexpected param $1"
|
usage "unexpected param $1"
|
||||||
|
@ -29,12 +25,26 @@ while [ $# -ge 1 ]; do
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
for DIR in $DIRS; do
|
if [ -z "$DIR" ]; then
|
||||||
for FILE in $(find $DIR -type f); do
|
while :; do
|
||||||
if git ls-files $FILE --error-unmatch 2>/dev/null; then
|
WD=$(pwd)
|
||||||
echo "skipping $FILE; it's under version control within this variant"
|
if [ "/" = "$WD" ]; then
|
||||||
|
echo "reached / without finding AndroidManifest.xml"
|
||||||
|
exit 1
|
||||||
|
elif [ -e ${WD}/AndroidManifest.xml ]; then
|
||||||
|
DIR=$WD
|
||||||
|
break
|
||||||
else
|
else
|
||||||
rm $FILE
|
cd ..
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
for FILE in $(find $DIR -type f); do
|
||||||
|
if git ls-files $FILE --error-unmatch 2>/dev/null; then
|
||||||
|
echo "skipping $FILE; it's under version control within this variant"
|
||||||
|
else
|
||||||
|
echo "removing $FILE"
|
||||||
|
rm $FILE
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue