forked from Sunbird-Ed/SunbirdEd-mobile-app
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·64 lines (50 loc) · 1.47 KB
/
build.sh
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
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
# Accepted CLI arguments
while getopts a: flag
do
case "${flag}" in
a) angularConfiguration=${OPTARG};;
esac
done
# Simple script to clean install
rm -rf node_modules
rm -rf platforms
rm -rf plugins
rm -rf www
CORDOVA_COUNTER=0
SUNBIRD_CORDOVA_COUNTER=0
# Pass build branch as input
buildBranch="$1"
rm package-lock.json && npm install
export CORDOVA_ANDROID_GRADLE_DISTRIBUTION_URL="https\://services.gradle.org/distributions/gradle-7.5.1-all.zip"
file="./build_config"
while IFS="=" read -r key value; do
case "$key" in
'#'*) ;;
'cordova'*)
CORDOVA[$CORDOVA_COUNTER]=$value
CORDOVA_COUNTER=$((CORDOVA_COUNTER+1));;
'sunbird-cordova'*)
SUNBIRD_CORDOVA[$SUNBIRD_CORDOVA_COUNTER]=$value
SUNBIRD_CORDOVA_COUNTER=$((SUNBIRD_CORDOVA_COUNTER+1));
esac
done < "$file"
for cordova_plugin in "${CORDOVA[@]}"
do
ionic cordova plugin add $cordova_plugin
done
for cordova_plugin in "${SUNBIRD_CORDOVA[@]}"
do
ionic cordova plugin add $cordova_plugin
done
rm -rf platforms
#Temporary Workaround to generate build as webpack was complaining of Heap Space
#need to inspect on webpack dependdencies at the earliest
NODE_OPTIONS=--max-old-space-size=4096 ionic cordova platforms add android@12.0.0
npm run ionic-build
if [ -n "$angularConfiguration" ]; then
echo "$angularConfiguration"
npm run ionic-build:prod --angular-configuration=$angularConfiguration
else
npm run ionic-build:prod --angular-configuration=production
fi