/
android
executable file
·31 lines (23 loc) · 1018 Bytes
/
android
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#! /bin/sh
PKG=$(./bin/util/read-config id)
ACT=$(./bin/util/read-config name | sed 's/ //g')
PTH=$(echo $PKG | sed 's/\./\//g')
FULL="./tmp/android/src/"$PTH"/"$ACT".java"
# clobber existing build sludge
rm -rf ./tmp/android
# create the android project
android create project --target 4 --path ./tmp/android --package $PKG --activity $ACT
# copy contents of www
mkdir -p ./tmp/android/assets
cp -r ./www ./tmp/android/assets/www/
# copy in phonegap.js
cp ./bin/create/templates/android/phonegap-0.9.4.js ./tmp/android/assets/www/phonegap-0.9.4.js
# copy in ./libs/phonegap.jar
mkdir -p ./tmp/android/libs
cp ./bin/create/templates/android/phonegap-0.9.4.jar ./tmp/android/libs/phonegap-0.9.4.jar
# copy in default activity
cat ./bin/create/templates/android/Activity.java > $FULL
find "$FULL" | xargs grep '__ACTIVITY__' -sl | xargs -L1 sed -i "" "s/__ACTIVITY__/${ACT}/g"
find "$FULL" | xargs grep '__ID__' -sl | xargs -L1 sed -i "" "s/__ID__/${PKG}/g"
# copy in intents
./bin/create/android-convert-config