Skip to content

Commit 02164d5

Browse files
committed
If USE_GLOBAL_ADK is specified, don't try to
install android_bundle and use globally available java, javac, android and ant
1 parent 5de5ba4 commit 02164d5

3 files changed

Lines changed: 39 additions & 9 deletions

File tree

tools/cordova-scripts/android.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,10 @@
33
# import all the environment
44
source $(dirname $0)/common_env.sh
55

6-
exec "${ANDROID_BUNDLE}/android-sdk/tools/android" "$@"
6+
if [ -z "$USE_GLOBAL_ADK" ] ; then
7+
exec "${ANDROID_BUNDLE}/android-sdk/tools/android" "$@"
8+
else
9+
# android should be in global path
10+
exec android "$@"
11+
fi
712

tools/cordova-scripts/common_env.sh

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,25 @@ ANDROID_BUNDLE="$BUNDLE_ROOT_DIR/android_bundle"
3333
# Devbundle is still stored in meteor-tool
3434
DEV_BUNDLE="$SCRIPT_DIR/dev_bundle"
3535

36-
# Put Android build tool-chain into path
37-
export PATH="${ANDROID_BUNDLE}/android-sdk/tools:${ANDROID_BUNDLE}/android-sdk/platform-tools:${PATH}"
38-
3936
# Put ios-sim and ios-deploy binaries' paths into path
4037
export PATH="${DEV_BUNDLE}/lib/ios-sim:${DEV_BUNDLE}/lib/ios-deploy:${PATH}"
4138

42-
# add ant
43-
export ANT_HOME="${ANDROID_BUNDLE}/apache-ant-1.9.4"
44-
export PATH="${ANT_HOME}/bin:${PATH}"
39+
if [ -z "$USE_GLOBAL_ADK" ] ; then
40+
# Put Android build tool-chain into path
41+
export PATH="${ANDROID_BUNDLE}/android-sdk/tools:${ANDROID_BUNDLE}/android-sdk/platform-tools:${PATH}"
42+
43+
# add ant
44+
export ANT_HOME="${ANDROID_BUNDLE}/apache-ant-1.9.4"
45+
export PATH="${ANT_HOME}/bin:${PATH}"
46+
47+
export HOME="${ANDROID_BUNDLE}"
48+
else
49+
# to use a global ADK we don't set PATH, ANT_HOME and HOME
50+
# relying that they are installed and available globally
51+
true
52+
fi
4553

4654
# add node
4755
export PATH="${DEV_BUNDLE}/bin:${PATH}"
4856
export NODE_PATH="${DEV_BUNDLE}/lib/node_modules"
4957

50-
export HOME="${ANDROID_BUNDLE}"
51-

tools/cordova-scripts/ensure_android_bundle.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,25 @@ command -v java >/dev/null 2>&1 || {
2727

2828
cd "$ORIG_DIR"
2929

30+
31+
if [ -z "$USE_GLOBAL_ADK" ] ; then
32+
# not using global ADK
33+
true
34+
else
35+
# using global ADK, check all utilities
36+
set -e
37+
trap "echo One of the required utilities wasn't found in global PATH: java javac ant android" EXIT
38+
39+
which java
40+
which javac
41+
which ant
42+
which android
43+
44+
trap - EXIT
45+
set +e
46+
exit 0
47+
fi
48+
3049
install_android_bundle () {
3150
echo "Going to install Android Bundle (300M-400M)."
3251
echo "This might take a while, please hold on."

0 commit comments

Comments
 (0)