mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-09 22:00:39 +01:00
Combine the two generated constants files
This commit is contained in:
parent
06ef079af1
commit
49e7abd23d
5 changed files with 17 additions and 70 deletions
|
@ -28,9 +28,9 @@ import com.crittercism.app.Crittercism;
|
|||
public class CrashTrack {
|
||||
|
||||
public static void init( Context context ) {
|
||||
if ( 0 < GCMConsts.CRITTERCISM_APP_ID.length() ) {
|
||||
if ( 0 < BuildConstants.CRITTERCISM_APP_ID.length() ) {
|
||||
Crittercism.initialize(context.getApplicationContext(),
|
||||
GCMConsts.CRITTERCISM_APP_ID );
|
||||
BuildConstants.CRITTERCISM_APP_ID );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ public class GCMIntentService extends GCMBaseIntentService {
|
|||
|
||||
public GCMIntentService()
|
||||
{
|
||||
super( GCMConsts.SENDER_ID );
|
||||
super( BuildConstants.GCM_SENDER_ID );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -118,13 +118,13 @@ public class GCMIntentService extends GCMBaseIntentService {
|
|||
public static void init( Application app )
|
||||
{
|
||||
int sdkVersion = Integer.valueOf( android.os.Build.VERSION.SDK );
|
||||
if ( 8 <= sdkVersion && 0 < GCMConsts.SENDER_ID.length() ) {
|
||||
if ( 8 <= sdkVersion && 0 < BuildConstants.GCM_SENDER_ID.length() ) {
|
||||
try {
|
||||
GCMRegistrar.checkDevice( app );
|
||||
// GCMRegistrar.checkManifest( app );
|
||||
String regId = DevID.getGCMDevID( app );
|
||||
if ( regId.equals("") ) {
|
||||
GCMRegistrar.register( app, GCMConsts.SENDER_ID );
|
||||
GCMRegistrar.register( app, BuildConstants.GCM_SENDER_ID );
|
||||
}
|
||||
} catch ( UnsupportedOperationException uoe ) {
|
||||
DbgUtils.logf( "Device can't do GCM." );
|
||||
|
|
|
@ -58,14 +58,6 @@
|
|||
<arg value="${VARIANT_NAME}"/>
|
||||
</exec>
|
||||
|
||||
<exec dir="." executable="../scripts/gen_gcmid.sh"
|
||||
logError="true" failonerror="true"
|
||||
>
|
||||
<arg value="-v"/>
|
||||
<arg value="${VARIANT_NAME}"/>
|
||||
<arg value="-o"/>
|
||||
<arg value="src/org/eehouse/android/${VARIANT_NAME}/GCMConsts.java"/>
|
||||
</exec>
|
||||
<exec dir="." executable="../scripts/genvers.sh" output="/dev/null"
|
||||
failonerror="true">
|
||||
<arg value="--variant" />
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e -u
|
||||
|
||||
GCM_SENDER_ID=${GCM_SENDER_ID:-""}
|
||||
CRITTERCISM_APP_ID=${CRITTERCISM_APP_ID:-""}
|
||||
OUTFILE=""
|
||||
VARIANT=""
|
||||
|
||||
usage() {
|
||||
echo "usage: $0 -o outfile -v <variant>"
|
||||
exit 1
|
||||
}
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
-o)
|
||||
OUTFILE=$2
|
||||
shift
|
||||
;;
|
||||
-v)
|
||||
VARIANT=$2
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "unexpected param $1"
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ -z "$GCM_SENDER_ID" ]; then
|
||||
echo "GCM_SENDER_ID empty; GCM use will be disabled" >&2
|
||||
fi
|
||||
if [ -z "$CRITTERCISM_APP_ID" ]; then
|
||||
echo "CRITTERCISM_APP_ID empty; Crittercism will not be enabled" >&2
|
||||
fi
|
||||
|
||||
[ -z "$VARIANT" ] && usage
|
||||
[ -z "$OUTFILE" ] && usage
|
||||
|
||||
PKG=$VARIANT
|
||||
|
||||
cat <<EOF > $OUTFILE
|
||||
// Auto-generated: DO NOT CHECK THIS IN until questions about
|
||||
// obscuring various ids are cleared up. For now they're not meant
|
||||
// to be committed to public repos.
|
||||
|
||||
package org.eehouse.android.$PKG;
|
||||
|
||||
public class GCMConsts {
|
||||
public static final String SENDER_ID = "${GCM_SENDER_ID}";
|
||||
public static final String CRITTERCISM_APP_ID = "${CRITTERCISM_APP_ID}";
|
||||
}
|
||||
EOF
|
|
@ -8,6 +8,8 @@ VARIANT=""
|
|||
CLIENT_VERS_RELAY=""
|
||||
CHAT_SUPPORTED=""
|
||||
THUMBNAIL_SUPPORTED=""
|
||||
GCM_SENDER_ID=${GCM_SENDER_ID:-""}
|
||||
CRITTERCISM_APP_ID=${CRITTERCISM_APP_ID:-""}
|
||||
|
||||
usage() {
|
||||
echo "usage: $0 --variant <variant> --client-vers <relay_vers> \\"
|
||||
|
@ -103,10 +105,17 @@ EOF
|
|||
SHORTVERS="$(git describe --always $GITVERSION 2>/dev/null || echo ${GITVERSION}+)"
|
||||
GITHASH=$(git rev-parse --verify HEAD)
|
||||
|
||||
if [ -z "$GCM_SENDER_ID" ]; then
|
||||
echo "GCM_SENDER_ID empty; GCM use will be disabled" >&2
|
||||
fi
|
||||
if [ -z "$CRITTERCISM_APP_ID" ]; then
|
||||
echo "CRITTERCISM_APP_ID empty; Crittercism will not be enabled" >&2
|
||||
fi
|
||||
|
||||
cat <<EOF > ${BUILD_DIR}/src/org/eehouse/android/${VARIANT}/BuildConstants.java
|
||||
// auto-generated (by $(basename $0)); do not edit
|
||||
package org.eehouse.android.${VARIANT};
|
||||
class BuildConstants {
|
||||
public class BuildConstants {
|
||||
public static final String GIT_REV = "$SHORTVERS";
|
||||
public static final String STRINGS_HASH = "$STRINGS_HASH";
|
||||
public static final short CLIENT_VERS_RELAY = $CLIENT_VERS_RELAY;
|
||||
|
@ -115,6 +124,8 @@ class BuildConstants {
|
|||
public static final long BUILD_STAMP = $(date +'%s');
|
||||
public static final String DBG_TAG = "$DBG_TAG";
|
||||
public static final String VARIANT = "$VARIANT";
|
||||
public static final String GCM_SENDER_ID = "${GCM_SENDER_ID}";
|
||||
public static final String CRITTERCISM_APP_ID = "${CRITTERCISM_APP_ID}";
|
||||
}
|
||||
EOF
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue