summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2021-02-01 02:02:34 +0100
committercyBerta <cyberta@riseup.net>2021-02-01 04:26:02 +0100
commiteba2108802a4b6251419b02c2f0ca47c0a701653 (patch)
treeea8a367135749d0012be6a4c78e4284e679e93e7 /scripts
parent9da1dd82ebb8778619a79bd9a896d1dff2fac0e1 (diff)
make sure ./prepareForDistribution.sh can be called from project root folder and the scripts folder
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build_deps.sh4
-rwxr-xr-xscripts/cleanProject.sh13
-rwxr-xr-xscripts/prepareForDistribution.sh90
3 files changed, 61 insertions, 46 deletions
diff --git a/scripts/build_deps.sh b/scripts/build_deps.sh
index beb5e13e..1785fca8 100755
--- a/scripts/build_deps.sh
+++ b/scripts/build_deps.sh
@@ -5,7 +5,8 @@ function quit {
exit 1
}
-
+SCRIPT_DIR=$(dirname "$0")
+BASE_DIR="$SCRIPT_DIR/.."
DIR_OVPNASSETS=./ics-openvpn/main/build/ovpnassets
DIR_OVPNLIBS=./ics-openvpn/main/build/intermediates/cmake/noovpn3/release/obj
DIR_GOLIBS=./go/lib/
@@ -15,6 +16,7 @@ FILE_ARM=./go/out/armeabi-v7a/piedispatcherlib
# init
# look for empty dir
+cd $BASE_DIR
if [[ $(ls -A ${DIR_OVPNASSETS}) && $(ls -A ${DIR_OVPNLIBS}) ]]
then
echo "Dirty build: skipped externalNativeBuild - reusing existing libs"
diff --git a/scripts/cleanProject.sh b/scripts/cleanProject.sh
index 703788cc..058ef20e 100755
--- a/scripts/cleanProject.sh
+++ b/scripts/cleanProject.sh
@@ -1,12 +1,15 @@
#!/bin/bash
+SCRIPT_DIR=$(dirname "$0")
+BASE_DIR="$SCRIPT_DIR/.."
+
git checkout -- \*
git checkout -- \.\*
-rm -r ./ics-openvpn
-rm -r ./build
-rm -r ./app/build
-rm -r ./go/lib/*
-rm -r ./currentReleases
+rm -r $BASE_DIR/ics-openvpn
+rm -r $BASE_DIR/build
+rm -r $BASE_DIR/app/build
+rm -r $BASE_DIR/go/lib/*
+rm -r $BASE_DIR/currentReleases
git submodule sync --recursive
git submodule update --init --recursive
diff --git a/scripts/prepareForDistribution.sh b/scripts/prepareForDistribution.sh
index efb08c35..9c198689 100755
--- a/scripts/prepareForDistribution.sh
+++ b/scripts/prepareForDistribution.sh
@@ -86,6 +86,14 @@ function sign {
gpg --verify "${FINAL_APK}.sig" || quit
}
+function base_dir {
+ echo "$(dirname "$0")/.."
+}
+
+function script_dir {
+ echo "$(dirname "$0")"
+}
+
# ----Main-----
DO_BUILD=false
@@ -243,11 +251,6 @@ then
exit
fi
-SCRIPT_DIR=$(dirname "$0")
-BASE_DIR="$SCRIPT_DIR/../"
-BASE_FILE_DIR="$BASE_DIR/app/build/outputs/apk"
-RELEASES_FILE_DIR="$BASE_DIR/currentReleases"
-
if [[ ${DO_BUILD} == true ]]
then
if [[ ${NO_TAG} == false && -z ${VERSION_NAME} ]]
@@ -267,10 +270,13 @@ then
fi
fi
- $SCRIPT_DIR/cleanProject.sh || quit
- $SCRIPT_DIR/build_deps.sh || quit
- $SCRIPT_DIR/fix_gradle_lock.sh || quit
-
+ $(script_dir)/cleanProject.sh || quit
+ $(script_dir)/build_deps.sh || quit
+ $(script_dir)/fix_gradle_lock.sh || quit
+
+ cd $(base_dir)
+ BASE_OUTPUT_DIR="./app/build/outputs/apk"
+ RELEASES_FILE_DIR="./currentReleases"
if [[ ! -d $RELEASES_FILE_DIR ]]
then
mkdir $RELEASES_FILE_DIR
@@ -280,57 +286,60 @@ then
if [[ ${BETA} == true ]]
then
echo "${GREEN} -> build beta releases for flavor ${FLAVOR}${NC}"
- $BASE_DIR/gradlew clean assemble${FLAVOR}ProductionFatBeta --stacktrace || quit
- # echo "copy file: $(ls $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionFat/beta/*.apk)"
- cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionFat/beta/*.apk $RELEASES_FILE_DIR/.
+ ./gradlew clean assemble${FLAVOR}ProductionFatBeta --stacktrace || quit
+ # echo "copy file: $(ls $BASE_OUTPUT_DIR/${FLAVOR_LOWERCASE}ProductionFat/beta/*.apk)"
+ cp $BASE_OUTPUT_DIR/${FLAVOR_LOWERCASE}ProductionFat/beta/*.apk $RELEASES_FILE_DIR/.
# custom builds might have disabled split apks -> check if build task exist
- if [[ $($BASE_DIR/gradlew tasks --console plain | grep ${FLAVOR}ProductionX86Beta) ]]; then
- $BASE_DIR/gradlew clean assemble${FLAVOR}ProductionX86Beta --stacktrace || quit
- cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionX86/beta/*.apk $RELEASES_FILE_DIR/.
+ if [[ $(./gradlew tasks --console plain | grep ${FLAVOR}ProductionX86Beta) ]]; then
+ ./gradlew clean assemble${FLAVOR}ProductionX86Beta --stacktrace || quit
+ cp $BASE_OUTPUT_DIR/${FLAVOR_LOWERCASE}ProductionX86/beta/*.apk $RELEASES_FILE_DIR/.
fi
- if [[ $($BASE_DIR/gradlew tasks --console plain | grep ${FLAVOR}ProductionX86_64Beta) ]]; then
- $BASE_DIR/gradlew clean assemble${FLAVOR}ProductionX86_64Beta --stacktrace || quit
- cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionX86_64/beta/*.apk $RELEASES_FILE_DIR/.
+ if [[ $(./gradlew tasks --console plain | grep ${FLAVOR}ProductionX86_64Beta) ]]; then
+ ./gradlew clean assemble${FLAVOR}ProductionX86_64Beta --stacktrace || quit
+ cp $BASE_OUTPUT_DIR/${FLAVOR_LOWERCASE}ProductionX86_64/beta/*.apk $RELEASES_FILE_DIR/.
fi
- if [[ $($BASE_DIR/gradlew tasks --console plain | grep ${FLAVOR}ProductionArmv7Beta) ]]; then
- $BASE_DIR/gradlew clean assemble${FLAVOR}ProductionArmv7Beta --stacktrace || quit
- cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionArmv7/beta/*.apk $RELEASES_FILE_DIR/.
+ if [[ $(./gradlew tasks --console plain | grep ${FLAVOR}ProductionArmv7Beta) ]]; then
+ ./gradlew clean assemble${FLAVOR}ProductionArmv7Beta --stacktrace || quit
+ cp $BASE_OUTPUT_DIR/${FLAVOR_LOWERCASE}ProductionArmv7/beta/*.apk $RELEASES_FILE_DIR/.
fi
- if [[ $($BASE_DIR/gradlew tasks --console plain | grep ${FLAVOR}ProductionArmv7Beta) ]]; then
- $BASE_DIR/gradlew clean assemble${FLAVOR}ProductionArm64Beta --stacktrace || quit
- cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionArm64/beta/*.apk $RELEASES_FILE_DIR/.
+ if [[ $(./gradlew tasks --console plain | grep ${FLAVOR}ProductionArmv7Beta) ]]; then
+ ./gradlew clean assemble${FLAVOR}ProductionArm64Beta --stacktrace || quit
+ cp $BASE_OUTPUT_DIR/${FLAVOR_LOWERCASE}ProductionArm64/beta/*.apk $RELEASES_FILE_DIR/.
fi
else
echo -e "${GREEN} -> build stable releases for flavor ${FLAVOR}${NC}"
- $BASE_DIR/gradlew clean assemble${FLAVOR}ProductionFatRelease --stacktrace || quit
- cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionFat/release/*.apk $RELEASES_FILE_DIR/.
+ ./gradlew clean assemble${FLAVOR}ProductionFatRelease --stacktrace || quit
+ cp $BASE_OUTPUT_DIR/${FLAVOR_LOWERCASE}ProductionFat/release/*.apk $RELEASES_FILE_DIR/.
- $BASE_DIR/gradlew clean assemble${FLAVOR}ProductionFatwebRelease --stacktrace || quit
- cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionFatweb/release/*.apk $RELEASES_FILE_DIR/.
+ ./gradlew clean assemble${FLAVOR}ProductionFatwebRelease --stacktrace || quit
+ cp $BASE_OUTPUT_DIR/${FLAVOR_LOWERCASE}ProductionFatweb/release/*.apk $RELEASES_FILE_DIR/.
# custom builds might have disabled split apks -> check if build task exist
- if [[ $($BASE_DIR/gradlew tasks --console plain | grep ${FLAVOR}ProductionX86Release) ]]; then
- $BASE_DIR/gradlew clean assemble${FLAVOR}ProductionX86Release --stacktrace || quit
- cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionX86/release/*.apk $RELEASES_FILE_DIR/.
+ if [[ $(./gradlew tasks --console plain | grep ${FLAVOR}ProductionX86Release) ]]; then
+ ./gradlew clean assemble${FLAVOR}ProductionX86Release --stacktrace || quit
+ cp $BASE_OUTPUT_DIR/${FLAVOR_LOWERCASE}ProductionX86/release/*.apk $RELEASES_FILE_DIR/.
fi
- if [[ $($BASE_DIR/gradlew tasks --console plain | grep ${FLAVOR}ProductionX86_64Release) ]]; then
- $BASE_DIR/gradlew clean assemble${FLAVOR}ProductionX86_64Release --stacktrace || quit
- cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionX86_64/release/*.apk $RELEASES_FILE_DIR/.
+ if [[ $(./gradlew tasks --console plain | grep ${FLAVOR}ProductionX86_64Release) ]]; then
+ ./gradlew clean assemble${FLAVOR}ProductionX86_64Release --stacktrace || quit
+ cp $BASE_OUTPUT_DIR/${FLAVOR_LOWERCASE}ProductionX86_64/release/*.apk $RELEASES_FILE_DIR/.
fi
- if [[ $($BASE_DIR/gradlew tasks --console plain | grep ${FLAVOR}ProductionArmv7Release) ]]; then
- $BASE_DIR/gradlew clean assemble${FLAVOR}ProductionArmv7Release --stacktrace || quit
- cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionArmv7/release/*.apk $RELEASES_FILE_DIR/.
+ if [[ $(./gradlew tasks --console plain | grep ${FLAVOR}ProductionArmv7Release) ]]; then
+ ./gradlew clean assemble${FLAVOR}ProductionArmv7Release --stacktrace || quit
+ cp $BASE_OUTPUT_DIR/${FLAVOR_LOWERCASE}ProductionArmv7/release/*.apk $RELEASES_FILE_DIR/.
fi
- if [[ $($BASE_DIR/gradlew tasks --console plain | grep ${FLAVOR}ProductionArm64Release) ]]; then
- $BASE_DIR/gradlew clean assemble${FLAVOR}ProductionArm64Release --stacktrace || quit
- cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionArm64/release/*.apk $RELEASES_FILE_DIR/.
+ if [[ $(./gradlew tasks --console plain | grep ${FLAVOR}ProductionArm64Release) ]]; then
+ ./gradlew clean assemble${FLAVOR}ProductionArm64Release --stacktrace || quit
+ cp $BASE_OUTPUT_DIR/${FLAVOR_LOWERCASE}ProductionArm64/release/*.apk $RELEASES_FILE_DIR/.
fi
fi
+
+ cd -
fi
if [[ ${DO_SIGN} == true ]]
then
+ cd $(base_dir)
# check global vars
if [[ -z ${ANDROID_BUILD_TOOLS} ]]
then
@@ -369,4 +378,5 @@ then
echo -e "${GREEN} -> sign apk: ${FILE_NAME_STRING}${NC}"
sign $FILE_NAME_STRING
fi
+ cd -
fi