4 SRC_DIR="$APP_DIR/jni/src"
5 MAIN_DIR="$APP_DIR/src/main"
7 BUILD_FILE="$APP_DIR/build.gradle"
8 BUILD_TMPL="$BUILD_FILE.tmpl"
10 MANIFEST_FILE="$MAIN_DIR/AndroidManifest.xml"
11 MANIFEST_TMPL="$MANIFEST_FILE.tmpl"
13 MAIN_H="$SRC_DIR/main.h"
15 VERSION_SUPER=`grep "#define PROGRAM_VERSION_SUPER" $MAIN_H | awk '{print $3}'`
16 VERSION_MAJOR=`grep "#define PROGRAM_VERSION_MAJOR" $MAIN_H | awk '{print $3}'`
17 VERSION_MINOR=`grep "#define PROGRAM_VERSION_MINOR" $MAIN_H | awk '{print $3}'`
18 VERSION_PATCH=`grep "#define PROGRAM_VERSION_PATCH" $MAIN_H | awk '{print $3}'`
19 VERSION_EXTRA=`grep "#define PROGRAM_VERSION_EXTRA" $MAIN_H \
20 | awk -F\" '{print $2}' \
21 | tr '[A-Z ]' '[a-z-]'`
23 UNIQUE_VERSION=`echo "$VERSION_SUPER" | wc -l | awk '{ print $1 }'`
24 if [ "$UNIQUE_VERSION" != "1" ]; then
25 echo "ERROR: program version number ('PROGRAM_VERSION_SUPER') not unique!"
29 VERSION_NAME="$VERSION_SUPER.$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH"
30 VERSION_CODE=$(printf '%d%02d%02d%02d' \
36 if [ "$VERSION_EXTRA" != "" ]; then
37 VERSION_NAME="$VERSION_NAME$VERSION_EXTRA"
40 # echo "::: VERSION_NAME == '$VERSION_NAME'"
41 # echo "::: VERSION_CODE == '$VERSION_CODE'"
44 | sed -e "s/__VERSION_NAME__/$VERSION_NAME/" \
45 | sed -e "s/__VERSION_CODE__/$VERSION_CODE/" \
48 cat "$MANIFEST_TMPL" \
49 | sed -e "s/__VERSION_NAME__/$VERSION_NAME/" \
50 | sed -e "s/__VERSION_CODE__/$VERSION_CODE/" \