105 lines
4.6 KiB
Diff
105 lines
4.6 KiB
Diff
|
diff --git a/tools/build-beta b/tools/build-beta
|
||
|
index 129f1a0..8b0905d 100644
|
||
|
--- a/tools/build-beta
|
||
|
+++ b/tools/build-beta
|
||
|
@@ -1,16 +1,83 @@
|
||
|
-BETA_PACKAGE=com.fsck.k9beta
|
||
|
-BETA_PATH=com/fsck/k9beta
|
||
|
-BETA_PROJ_NAME="K9 Beta"
|
||
|
-perl -pi -e"s|\@string/app_name|\@string/beta_app_name|g" AndroidManifest.xml
|
||
|
-perl -pi -e"s|com/fsck/k9/R.java|$BETA_PATH/R.java|g" build.xml
|
||
|
-find src/com/fsck res -type f |xargs -n 1 perl -pi -e"s/com.fsck.k9(?=\W)/$BETA_PACKAGE/g"
|
||
|
-perl -pi -e"s|com.fsck.k9|$BETA_PACKAGE|g" AndroidManifest.xml
|
||
|
-mv src/com/fsck/k9 src/$BETA_PATH
|
||
|
-perl -pi -e"s|K9|$BETA_PROJ_NAME|g" build.xml
|
||
|
-ant $@
|
||
|
-mv src/$BETA_PATH src/com/fsck/k9
|
||
|
-perl -pi -e"s|$BETA_PACKAGE|com.fsck.k9|g" AndroidManifest.xml
|
||
|
-perl -pi -e"s|$BETA_PATH/R.java|com/fsck.k9/R.java|g" build.xml
|
||
|
-find src/com/fsck res -type f |xargs -n 1 perl -pi -e"s/$BETA_PACKAGE(?=\W)/com.fsck.k9/g"
|
||
|
-perl -pi -e"s|$BETA_PROJ_NAME|K9|g" build.xml
|
||
|
-perl -pi -e"s|\@string/beta_app_name|\@string/app_name|g" AndroidManifest.xml
|
||
|
+#!/bin/bash
|
||
|
+
|
||
|
+# The MIT License
|
||
|
+#
|
||
|
+# Copyright 2012 Ashley Willis <ashley.github@gmail.com>
|
||
|
+#
|
||
|
+# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
|
+# of this software and associated documentation files (the "Software"), to deal
|
||
|
+# in the Software without restriction, including without limitation the rights
|
||
|
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||
|
+# copies of the Software, and to permit persons to whom the Software is
|
||
|
+# furnished to do so, subject to the following conditions:
|
||
|
+#
|
||
|
+# The above copyright notice and this permission notice shall be included in
|
||
|
+# all copies or substantial portions of the Software.
|
||
|
+#
|
||
|
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
|
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
|
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||
|
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
|
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||
|
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||
|
+# THE SOFTWARE.
|
||
|
+
|
||
|
+# Based off original tools/build-beta by Jesse Vincent.
|
||
|
+
|
||
|
+# Works on OS X and Linux.
|
||
|
+
|
||
|
+# Temporarily rename an Android project for building.
|
||
|
+# Set the first 5 or 6 DIST_* and BETA_* to whatever you are going from and to.
|
||
|
+# Set PROJECT_DIR to the absolute path pf the main project.
|
||
|
+# Set TEST_DIR to the absolute path of the test project.
|
||
|
+# Then run this script with the same arguments you'd pass to ant. It can be
|
||
|
+# run from either $PROJECT_DIR or $TEST_DIR. It might require tweaks
|
||
|
+# depending on how your project is laid out.
|
||
|
+
|
||
|
+PROJECT_DIR=.
|
||
|
+TEST_DIR=${PROJECT_DIR}/tests
|
||
|
+
|
||
|
+DIST_TLD=com
|
||
|
+DIST_DOMAIN=fsck
|
||
|
+DIST_PROJECT=k9
|
||
|
+DIST_LOGTAG=k9
|
||
|
+DIST_PROJ_NAME=K9
|
||
|
+DIST_APP_NAME='\@string/app_name'
|
||
|
+
|
||
|
+BETA_TLD=org
|
||
|
+BETA_DOMAIN=fdroid
|
||
|
+BETA_PROJECT=k9
|
||
|
+BETA_LOGTAG=k9
|
||
|
+BETA_PROJ_NAME='K9'
|
||
|
+BETA_APP_NAME='K-9 Mail~'
|
||
|
+
|
||
|
+# Nothing below here should need to be changed.
|
||
|
+
|
||
|
+DIST_PACKAGE="${DIST_TLD}.${DIST_DOMAIN}.${DIST_PROJECT}"
|
||
|
+DIST_PATH="${DIST_TLD}/${DIST_DOMAIN}/${DIST_PROJECT}"
|
||
|
+
|
||
|
+BETA_PACKAGE="${BETA_TLD}.${BETA_DOMAIN}.${BETA_PROJECT}"
|
||
|
+BETA_PATH="${BETA_TLD}/${BETA_DOMAIN}/${BETA_PROJECT}"
|
||
|
+
|
||
|
+# convert to beta project:
|
||
|
+perl -pi -e"s|${DIST_APP_NAME}|${BETA_APP_NAME}|g" ${PROJECT_DIR}/AndroidManifest.xml
|
||
|
+perl -pi -e"s|${DIST_PACKAGE}|${BETA_PACKAGE}|g" ${PROJECT_DIR}/AndroidManifest.xml ${TEST_DIR}/AndroidManifest.xml
|
||
|
+perl -pi -e"s|${DIST_PROJ_NAME}|${BETA_PROJ_NAME}|g" ${PROJECT_DIR}/build.xml ${TEST_DIR}/build.xml
|
||
|
+perl -pi -e"s|LOG_TAG = \"${DIST_LOGTAG}\"|LOG_TAG = \"${BETA_LOGTAG}\"|" ${PROJECT_DIR}/src/${DIST_PATH}/${DIST_PROJ_NAME}.java
|
||
|
+find ${PROJECT_DIR}/src/${DIST_TLD}/${DIST_DOMAIN} ${PROJECT_DIR}/res ${TEST_DIR}/src/${DIST_TLD}/${DIST_DOMAIN} ${TEST_DIR}/res \
|
||
|
+ -type f -print0 | xargs -0 perl -pi -e"s/${DIST_PACKAGE}(?=\W)/${BETA_PACKAGE}/g"
|
||
|
+if [[ "${DIST_PROJECT}" != "${BETA_PROJECT}" ]]; then
|
||
|
+ mv ${PROJECT_DIR}/src/${DIST_TLD}/${DIST_DOMAIN}/${DIST_PROJECT} ${PROJECT_DIR}/src/${DIST_TLD}/${DIST_DOMAIN}/${BETA_PROJECT}
|
||
|
+ mv ${TEST_DIR}/src/${DIST_TLD}/${DIST_DOMAIN}/${DIST_PROJECT} ${TEST_DIR}/src/${DIST_TLD}/${DIST_DOMAIN}/${BETA_PROJECT}
|
||
|
+fi
|
||
|
+if [[ "${DIST_DOMAIN}" != "${BETA_DOMAIN}" ]]; then
|
||
|
+ mv ${PROJECT_DIR}/src/${DIST_TLD}/${DIST_DOMAIN} ${PROJECT_DIR}/src/${DIST_TLD}/${BETA_DOMAIN}
|
||
|
+ mv ${TEST_DIR}/src/${DIST_TLD}/${DIST_DOMAIN} ${TEST_DIR}/src/${DIST_TLD}/${BETA_DOMAIN}
|
||
|
+fi
|
||
|
+if [[ "${DIST_TLD}" != "${BETA_TLD}" ]]; then
|
||
|
+ mv ${PROJECT_DIR}/src/${DIST_TLD} ${PROJECT_DIR}/src/${BETA_TLD}
|
||
|
+ mv ${TEST_DIR}/src/${DIST_TLD} ${TEST_DIR}/src/${BETA_TLD}
|
||
|
+fi
|
||
|
+
|
||
|
+MYEXIT=$?
|
||
|
+
|