forked from NO-ob/LoliSnatcher_Droid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·76 lines (63 loc) · 2.2 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
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
source scripts/select.sh
selected_item=0
menu_items=("Testing" "Github" "Store")
title="Select a build type (arrow keys to select, enter to confirm):"
run_menu "$title" "$selected_item" "${menu_items[@]}"
menu_result="$?"
echo
build_arg="LS_IS_TESTING=true"
build_desc="Testing"
build_mode="apk --split-per-abi"
build_extras="--dart-define-from-file=./config/secrets.json"
suffix="test"
case "$menu_result"
in
0)
build_arg="LS_IS_TESTING=true"
build_desc="Testing"
suffix="test"
;;
1)
build_arg="LS_IS_STORE=false"
build_desc="Github"
suffix="github"
;;
2)
build_arg="LS_IS_STORE=true"
build_desc="Store"
build_mode="appbundle"
suffix="store"
;;
esac
clear
echo "Doing a ["$build_desc"] build - [flutter build $build_mode --$build_arg $build_extras]"
# Generate empty secret vars config if it's not there
sh gen_config.sh
flutter build $build_mode --release --dart-define=$build_arg $build_extras
get_version_and_build() {
version_and_build=$(grep "version:" pubspec.yaml | awk '{print $2}')
IFS='+' read -ra version_build_array <<< "$version_and_build"
version="${version_build_array[0]}"
build="${version_build_array[1]}"
}
get_version_and_build
if [ "$build_mode" = "appbundle" ]; then
src_aab="build/app/outputs/bundle/release/app-release.aab"
dest_aab="build/app/outputs/bundle/release/LoliSnatcher_${version}_${build}_appbundle_${suffix}.aab"
cp "$src_aab" "$dest_aab"
echo
echo "=> Built AAB: LoliSnatcher_${version}_${build}_appbundle_${suffix}.aab"
else
srcv8_apk="build/app/outputs/flutter-apk/app-arm64-v8a-release.apk"
destv8_apk="build/app/outputs/flutter-apk/LoliSnatcher_${version}_${build}_arm64-v8a_${suffix}.apk"
cp "$srcv8_apk" "$destv8_apk"
srcv7_apk="build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk"
destv7_apk="build/app/outputs/flutter-apk/LoliSnatcher_${version}_${build}_armeabi-v7a_${suffix}.apk"
cp "$srcv7_apk" "$destv7_apk"
src64_apk="build/app/outputs/flutter-apk/app-x86_64-release.apk"
dest64_apk="build/app/outputs/flutter-apk/LoliSnatcher_${version}_${build}_x86_64_${suffix}.apk"
cp "$src64_apk" "$dest64_apk"
echo
echo "=> Built APKs: LoliSnatcher_${version}_${build}_[arch]_${suffix}.apk"
fi