-
Notifications
You must be signed in to change notification settings - Fork 136
/
build.sh
executable file
·47 lines (43 loc) · 1.25 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
#!/bin/bash
if [ "$#" -lt 1 ]; then
echo "Select platform to build: ios, android or desktop"
exit
fi
function install_platform {
PLATFORM=$1;
if [ "$PLATFORM" == "ios" ]; then
./node_modules/cordova/bin/cordova platform remove ios
./node_modules/cordova/bin/cordova platform add ios
elif [ "$PLATFORM" == "android" ]; then
./node_modules/cordova/bin/cordova platform remove android
./node_modules/cordova/bin/cordova platform add android
fi
}
function cp_icon {
PLATFORM=$1;
if [ "$PLATFORM" == "ios" ]; then
cp iOSIcon.png icon.png
elif [ "$PLATFORM" == "android" ]; then
cp AndroidIcon.png icon.png
fi
}
for PLATFORM in "$@"; do
if [ "$PLATFORM" == "ios" ] || [ "$PLATFORM" == "android" ]; then
npm install
install_platform $PLATFORM
cp_icon $PLATFORM
cordova-icon
cordova-splash
grunt --force
./node_modules/cordova/bin/cordova prepare $PLATFORM
./node_modules/cordova/bin/cordova build $PLATFORM
./node_modules/cordova/bin/cordova build $PLATFORM --release
elif [ "$PLATFORM" == "desktop" ]; then
npm install
grunt --force
grunt desktop --force
grunt desktop:release --force
else
echo "Invalid platform to build. Plataforms: ios, android or desktop"
fi
done