2010-01-12 14:15:47 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
2012-02-14 08:35:41 +01:00
|
|
|
set -e -u
|
|
|
|
|
2014-04-19 04:25:40 +02:00
|
|
|
VARIANT=$1
|
|
|
|
CLIENT_VERS_RELAY=$2
|
|
|
|
CHAT_SUPPORTED=$3
|
|
|
|
THUMBNAIL_SUPPORTED=$4
|
2012-02-14 08:35:41 +01:00
|
|
|
|
2014-04-19 04:25:40 +02:00
|
|
|
BUILD_DIR=$(basename $(pwd))
|
2010-01-12 14:15:47 +01:00
|
|
|
cd $(dirname $0)
|
2014-04-19 04:25:40 +02:00
|
|
|
cd ../
|
2010-01-12 14:15:47 +01:00
|
|
|
|
2014-04-19 04:25:40 +02:00
|
|
|
GITVERSION=$(../scripts/gitversion.sh)
|
2010-02-28 19:17:35 +01:00
|
|
|
|
2010-06-05 16:55:40 +02:00
|
|
|
# TODO: deal with case where there's no hash available -- exported
|
|
|
|
# code maybe? Better: gitversion.sh does that.
|
|
|
|
|
2014-04-19 04:25:40 +02:00
|
|
|
cat <<EOF > ${BUILD_DIR}/res/values/git_string.xml
|
2010-06-05 16:55:40 +02:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<!-- auto-generated; do not edit -->
|
|
|
|
|
|
|
|
<resources>
|
2011-12-22 03:35:14 +01:00
|
|
|
<string name="git_rev">$GITVERSION</string>
|
2010-06-05 16:55:40 +02:00
|
|
|
</resources>
|
2010-01-12 14:15:47 +01:00
|
|
|
EOF
|
|
|
|
|
2010-06-05 17:24:43 +02:00
|
|
|
# Eventually this should pick up a tag if we're at one. That'll be
|
|
|
|
# the way to mark a release
|
|
|
|
SHORTVERS="$(git describe --always $GITVERSION 2>/dev/null || echo unknown)"
|
|
|
|
|
2014-04-19 04:25:40 +02:00
|
|
|
cat <<EOF > ${BUILD_DIR}/src/org/eehouse/android/${VARIANT}/BuildConstants.java
|
2010-06-05 17:24:43 +02:00
|
|
|
// auto-generated; do not edit
|
2012-02-14 08:35:41 +01:00
|
|
|
package org.eehouse.android.${VARIANT};
|
2013-11-15 06:56:24 +01:00
|
|
|
class BuildConstants {
|
|
|
|
public static final String GIT_REV = "$SHORTVERS";
|
2013-08-20 17:42:12 +02:00
|
|
|
public static final short CLIENT_VERS_RELAY = $CLIENT_VERS_RELAY;
|
2013-09-12 07:18:00 +02:00
|
|
|
public static final boolean CHAT_SUPPORTED = $CHAT_SUPPORTED;
|
2013-10-29 14:49:06 +01:00
|
|
|
public static final boolean THUMBNAIL_SUPPORTED = $THUMBNAIL_SUPPORTED;
|
2014-03-07 07:11:13 +01:00
|
|
|
public static final String BUILD_STAMP = "$(date +'%F at %R %Z')";
|
2010-06-05 17:24:43 +02:00
|
|
|
}
|
|
|
|
EOF
|
|
|
|
|
2010-06-05 16:55:40 +02:00
|
|
|
# touch the files that depend on git_string.xml. (I'm not sure that
|
|
|
|
# this list is complete or if ant and java always get dependencies
|
|
|
|
# right. Clean builds are the safest.)
|
2014-04-19 04:25:40 +02:00
|
|
|
touch ${BUILD_DIR}/res/xml/xwprefs.xml
|
|
|
|
echo "touched ${BUILD_DIR}/res/xml/xwprefs.xml"
|
|
|
|
mkdir -p ${BUILD_DIR}/gen/org/eehouse/android/${VARIANT}
|
|
|
|
touch ${BUILD_DIR}/gen/org/eehouse/android/${VARIANT}/R.java
|
|
|
|
touch ${BUILD_DIR}/src/org/eehouse/android/${VARIANT}/Utils.java
|