summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcyberta <cyberta@riseup.net>2021-02-02 15:36:46 +0000
committercyberta <cyberta@riseup.net>2021-02-02 15:36:46 +0000
commit50588d08d77529eb84686220cfe3c8816195d46b (patch)
treeea8a367135749d0012be6a4c78e4284e679e93e7
parentf425762e35957e663eeda3e5bea73a1f93ab90dd (diff)
parenteba2108802a4b6251419b02c2f0ca47c0a701653 (diff)
Merge branch 'move_scripts' into 'master'
Move scripts See merge request leap/bitmask_android!120
-rw-r--r--.gitlab-ci.yml14
-rwxr-xr-xcleanProject.sh12
-rwxr-xr-xscripts/build_deps.sh (renamed from build_deps.sh)4
-rwxr-xr-xscripts/cleanGit.sh (renamed from cleanGit.sh)0
-rwxr-xr-xscripts/cleanProject.sh15
-rwxr-xr-xscripts/fix_gradle_lock.sh (renamed from fix_gradle_lock.sh)0
-rwxr-xr-xscripts/prepareForDistribution.sh (renamed from prepareForDistribution.sh)60
7 files changed, 60 insertions, 45 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b9ac51a6..35748672 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -102,8 +102,8 @@ build:
image: "0xacab.org:4567/leap/bitmask_android/android-ndk:latest"
stage: build
script:
- - ./cleanProject.sh
- - ./build_deps.sh >> build_deps.log 2>&1
+ - ./scripts/cleanProject.sh
+ - ./scripts/build_deps.sh >> build_deps.log 2>&1
- ./gradlew clean assembleNormalProductionFatDebug --stacktrace >> build.log 2>&1
artifacts:
paths:
@@ -117,7 +117,7 @@ build_release:
image: "0xacab.org:4567/leap/bitmask_android/android-ndk:latest"
stage: build
script:
- - ./prepareForDistribution.sh build -no-tag >> normalRelease.log 2>&1
+ - ./scripts/prepareForDistribution.sh build -no-tag >> normalRelease.log 2>&1
artifacts:
paths:
- app/build/outputs/
@@ -131,7 +131,7 @@ build_fdroid_beta_release:
image: "0xacab.org:4567/leap/bitmask_android/android-ndk:latest"
stage: build
script:
- - ./prepareForDistribution.sh build -no-tag -beta >> normalBeta.log 2>&1
+ - ./scripts/prepareForDistribution.sh build -no-tag -beta >> normalBeta.log 2>&1
artifacts:
paths:
- app/build/outputs/
@@ -145,7 +145,7 @@ build_custom_release:
image: "0xacab.org:4567/leap/bitmask_android/android-ndk:latest"
stage: build
script:
- - ./prepareForDistribution.sh build -no-tag -custom >> customRelease.log 2>&1
+ - ./scripts/prepareForDistribution.sh build -no-tag -custom >> customRelease.log 2>&1
artifacts:
paths:
- app/build/outputs/
@@ -159,7 +159,7 @@ build_fdroid_custom_beta_release:
image: "0xacab.org:4567/leap/bitmask_android/android-ndk:latest"
stage: build
script:
- - ./prepareForDistribution.sh build -no-tag -beta -custom >> customBeta.log 2>&1
+ - ./scripts/prepareForDistribution.sh build -no-tag -beta -custom >> customBeta.log 2>&1
artifacts:
paths:
- app/build/outputs/
@@ -167,4 +167,4 @@ build_fdroid_custom_beta_release:
- customBeta.log
when: always
expire_in: 1 week
- when: manual \ No newline at end of file
+ when: manual
diff --git a/cleanProject.sh b/cleanProject.sh
deleted file mode 100755
index 703788cc..00000000
--- a/cleanProject.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/bash
-
-git checkout -- \*
-git checkout -- \.\*
-
-rm -r ./ics-openvpn
-rm -r ./build
-rm -r ./app/build
-rm -r ./go/lib/*
-rm -r ./currentReleases
-git submodule sync --recursive
-git submodule update --init --recursive
diff --git a/build_deps.sh b/scripts/build_deps.sh
index beb5e13e..1785fca8 100755
--- a/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/cleanGit.sh b/scripts/cleanGit.sh
index 3c0b9271..3c0b9271 100755
--- a/cleanGit.sh
+++ b/scripts/cleanGit.sh
diff --git a/scripts/cleanProject.sh b/scripts/cleanProject.sh
new file mode 100755
index 00000000..058ef20e
--- /dev/null
+++ b/scripts/cleanProject.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+SCRIPT_DIR=$(dirname "$0")
+BASE_DIR="$SCRIPT_DIR/.."
+
+git checkout -- \*
+git checkout -- \.\*
+
+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/fix_gradle_lock.sh b/scripts/fix_gradle_lock.sh
index 4361f3b5..4361f3b5 100755
--- a/fix_gradle_lock.sh
+++ b/scripts/fix_gradle_lock.sh
diff --git a/prepareForDistribution.sh b/scripts/prepareForDistribution.sh
index 5e39bb5c..9c198689 100755
--- a/prepareForDistribution.sh
+++ b/scripts/prepareForDistribution.sh
@@ -77,18 +77,23 @@ function sign {
then
echo -e "${GREEN} -> gpg sign using key ${GPG_KEY}${NC}"
gpg --default-key ${GPG_KEY} --armor --output "${FINAL_APK}.sig" --detach-sign ${FINAL_APK} || quit
- #gpg -u ${GPG_KEY} -sab --output ${FINAL_APK} || quit
else
- echo -e "${GREEN} -> gpg sign using pub key of user ${GPG_KEY_USER}${NC}"
- GPG_KEY=$(gpg --list-keys $GPG_KEY_USER | grep pub | cut -d '/' -f 2 | cut -d ' ' -f 1) || quit
- #gpg -u ${GPG_KEY} -sab --output ${FINAL_APK} || quit
- gpg --default-key ${GPG_KEY} --armor --output "${FINAL_APK}.sig" --detach-sign ${FINAL_APK} || quit
+ echo -e "${GREEN} -> gpg sign using key of user ${GPG_KEY_USER}${NC}"
+ gpg -u ${GPG_KEY_USER} --armor --output "${FINAL_APK}.sig" --detach-sign ${FINAL_APK} || quit
fi
echo -e "${GREEN} -> gpg verify ${FINAL_APK}${NC}"
gpg --verify "${FINAL_APK}.sig" || quit
}
+function base_dir {
+ echo "$(dirname "$0")/.."
+}
+
+function script_dir {
+ echo "$(dirname "$0")"
+}
+
# ----Main-----
DO_BUILD=false
@@ -106,6 +111,7 @@ NC='\033[0m'
export GREEN=${GREEN}
export RED=${RED}
export ORANGE=${ORANGE}
+export NC=${NC}
export EXPECTED_FINGERPRINT=${EXPECTED_FINGERPRINT}
export -f sign
export -f quit
@@ -245,9 +251,6 @@ then
exit
fi
-BASE_FILE_DIR="$(pwd)/app/build/outputs/apk"
-RELEASES_FILE_DIR="$(pwd)/currentReleases"
-
if [[ ${DO_BUILD} == true ]]
then
if [[ ${NO_TAG} == false && -z ${VERSION_NAME} ]]
@@ -267,10 +270,13 @@ then
fi
fi
- ./cleanProject.sh || quit
- ./build_deps.sh || quit
- ./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
@@ -279,58 +285,61 @@ then
if [[ ${BETA} == true ]]
then
- echo -e "${GREEN} -> build beta releases for flavor ${FLAVOR}${NC}"
+ echo "${GREEN} -> build beta releases for flavor ${FLAVOR}${NC}"
./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/.
+ # 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 [[ $(./gradlew tasks --console plain | grep ${FLAVOR}ProductionX86Beta) ]]; then
./gradlew clean assemble${FLAVOR}ProductionX86Beta --stacktrace || quit
- cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionX86/beta/*.apk $RELEASES_FILE_DIR/.
+ cp $BASE_OUTPUT_DIR/${FLAVOR_LOWERCASE}ProductionX86/beta/*.apk $RELEASES_FILE_DIR/.
fi
if [[ $(./gradlew tasks --console plain | grep ${FLAVOR}ProductionX86_64Beta) ]]; then
./gradlew clean assemble${FLAVOR}ProductionX86_64Beta --stacktrace || quit
- cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionX86_64/beta/*.apk $RELEASES_FILE_DIR/.
+ cp $BASE_OUTPUT_DIR/${FLAVOR_LOWERCASE}ProductionX86_64/beta/*.apk $RELEASES_FILE_DIR/.
fi
if [[ $(./gradlew tasks --console plain | grep ${FLAVOR}ProductionArmv7Beta) ]]; then
./gradlew clean assemble${FLAVOR}ProductionArmv7Beta --stacktrace || quit
- cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionArmv7/beta/*.apk $RELEASES_FILE_DIR/.
+ cp $BASE_OUTPUT_DIR/${FLAVOR_LOWERCASE}ProductionArmv7/beta/*.apk $RELEASES_FILE_DIR/.
fi
if [[ $(./gradlew tasks --console plain | grep ${FLAVOR}ProductionArmv7Beta) ]]; then
./gradlew clean assemble${FLAVOR}ProductionArm64Beta --stacktrace || quit
- cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionArm64/beta/*.apk $RELEASES_FILE_DIR/.
+ cp $BASE_OUTPUT_DIR/${FLAVOR_LOWERCASE}ProductionArm64/beta/*.apk $RELEASES_FILE_DIR/.
fi
else
echo -e "${GREEN} -> build stable releases for flavor ${FLAVOR}${NC}"
./gradlew clean assemble${FLAVOR}ProductionFatRelease --stacktrace || quit
- cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionFat/release/*.apk $RELEASES_FILE_DIR/.
+ cp $BASE_OUTPUT_DIR/${FLAVOR_LOWERCASE}ProductionFat/release/*.apk $RELEASES_FILE_DIR/.
./gradlew clean assemble${FLAVOR}ProductionFatwebRelease --stacktrace || quit
- cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionFatweb/release/*.apk $RELEASES_FILE_DIR/.
+ 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 [[ $(./gradlew tasks --console plain | grep ${FLAVOR}ProductionX86Release) ]]; then
./gradlew clean assemble${FLAVOR}ProductionX86Release --stacktrace || quit
- cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionX86/release/*.apk $RELEASES_FILE_DIR/.
+ cp $BASE_OUTPUT_DIR/${FLAVOR_LOWERCASE}ProductionX86/release/*.apk $RELEASES_FILE_DIR/.
fi
if [[ $(./gradlew tasks --console plain | grep ${FLAVOR}ProductionX86_64Release) ]]; then
./gradlew clean assemble${FLAVOR}ProductionX86_64Release --stacktrace || quit
- cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionX86_64/release/*.apk $RELEASES_FILE_DIR/.
+ cp $BASE_OUTPUT_DIR/${FLAVOR_LOWERCASE}ProductionX86_64/release/*.apk $RELEASES_FILE_DIR/.
fi
if [[ $(./gradlew tasks --console plain | grep ${FLAVOR}ProductionArmv7Release) ]]; then
./gradlew clean assemble${FLAVOR}ProductionArmv7Release --stacktrace || quit
- cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionArmv7/release/*.apk $RELEASES_FILE_DIR/.
+ cp $BASE_OUTPUT_DIR/${FLAVOR_LOWERCASE}ProductionArmv7/release/*.apk $RELEASES_FILE_DIR/.
fi
if [[ $(./gradlew tasks --console plain | grep ${FLAVOR}ProductionArm64Release) ]]; then
./gradlew clean assemble${FLAVOR}ProductionArm64Release --stacktrace || quit
- cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionArm64/release/*.apk $RELEASES_FILE_DIR/.
+ 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