-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscript_example.sh
executable file
·76 lines (68 loc) · 1.48 KB
/
script_example.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
set -e
set -x
root=$(pwd)
path="."
while [ -n "$1" ]; do
case "$1" in
-path)
path="$2"
shift;;
-test) test=True;;
-drive)
drive_target="$2"
shift;;
-android) android=True;;
-ios) ios=True;;
-web) web=True;;
*) echo "Option $1 not recognized" ;;
esac
shift
done
cd "$path" && flutter packages pub get || true
cd "$root"
if [ $test ]
then
printf "\n\nTEST\n\n"
cd "$path" && flutter test || true
cd "$root"
fi
if [ $drive_target ]
then
printf "\n\nDRIVE\n\n"
flutter emulators --launch apple_ios_simulator
cd "$path" && flutter drive --target="$drive_target" || true
cd "$root"
fi
if [ $android ]
then
printf "\n\nANDROID\n\n"
rm -f ~/.android/debug.keystore
keytool -genkeypair \
-alias androiddebugkey \
-keypass android \
-keystore ~/.android/debug.keystore \
-storepass android \
-dname 'CN=Android Debug,O=Android,C=US' \
-keyalg 'RSA' \
-keysize 2048 \
-validity 10000
echo "flutter.sdk=$HOME/programs/flutter" > "$FCI_BUILD_DIR/$path/android/local.properties"
cd "$path" && flutter build apk --debug || true
cd "$root"
fi
if [ $ios ]
then
printf "\n\nIOS\n\n"
find . -name "Podfile" -execdir pod install \;
cd "$path" && flutter build ios --debug --no-codesign || true
cd "$root"
fi
if [ $web ]
then
printf "\n\nWEB\n\n"
cd "$path"
flutter config --enable-web
flutter build web --release || true
cd "$root"
fi