Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
# Get to the root project
if [[ "_" == "_${PROJECT_DIR}" ]]; then
SCRIPT_DIR=$(dirname $0)
PROJECT_DIR=$(cd ${SCRIPT_DIR}/.. && pwd)
export PROJECT_DIR
fi;
# Preparing environment
. ${PROJECT_DIR}/scripts/env-global.sh
if [[ $? -ne 0 ]]; then
exit 1
fi
if [[ "_" == "_${CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL}" ]]; then
echo "Missing Gradle distribution URL - please export env variable 'CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL'"
exit 1
fi
echo "Preparing Android environment:"
echo " - using Android SDK: ${ANDROID_SDK_ROOT}"
echo " - using Android SDK tools: ${ANDROID_SDK_TOOLS_ROOT}"
echo " - using Gradle: ${CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL}"
echo " - using Java: ${JAVA_HOME}"
echo " - project dir: ${PROJECT_DIR}"
cd ${PROJECT_DIR}
# Prepare Android platform
if [[ ! -d "${PROJECT_DIR}/platforms/android" ]]; then
echo "Adding Cordova Android platform..."
ionic cordova prepare android --color --verbose
if [[ $? -ne 0 ]]; then
exit 1
fi
fi
# Copy local files
if [[ -d "${PROJECT_DIR}/.local/android" ]]; then
echo "Copying files from directory '${PROJECT_DIR}/.local/android' into '${PROJECT_DIR}/platforms/android'..."
cp -rf ${PROJECT_DIR}/.local/android/* ${PROJECT_DIR}/platforms/android
if [[ $? -ne 0 ]]; then
exit 1
fi
else
echo "No directory '${PROJECT_DIR}/.local/android' found. Please create it, with a file 'release-signing.properties' for release signing"
fi