mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
finish first pass at build variant generation. This works well enough
that the app so generated runs in emulator, talks to relay, and does not crash. Makefile has rules for .java, .xml and .h that run through sed to xw4 in import statements, package names etc so the variant app is in a different namespace. Also honors any files in the variant tree that are actually checked into git should it be necessary to make changes beyond what sed can manage.
This commit is contained in:
parent
8590466229
commit
cf9ab45e6f
5 changed files with 61 additions and 11 deletions
8
xwords4/android/XWords4-dbg/.gitignore
vendored
8
xwords4/android/XWords4-dbg/.gitignore
vendored
|
@ -1,2 +1,8 @@
|
|||
proguard.cfg
|
||||
*.apk
|
||||
ant_out.txt
|
||||
local.properties
|
||||
bin
|
||||
gen
|
||||
libs
|
||||
proguard.cfg
|
||||
obj
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
own application, the package name must be changed from "com.example.*"
|
||||
to come from a domain that you own or have control over. -->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.eehouse.android.xw4"
|
||||
package="org.eehouse.android.xw4_dbg"
|
||||
android:versionCode="34"
|
||||
android:versionName="@string/app_version"
|
||||
>
|
||||
|
|
|
@ -50,13 +50,18 @@
|
|||
in between standard targets -->
|
||||
|
||||
<target name="-pre-build">
|
||||
<exec dir=".." executable="./scripts/mkvariant.sh">
|
||||
<exec dir="." executable="../scripts/mkvariant.sh" output="/dev/null" >
|
||||
<arg value="--variant-name"/>
|
||||
<arg value="xw4_dbg"/>
|
||||
<arg value="--dest-dir"/>
|
||||
<arg value="./XWords4-dbg/src"/>
|
||||
<arg value="./res"/>
|
||||
<arg value="--dest-dir"/>
|
||||
<arg value="./XWords4-dbg/res"/>
|
||||
<arg value="./src"/>
|
||||
<arg value="--dest-dir"/>
|
||||
<arg value="./jni"/>
|
||||
</exec>
|
||||
<exec dir="." executable="../scripts/ndkbuild.sh" >
|
||||
<arg value="-j3"/>
|
||||
</exec>
|
||||
<exec dir=".." executable="./scripts/genvers.sh" output="ant_out.txt" />
|
||||
</target>
|
||||
|
|
|
@ -1 +1,23 @@
|
|||
# -*- mode: Makefile; -*-
|
||||
|
||||
$(DEST_PATH)/%.java : $(SRC_PATH)/%.java
|
||||
@sed \
|
||||
-e "s,\(package org.eehouse.android.\)xw4\(.*\);,\1$(VARIANT)\2;," \
|
||||
-e "s,\(import org.eehouse.android.\)xw4\(.*\);,\1$(VARIANT)\2;," \
|
||||
< $< > $@
|
||||
|
||||
$(DEST_PATH)/%.png : $(SRC_PATH)/%.png
|
||||
@cp $< $@
|
||||
|
||||
$(DEST_PATH)/%.xml : $(SRC_PATH)/%.xml
|
||||
@sed \
|
||||
-e "s,\(^.*org.eehouse.android.\)xw4\(.*$$\),\1$(VARIANT)\2," \
|
||||
< $< > $@
|
||||
|
||||
$(DEST_PATH)/%.h : $(SRC_PATH)/%.h
|
||||
sed \
|
||||
-e "s,\(^.*org/eehouse/android/\)xw4\(.*$$\),\1$(VARIANT)\2," \
|
||||
< $< > $@
|
||||
|
||||
$(DEST_PATH)/% : $(SRC_PATH)/%
|
||||
@cp $< $@
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
set -u -e
|
||||
|
||||
MAKEFILE=./Variant.mk
|
||||
MAKEFILE=$(dirname $0)/Variant.mk
|
||||
DIRS=""
|
||||
VARIANT=""
|
||||
|
||||
|
@ -12,22 +12,35 @@ usage() {
|
|||
exit 1
|
||||
}
|
||||
|
||||
add_to_gitignored() {
|
||||
DIR=$1
|
||||
FILE=$2
|
||||
touch ${DIR}/.gitignore
|
||||
grep -q "^${FILE}\$" ${DIR}/.gitignore || echo $FILE >> ${DIR}/.gitignore
|
||||
}
|
||||
|
||||
do_dir() {
|
||||
local SRC_PATH=$1
|
||||
local DEST_PATH=$2
|
||||
local DIR=$3
|
||||
|
||||
SRC_PATH=$SRC_PATH/$DIR
|
||||
|
||||
[ -d $SRC_PATH ] || usage "$SRC_PATH not found"
|
||||
|
||||
DEST_PATH=$DEST_PATH/$DIR
|
||||
mkdir -p $DEST_PATH
|
||||
|
||||
for FILE in $SRC_PATH; do
|
||||
for FILE in $SRC_PATH/*; do
|
||||
if [ -d $FILE ]; then
|
||||
do_dir $SRC_PATH $DEST_PATH $FILE
|
||||
do_dir $SRC_PATH $DEST_PATH $(basename $FILE)
|
||||
else
|
||||
make -f $MAKEFILE SRC_PATH=$SRC_PATH $DEST_PATH=$DEST_PATH make_file
|
||||
FILE=${FILE/$SRC_PATH/$DEST_PATH}
|
||||
if git ls-files $FILE --error-unmatch 2>/dev/null; then
|
||||
echo "skipping $FILE; it's under version control within this variant"
|
||||
else
|
||||
make -f $MAKEFILE SRC_PATH=$SRC_PATH DEST_PATH=$DEST_PATH VARIANT=${VARIANT} $FILE
|
||||
add_to_gitignored $DEST_PATH $(basename $FILE)
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
@ -56,3 +69,7 @@ done
|
|||
echo "$0 DIRS: $DIRS"
|
||||
|
||||
[ -n "$VARIANT" ] || usage "--variant-name not supplied"
|
||||
|
||||
for DIR in $DIRS; do
|
||||
do_dir ../XWords4 . $DIR
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue