forked from NO-ob/LoliSnatcher_Droid
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add build script and secret vars stuff
- Loading branch information
Showing
7 changed files
with
196 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"label": "Create secrets config", | ||
"type": "shell", | ||
"command": "sh ./gen_config.sh", | ||
"presentation": { | ||
"reveal": "never", | ||
"close": true | ||
}, | ||
"problemMatcher": [] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/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_STORE=false" | ||
build_desc="Github" | ||
build_mode="apk --split-per-abi" | ||
suffix="github" | ||
case "$menu_result" | ||
in | ||
0) | ||
build_arg="LS_IS_STORE=false" | ||
build_desc="Github" | ||
suffix="github" | ||
;; | ||
1) | ||
build_arg="LS_IS_TESTING=true" | ||
build_desc="Testing" | ||
suffix="test" | ||
;; | ||
2) | ||
build_arg="LS_IS_STORE=true" | ||
build_desc="Store" | ||
build_mode="appbundle" | ||
suffix="store" | ||
;; | ||
esac | ||
|
||
echo "Doing a ["$build_desc"] build - [$build_mode --$build_arg]" | ||
sh gen_config.sh | ||
flutter build $build_mode --release --dart-define=$build_arg | ||
|
||
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/ls_${version}(${build})_appbundle_${suffix}.aab" | ||
cp "$src_aab" "$dest_aab" | ||
|
||
echo | ||
echo "=> Built AAB: ls_${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/ls_${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/ls_${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/ls_${version}(${build})_x86_64_${suffix}.apk" | ||
cp "$src64_apk" "$dest64_apk" | ||
|
||
echo | ||
echo "=> Built APKs: ls_${version}(${build})_[arch]_${suffix}.apk" | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
if [ ! -f ./config/secrets.json ]; then | ||
mkdir -p config | ||
echo "{}" > config/secrets.json | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
#!/bin/bash | ||
|
||
function print_menu() | ||
{ | ||
local title_item="$1" | ||
shift | ||
local selected_item="$1" | ||
shift | ||
|
||
local function_arguments=($@) | ||
local menu_items=(${function_arguments[@]:0}) | ||
local menu_size="${#menu_items[@]}" | ||
local menu_limit=$((menu_size - 1)) | ||
|
||
echo "$title_item" | ||
for (( i = 0; i < $menu_size; ++i )) | ||
do | ||
if [ "$i" = "$selected_item" ] | ||
then | ||
echo "-> ${menu_items[i]}" | ||
else | ||
echo " ${menu_items[i]}" | ||
fi | ||
done | ||
} | ||
|
||
function run_menu() | ||
{ | ||
local title_item="$1" | ||
shift | ||
local selected_item="$1" | ||
shift | ||
|
||
local function_arguments=($@) | ||
local menu_items=(${function_arguments[@]:0}) | ||
local menu_size="${#menu_items[@]}" | ||
local menu_limit=$((menu_size - 1)) | ||
|
||
clear | ||
print_menu "$title_item" "$selected_item" "${menu_items[@]}" | ||
|
||
while read -rsn1 input | ||
do | ||
case "$input" | ||
in | ||
$'\x1B') # ESC ASCII code (https://dirask.com/posts/ASCII-Table-pJ3Y0j) | ||
read -rsn1 -t 0.1 input | ||
if [ "$input" = "[" ] # occurs before arrow code | ||
then | ||
read -rsn1 -t 0.1 input | ||
case "$input" | ||
in | ||
A) # Up Arrow | ||
if [ "$selected_item" -ge 1 ] | ||
then | ||
selected_item=$((selected_item - 1)) | ||
clear | ||
print_menu "$title_item" "$selected_item" "${menu_items[@]}" | ||
fi | ||
;; | ||
B) # Down Arrow | ||
if [ "$selected_item" -lt "$menu_limit" ] | ||
then | ||
selected_item=$((selected_item + 1)) | ||
clear | ||
print_menu "$title_item" "$selected_item" "${menu_items[@]}" | ||
fi | ||
;; | ||
esac | ||
fi | ||
read -rsn5 -t 0.1 # flushing stdin | ||
;; | ||
"") # Enter key | ||
return "$selected_item" | ||
;; | ||
esac | ||
done | ||
} |