From 0c69735cdd66c0f335042b68dd83375111269337 Mon Sep 17 00:00:00 2001 From: cyberta Date: Tue, 26 Nov 2019 01:52:38 +0100 Subject: initial commit for apk split --- app/build.gradle | 127 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 124 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 7e4a6e03..2290a06a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,5 +1,6 @@ import java.util.regex.Matcher import java.util.regex.Pattern +import groovy.util.* apply plugin: 'com.android.application' @@ -56,10 +57,11 @@ android { } } - flavorDimensions "branding", "implementation" + flavorDimensions "branding", "implementation", "abi" productFlavors { productFlavors.all { ext.appName = null; + ext.splitApk = false } production { dimension "implementation" @@ -67,12 +69,13 @@ android { insecure { dimension "implementation" } + normal { dimension "branding" appName = "Bitmask" + splitApk = true } - custom { dimension "branding" @@ -106,10 +109,64 @@ android { //The duration in days to trigger the donation reminder buildConfigField 'int', 'donation_reminder_duration', '30' + // Build apks for each architecture, in addition to one 'fat' apk containing libraries for all all architectures + // enable this if you're publishing in gplay + ext { + splitApk = false + } + //************************************************************************** //************************************************************************** } + + + fat { + dimension "abi" + ext { + abiVersionCode = 0 + } + } + + x86 { + dimension "abi" + ndk { + abiFilters "x86" + } + ext { + abiVersionCode = 1 + } + } + + armv7 { + dimension "abi" + ndk { + abiFilters "armeabi-v7a" + } + ext { + abiVersionCode = 2 + } + } + + x86_64 { + dimension "abi" + ndk { + abiFilters "x86_64" + } + ext { + abiVersionCode = 3 + } + } + + arm64 { + dimension "abi" + ndk { + abiFilters "arm64-v8a" + } + ext { + abiVersionCode = 4 + } + } } buildTypes { @@ -159,8 +216,61 @@ android { java.srcDirs += ['src/sharedTest/java'] } } + + /** + * BUILD VARAIANTS: + * ================= + * Development builds: + * -------------------- + * customProductionFatDebug -> branded development build, includes all ABIs + * normalProductionFatDebug -> Bitmask development build, includes all ABIS + * customInsecureFatDebug -> branded development build, doesn't checks certificates (for test server setup w/o valid certificates), includes all ABIs + * normalInsecureFatDebug -> Bitmask development build, doesn't checks certificates (for test server setup w/o valid certificates), includes all ABIs + * + * Branded Releases: + * ----------------- + * customProductionFatBeta -> branded build, includes all ABI's, Beta release + * customProductionFatRelease -> branded build, includes all ABI's, stable release (-> F-Droid, GPlay if not splitApk is set to true) + * + * Bitmask Beta releases: + * ---------------------- + * normalProductionArm64Beta -> Bitmask build, only for ABI arm64, for GPlay Beta channel with split apks (1 of 4) + * normalProductionArmv7Beta -> Bitmask build, only for ABI armeabi-v7a, for GPlay Beta channel with split apks (2 of 4) + * normalProductionX86Beta -> Bitmask build, only for ABI x86, for GPlay Beta channel with split apks (3 of 4) + * normalProductionX86_64Beta -> Bitmask build, only for ABI x86 64 bit, for GPlay Beta channel with split apks (4 of 4) + * normalProductionFatBeta -> Bitmask build, including all ABIS, for izzysoft's F-Droid repo and beta link on download page + * + * Bitmask Stable releases: + * ------------------------ + * normalProductionArm64Release -> Bitmask build, only for ABI arm64, for GPlay releases with split apks (1 of 4) + * normalProductionArmv7Release -> Bitmask build, only for ABI armeabi-v7a, for GPlay releases with split apks (2 of 4) + * normalProductionX86Release -> Bitmask build, only for ABI x86, for GPlay releases with split apks (3 of 4) + * normalProductionX86_64Release -> Bitmask build, only for ABI x86 64 bit, for GPlay releases with split apks (4 of 4) + * normalProductionFatRelease -> Bitmask build, including all ABIS, for official F-Droid repo and stable link on download page + */ + + variantFilter { variant -> + + def names = variant.flavors*.name + def buildTypeName = variant.buildType.name + // flavorDimensions "branding" -> 0, "implementation" -> 1, "abi" -> 2 + def supportsSplitApk = variant.flavors[0].splitApk + // To check for a certain build type, use variant.buildType.name == "" + if (((names.contains("insecure") && !names.contains("fat")) || + (names.contains("insecure") && buildTypeName.contains("beta")) || + (names.contains("insecure") && buildTypeName.contains("release")) || + (buildTypeName.contains("debug") && !names.contains("fat")) || + (!supportsSplitApk && !names.contains("fat"))) + ) { + // Gradle ignores any variants that satisfy the conditions above. + setIgnore(true) + } + } } + + + dependencies { testImplementation 'junit:junit:4.12' //outdated mockito-core version due to powermock dependency @@ -205,11 +315,22 @@ dependencies { } android.applicationVariants.all { variant -> + + // configure app name for different build variants def flavors = variant.productFlavors - // flavorDimensions "branding" -> 0, "implementation" -> 1 + // flavorDimensions "branding" -> 0, "implementation" -> 1, "abi" -> 2 def branding = flavors[0] + def abiDimension = flavors[2] def buildType = variant.buildType variant.resValue "string", "app_name", "\"${branding.appName}${buildType.appSuffix}\"" + + // reconfigure version codes for split builds + variant.outputs.each { output -> + // if not a fat build + if (abiDimension.abiVersionCode > 0) { + output.versionCodeOverride = android.defaultConfig.versionCode * 1000 + abiDimension.abiVersionCode + } + } } -- cgit v1.2.3 From 5706b9e8d890272e8839384f29d6042bf2ae06da Mon Sep 17 00:00:00 2001 From: cyberta Date: Tue, 26 Nov 2019 02:15:42 +0100 Subject: add minifyEnabled and shrinkResources to Release and Beta builds --- app/build.gradle | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/build.gradle b/app/build.gradle index 2290a06a..988b0a31 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -177,6 +177,8 @@ android { //runProguard true if(signingConfigs.contains(release)) signingConfig signingConfigs.release.isSigningReady() ? signingConfigs.release : signingConfigs.debug + minifyEnabled = true + shrinkResources true } beta { initWith release -- cgit v1.2.3 From 66588f76e9b255466eaad2d34edfa87a66c2ff69 Mon Sep 17 00:00:00 2001 From: cyberta Date: Tue, 26 Nov 2019 02:52:03 +0100 Subject: convert riseup vpn's pngs to webp files to reduce apk size --- app/src/custom/res/drawable-land/background_main.png | Bin 38813 -> 0 bytes app/src/custom/res/drawable-land/background_main.webp | Bin 0 -> 10452 bytes .../custom/res/drawable-land/ic_splash_background.png | Bin 60125 -> 0 bytes .../custom/res/drawable-land/ic_splash_background.webp | Bin 0 -> 16928 bytes .../res/drawable-sw600dp-port/background_main.png | Bin 45747 -> 0 bytes .../res/drawable-sw600dp-port/background_main.webp | Bin 0 -> 12894 bytes .../res/drawable-sw600dp-port/ic_splash_background.png | Bin 74566 -> 0 bytes .../res/drawable-sw600dp-port/ic_splash_background.webp | Bin 0 -> 21606 bytes app/src/custom/res/drawable-sw600dp/background_main.png | Bin 64577 -> 0 bytes .../custom/res/drawable-sw600dp/background_main.webp | Bin 0 -> 17034 bytes .../res/drawable-sw600dp/ic_splash_background.png | Bin 86371 -> 0 bytes .../res/drawable-sw600dp/ic_splash_background.webp | Bin 0 -> 23410 bytes app/src/custom/res/drawable/background_drawer.png | Bin 41536 -> 0 bytes app/src/custom/res/drawable/background_drawer.webp | Bin 0 -> 16328 bytes app/src/custom/res/drawable/background_main.png | Bin 45747 -> 0 bytes app/src/custom/res/drawable/background_main.webp | Bin 0 -> 12894 bytes app/src/custom/res/drawable/ic_splash_background.png | Bin 74566 -> 0 bytes app/src/custom/res/drawable/ic_splash_background.webp | Bin 0 -> 21606 bytes app/src/custom/res/drawable/logo_square.png | Bin 6141 -> 0 bytes app/src/custom/res/drawable/logo_square.webp | Bin 0 -> 1042 bytes 20 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 app/src/custom/res/drawable-land/background_main.png create mode 100644 app/src/custom/res/drawable-land/background_main.webp delete mode 100644 app/src/custom/res/drawable-land/ic_splash_background.png create mode 100644 app/src/custom/res/drawable-land/ic_splash_background.webp delete mode 100644 app/src/custom/res/drawable-sw600dp-port/background_main.png create mode 100644 app/src/custom/res/drawable-sw600dp-port/background_main.webp delete mode 100644 app/src/custom/res/drawable-sw600dp-port/ic_splash_background.png create mode 100644 app/src/custom/res/drawable-sw600dp-port/ic_splash_background.webp delete mode 100644 app/src/custom/res/drawable-sw600dp/background_main.png create mode 100644 app/src/custom/res/drawable-sw600dp/background_main.webp delete mode 100644 app/src/custom/res/drawable-sw600dp/ic_splash_background.png create mode 100644 app/src/custom/res/drawable-sw600dp/ic_splash_background.webp delete mode 100644 app/src/custom/res/drawable/background_drawer.png create mode 100644 app/src/custom/res/drawable/background_drawer.webp delete mode 100644 app/src/custom/res/drawable/background_main.png create mode 100644 app/src/custom/res/drawable/background_main.webp delete mode 100644 app/src/custom/res/drawable/ic_splash_background.png create mode 100644 app/src/custom/res/drawable/ic_splash_background.webp delete mode 100644 app/src/custom/res/drawable/logo_square.png create mode 100644 app/src/custom/res/drawable/logo_square.webp diff --git a/app/src/custom/res/drawable-land/background_main.png b/app/src/custom/res/drawable-land/background_main.png deleted file mode 100644 index ce11f5b4..00000000 Binary files a/app/src/custom/res/drawable-land/background_main.png and /dev/null differ diff --git a/app/src/custom/res/drawable-land/background_main.webp b/app/src/custom/res/drawable-land/background_main.webp new file mode 100644 index 00000000..c28c2183 Binary files /dev/null and b/app/src/custom/res/drawable-land/background_main.webp differ diff --git a/app/src/custom/res/drawable-land/ic_splash_background.png b/app/src/custom/res/drawable-land/ic_splash_background.png deleted file mode 100644 index 09103e4b..00000000 Binary files a/app/src/custom/res/drawable-land/ic_splash_background.png and /dev/null differ diff --git a/app/src/custom/res/drawable-land/ic_splash_background.webp b/app/src/custom/res/drawable-land/ic_splash_background.webp new file mode 100644 index 00000000..f939c114 Binary files /dev/null and b/app/src/custom/res/drawable-land/ic_splash_background.webp differ diff --git a/app/src/custom/res/drawable-sw600dp-port/background_main.png b/app/src/custom/res/drawable-sw600dp-port/background_main.png deleted file mode 100644 index 23c7ffa6..00000000 Binary files a/app/src/custom/res/drawable-sw600dp-port/background_main.png and /dev/null differ diff --git a/app/src/custom/res/drawable-sw600dp-port/background_main.webp b/app/src/custom/res/drawable-sw600dp-port/background_main.webp new file mode 100644 index 00000000..6d23e9e1 Binary files /dev/null and b/app/src/custom/res/drawable-sw600dp-port/background_main.webp differ diff --git a/app/src/custom/res/drawable-sw600dp-port/ic_splash_background.png b/app/src/custom/res/drawable-sw600dp-port/ic_splash_background.png deleted file mode 100644 index c5abd96a..00000000 Binary files a/app/src/custom/res/drawable-sw600dp-port/ic_splash_background.png and /dev/null differ diff --git a/app/src/custom/res/drawable-sw600dp-port/ic_splash_background.webp b/app/src/custom/res/drawable-sw600dp-port/ic_splash_background.webp new file mode 100644 index 00000000..227fcb24 Binary files /dev/null and b/app/src/custom/res/drawable-sw600dp-port/ic_splash_background.webp differ diff --git a/app/src/custom/res/drawable-sw600dp/background_main.png b/app/src/custom/res/drawable-sw600dp/background_main.png deleted file mode 100644 index d11acde1..00000000 Binary files a/app/src/custom/res/drawable-sw600dp/background_main.png and /dev/null differ diff --git a/app/src/custom/res/drawable-sw600dp/background_main.webp b/app/src/custom/res/drawable-sw600dp/background_main.webp new file mode 100644 index 00000000..aa6b452b Binary files /dev/null and b/app/src/custom/res/drawable-sw600dp/background_main.webp differ diff --git a/app/src/custom/res/drawable-sw600dp/ic_splash_background.png b/app/src/custom/res/drawable-sw600dp/ic_splash_background.png deleted file mode 100644 index b3fb1f9c..00000000 Binary files a/app/src/custom/res/drawable-sw600dp/ic_splash_background.png and /dev/null differ diff --git a/app/src/custom/res/drawable-sw600dp/ic_splash_background.webp b/app/src/custom/res/drawable-sw600dp/ic_splash_background.webp new file mode 100644 index 00000000..f1a035ec Binary files /dev/null and b/app/src/custom/res/drawable-sw600dp/ic_splash_background.webp differ diff --git a/app/src/custom/res/drawable/background_drawer.png b/app/src/custom/res/drawable/background_drawer.png deleted file mode 100644 index ed138c42..00000000 Binary files a/app/src/custom/res/drawable/background_drawer.png and /dev/null differ diff --git a/app/src/custom/res/drawable/background_drawer.webp b/app/src/custom/res/drawable/background_drawer.webp new file mode 100644 index 00000000..8e0c4a6f Binary files /dev/null and b/app/src/custom/res/drawable/background_drawer.webp differ diff --git a/app/src/custom/res/drawable/background_main.png b/app/src/custom/res/drawable/background_main.png deleted file mode 100644 index 23c7ffa6..00000000 Binary files a/app/src/custom/res/drawable/background_main.png and /dev/null differ diff --git a/app/src/custom/res/drawable/background_main.webp b/app/src/custom/res/drawable/background_main.webp new file mode 100644 index 00000000..6d23e9e1 Binary files /dev/null and b/app/src/custom/res/drawable/background_main.webp differ diff --git a/app/src/custom/res/drawable/ic_splash_background.png b/app/src/custom/res/drawable/ic_splash_background.png deleted file mode 100644 index c5abd96a..00000000 Binary files a/app/src/custom/res/drawable/ic_splash_background.png and /dev/null differ diff --git a/app/src/custom/res/drawable/ic_splash_background.webp b/app/src/custom/res/drawable/ic_splash_background.webp new file mode 100644 index 00000000..227fcb24 Binary files /dev/null and b/app/src/custom/res/drawable/ic_splash_background.webp differ diff --git a/app/src/custom/res/drawable/logo_square.png b/app/src/custom/res/drawable/logo_square.png deleted file mode 100644 index d20cedd5..00000000 Binary files a/app/src/custom/res/drawable/logo_square.png and /dev/null differ diff --git a/app/src/custom/res/drawable/logo_square.webp b/app/src/custom/res/drawable/logo_square.webp new file mode 100644 index 00000000..cd3ad9d0 Binary files /dev/null and b/app/src/custom/res/drawable/logo_square.webp differ -- cgit v1.2.3 From dde51373bb08a7a13aca50259f533fbd85cef53d Mon Sep 17 00:00:00 2001 From: cyberta Date: Tue, 26 Nov 2019 03:33:50 +0100 Subject: remove unrelated abi specific assets in split apk builds --- app/build.gradle | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 988b0a31..1a4e7632 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -60,7 +60,7 @@ android { flavorDimensions "branding", "implementation", "abi" productFlavors { productFlavors.all { - ext.appName = null; + ext.appName = null ext.splitApk = false } production { @@ -125,6 +125,7 @@ android { dimension "abi" ext { abiVersionCode = 0 + abiFilter = "" } } @@ -135,6 +136,7 @@ android { } ext { abiVersionCode = 1 + abiFilter = "x86" } } @@ -145,6 +147,7 @@ android { } ext { abiVersionCode = 2 + abiFilter = "armeabi-v7a" } } @@ -155,6 +158,7 @@ android { } ext { abiVersionCode = 3 + abiFilter = "x86_64" } } @@ -165,6 +169,7 @@ android { } ext { abiVersionCode = 4 + abiFilter = "arm64-v8a" } } } @@ -333,6 +338,19 @@ android.applicationVariants.all { variant -> output.versionCodeOverride = android.defaultConfig.versionCode * 1000 + abiDimension.abiVersionCode } } + + // remove unrelated abi specific assets + variant.mergeAssets.doLast { + // if not a fat build + if (abiDimension.abiVersionCode > 0) { + def filesToDelete = fileTree(dir: variant.mergeAssets.outputDir, excludes: ["*pie_openvpn.${abiDimension.abiFilter}", + 'urls/', + '*.url', + '*.json', + '*.pem']) + delete(filesToDelete) + } + } } -- cgit v1.2.3 From 3c9adb1b45fb547763b4a2102e4c810e81b25164 Mon Sep 17 00:00:00 2001 From: cyberta Date: Fri, 29 Nov 2019 12:10:19 +0100 Subject: configure apk file name depending on flavor and build type --- app/build.gradle | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 1a4e7632..31e00ffb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,6 +1,5 @@ import java.util.regex.Matcher import java.util.regex.Pattern -import groovy.util.* apply plugin: 'com.android.application' @@ -322,21 +321,33 @@ dependencies { } android.applicationVariants.all { variant -> - - // configure app name for different build variants + // configure app name and apk file name for different build variants def flavors = variant.productFlavors // flavorDimensions "branding" -> 0, "implementation" -> 1, "abi" -> 2 def branding = flavors[0] def abiDimension = flavors[2] + def abiFilter = abiDimension.abiFilter + if (abiFilter.length() > 0) { + abiFilter = "_"+abiFilter + } def buildType = variant.buildType + def tag = getTag() + if (tag.length() > 0) { + tag = "_"+tag + } + variant.resValue "string", "app_name", "\"${branding.appName}${buildType.appSuffix}\"" + variant.outputs.all { output -> + output.outputFileName = "${branding.appName}${abiFilter}_${buildType.name}${tag}.apk" + } + // reconfigure version codes for split builds variant.outputs.each { output -> - // if not a fat build - if (abiDimension.abiVersionCode > 0) { - output.versionCodeOverride = android.defaultConfig.versionCode * 1000 + abiDimension.abiVersionCode - } + // if not a fat build + if (abiDimension.abiVersionCode > 0) { + output.versionCodeOverride = android.defaultConfig.versionCode * 1000 + abiDimension.abiVersionCode + } } // remove unrelated abi specific assets @@ -475,7 +486,7 @@ def removeDuplicatedStrings() { def replaceDuplicatesForSource(File it, String type) { def ics_openvpn_file = file(it.absolutePath.replace(type+'.xml', type+'-icsopenvpn.xml')) if(ics_openvpn_file.exists()) { - def ics_openvpn_strings_names = (new XmlParser()).parse(ics_openvpn_file) + def ics_openvpn_strings_names = new XmlParser().parse(ics_openvpn_file) def current_file = it ics_openvpn_strings_names.string.each { @@ -522,11 +533,11 @@ task mergeUntranslatable(dependsOn: 'copyIcsOpenVPNFiles', type: Copy ) { task copyIcsOpenVPNFiles(dependsOn: 'updateIcsOpenVpn') { println "copyIcsOpenVPNFiles" -/* copyIcsOpenVPNClasses + copyIcsOpenVPNClasses copyIcsOpenVPNXml copyIcsOpenVPNImages //mergeUntranslatable.execute() - removeDuplicatedStrings()*/ + removeDuplicatedStrings() } task updateIcsOpenVpn( type: Exec ) { @@ -535,6 +546,11 @@ task updateIcsOpenVpn( type: Exec ) { } +def getTag() { + String commit = "git log --pretty=format:'%h' -n 1".execute().text.trim().replaceAll("'", "") + return ("git describe --tags --exact-match "+ commit).execute().text.trim() +} + task cleanNative( type: Delete ) { def shouldClean = getCurrentFlavorForBetaOrRelease() == "production" @@ -572,4 +588,4 @@ def getCurrentFlavorForBetaOrRelease() { { return ""; } -} \ No newline at end of file +} -- cgit v1.2.3 From 3418ffb921de16520fcda1c98f20344865878edc Mon Sep 17 00:00:00 2001 From: cyberta Date: Fri, 29 Nov 2019 13:36:45 +0100 Subject: current changes --- prepareForDistribution.sh | 173 +++++++++++++++++++++++++++------------------- 1 file changed, 101 insertions(+), 72 deletions(-) diff --git a/prepareForDistribution.sh b/prepareForDistribution.sh index b0d9ef21..4b60a6c2 100755 --- a/prepareForDistribution.sh +++ b/prepareForDistribution.sh @@ -18,6 +18,63 @@ function cleanUp { fi } +function sign { + #---- ALIGN AND JARSIGN APK ----- + ALIGNED_UNSIGNED_APK="${FILE_DIR}/aligned-${FILE_NAME}" + ALIGNED_SIGNED_APK="${FILE_DIR}/aligned-signed-${FILE_NAME}" + + ${ANDROID_BUILD_TOOLS}/zipalign -v -p 4 "${FILE_DIR}/${FILE_NAME}" ${ALIGNED_UNSIGNED_APK} || quit + ${ANDROID_BUILD_TOOLS}/apksigner sign --ks "${KEY_STORE_STRING}" --out ${ALIGNED_SIGNED_APK} ${ALIGNED_UNSIGNED_APK} || quit + rm ${ALIGNED_UNSIGNED_APK} + + FINGERPRINT=$(unzip -p ${ALIGNED_SIGNED_APK} META-INF/*.RSA | keytool -printcert | grep "SHA256" | tr -d '[:space:]') || quit + + if [[ ${FINGERPRINT} == ${EXPECTED_FINGERPRINT} ]] + then + echo "Certificate fingerprint matches: ${FINGERPRINT}" + else + echo -e "Certificate fingerprint \n${FINGERPRINT} \ndid not match expected fingerprint \n\t${EXPECTED_FINGERPRINT}" + quit + fi + + #---- RENAME TO VERSION_NAME ---- + FINAL_APK=${ALIGNED_SIGNED_APK} + if [[ -z ${VERSION_NAME} ]] + then + VERSION_NAME="latest" + fi + + if [[ ${BETA} == true ]] + then + FINAL_FILE_NAME="${APP_NAME}-Android-Beta-${VERSION_NAME}.apk" + else + FINAL_FILE_NAME="${APP_NAME}-Android-${VERSION_NAME}.apk" + fi + FINAL_APK="${FILE_DIR}/${FINAL_FILE_NAME}" + cp ${ALIGNED_SIGNED_APK} ${FINAL_APK} || quit + cleanUp + + + #---- GPG SIGNING ---- + if [[ -z ${GPG_KEY} && -z ${GPG_KEY_USER} ]] + then + echo "WARNING: Could not do gpg signing!" + exit + fi + + if [[ ${GPG_KEY} ]] + then + 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 + 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 + fi + + gpg --verify "${FINAL_APK}.sig" || quit +} + # ----Main----- DO_BUILD=false @@ -164,6 +221,9 @@ then exit fi +BASE_FILE_DIR="$(pwd)/app/build/outputs/apk" +PREPARE_FOR_DISTRIBUTION_FILE_DIR = "$(pwd)/prepareForDistribution" + if [[ ${DO_BUILD} == true ]] then if [[ ${NO_TAG} == false && -z ${VERSION_NAME} ]] @@ -186,11 +246,31 @@ then ./cleanProject.sh || quit ./build_deps.sh || quit + mkdir $PREPARE_FOR_DISTRIBUTION_FILE_DIR if [[ ${BETA} == true ]] then - ./gradlew clean assemble${FLAVOR}ProductionBeta --stacktrace || quit + ./gradlew clean assemble${FLAVOR}ProductionFatBeta --stacktrace || quit + cp $BASE_FILE_DIR/${FLAVOR}ProductionFat/beta/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR + ./gradlew clean assemble${FLAVOR}ProductionX86Beta --stacktrace || quit + cp $BASE_FILE_DIR/${FLAVOR}ProductionX86/beta/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR + ./gradlew clean assemble${FLAVOR}ProductionX86_64Beta --stacktrace || quit + cp $BASE_FILE_DIR/${FLAVOR}ProductionX86_64/beta/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR + ./gradlew clean assemble${FLAVOR}ProductionArmv7Beta --stacktrace || quit + cp $BASE_FILE_DIR/${FLAVOR}ProductionArmv7/beta/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR + ./gradlew clean assemble${FLAVOR}ProductionArm64Beta --stacktrace || quit + cp $BASE_FILE_DIR/${FLAVOR}ProductionArmv64/beta/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR + else - ./gradlew clean assemble${FLAVOR}ProductionRelease --stacktrace || quit + ./gradlew clean assemble${FLAVOR}ProductionFatRelease --stacktrace || quit + cp $BASE_FILE_DIR/${FLAVOR}ProductionFat/release/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR + ./gradlew clean assemble${FLAVOR}ProductionX86Release --stacktrace || quit + cp $BASE_FILE_DIR/${FLAVOR}ProductionX86/release/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR + ./gradlew clean assemble${FLAVOR}ProductionX86_64Release --stacktrace || quit + cp $BASE_FILE_DIR/${FLAVOR}ProductionX86_64/release/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR + ./gradlew clean assemble${FLAVOR}ProductionArmv7Release --stacktrace || quit + cp $BASE_FILE_DIR/${FLAVOR}ProductionArmv7/release/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR + ./gradlew clean assemble${FLAVOR}ProductionArm64Release --stacktrace || quit + cp $BASE_FILE_DIR/${FLAVOR}ProductionArmv64/beta/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR fi fi @@ -221,77 +301,26 @@ then #---- OPT: SELECT APK FROM LAST BUILD ---- if [[ ${DO_BUILD} == true ]] then - BASE_FILE_DIR="$(pwd)/app/build/outputs/apk" - if [[ ${BETA} == true ]] - then - FILE_NAME="app-${FLAVOR_LOWERCASE}-production-beta.apk" - BUILD_TYPE_DIR="beta" - else - FILE_NAME="app-${FLAVOR_LOWERCASE}-production-release.apk" - BUILD_TYPE_DIR="release" - fi - if [[ ${FLAVOR_LOWERCASE} == "normal" ]] - then - FLAVOR_DIR="normalProduction" - else - FLAVOR_DIR="customProduction" - fi - FILE_DIR="${BASE_FILE_DIR}/${FLAVOR_DIR}/${BUILD_TYPE_DIR}" - fi - - #---- ALIGN AND JARSIGN APK ----- - ALIGNED_UNSIGNED_APK="${FILE_DIR}/aligned-${FILE_NAME}" - ALIGNED_SIGNED_APK="${FILE_DIR}/aligned-signed-${FILE_NAME}" - - ${ANDROID_BUILD_TOOLS}/zipalign -v -p 4 "${FILE_DIR}/${FILE_NAME}" ${ALIGNED_UNSIGNED_APK} || quit - ${ANDROID_BUILD_TOOLS}/apksigner sign --ks "${KEY_STORE_STRING}" --out ${ALIGNED_SIGNED_APK} ${ALIGNED_UNSIGNED_APK} || quit - rm ${ALIGNED_UNSIGNED_APK} - - FINGERPRINT=$(unzip -p ${ALIGNED_SIGNED_APK} META-INF/*.RSA | keytool -printcert | grep "SHA256" | tr -d '[:space:]') || quit + FILE_DIR=$PREPARE_FOR_DISTRIBUTION_FILE_DIR +# if [[ ${BETA} == true ]] +# then +# FILE_NAME="app-${FLAVOR_LOWERCASE}-production-beta.apk" +# BUILD_TYPE_DIR="beta" +# else +# FILE_NAME="app-${FLAVOR_LOWERCASE}-production-release.apk" +# BUILD_TYPE_DIR="release" +# fi +# if [[ ${FLAVOR_LOWERCASE} == "normal" ]] +# then +# FLAVOR_DIR="normalProduction" +# else +# FLAVOR_DIR="customProduction" +# fi +# FILE_DIR="${BASE_FILE_DIR}/${FLAVOR_DIR}/${BUILD_TYPE_DIR}" + fi - if [[ ${FINGERPRINT} == ${EXPECTED_FINGERPRINT} ]] - then - echo "Certificate fingerprint matches: ${FINGERPRINT}" - else - echo -e "Certificate fingerprint \n${FINGERPRINT} \ndid not match expected fingerprint \n\t${EXPECTED_FINGERPRINT}" - quit - fi - - #---- RENAME TO VERSION_NAME ---- - FINAL_APK=${ALIGNED_SIGNED_APK} - if [[ -z ${VERSION_NAME} ]] - then - VERSION_NAME="latest" - fi - if [[ ${BETA} == true ]] - then - FINAL_FILE_NAME="${APP_NAME}-Android-Beta-${VERSION_NAME}.apk" - else - FINAL_FILE_NAME="${APP_NAME}-Android-${VERSION_NAME}.apk" - fi - FINAL_APK="${FILE_DIR}/${FINAL_FILE_NAME}" - cp ${ALIGNED_SIGNED_APK} ${FINAL_APK} || quit - cleanUp + ls $FILE_DIR/*\.apk | xargs -I {} sign {} - #---- GPG SIGNING ---- - if [[ -z ${GPG_KEY} && -z ${GPG_KEY_USER} ]] - then - echo "WARNING: Could not do gpg signing!" - exit - fi - - if [[ ${GPG_KEY} ]] - then - 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 - 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 - fi - - gpg --verify "${FINAL_APK}.sig" || quit - -fi \ No newline at end of file +fi -- cgit v1.2.3 From 0b541941dfa005e0fcc50c41cdc880456fa70993 Mon Sep 17 00:00:00 2001 From: cyberta Date: Fri, 29 Nov 2019 14:17:00 +0100 Subject: add go/lib directory to repository --- go/lib/README | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 go/lib/README diff --git a/go/lib/README b/go/lib/README new file mode 100644 index 00000000..e69de29b -- cgit v1.2.3 From b2280e9d8fe4f0de1242600f56c3e0851f44317a Mon Sep 17 00:00:00 2001 From: cyberta Date: Fri, 29 Nov 2019 15:18:58 +0100 Subject: check if split apk related build tasks exist --- prepareForDistribution.sh | 55 +++++++++++++++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 18 deletions(-) diff --git a/prepareForDistribution.sh b/prepareForDistribution.sh index 4b60a6c2..047fcfae 100755 --- a/prepareForDistribution.sh +++ b/prepareForDistribution.sh @@ -243,34 +243,53 @@ then fi fi - ./cleanProject.sh || quit - ./build_deps.sh || quit + #./cleanProject.sh || quit + #./build_deps.sh || quit mkdir $PREPARE_FOR_DISTRIBUTION_FILE_DIR if [[ ${BETA} == true ]] then ./gradlew clean assemble${FLAVOR}ProductionFatBeta --stacktrace || quit cp $BASE_FILE_DIR/${FLAVOR}ProductionFat/beta/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR - ./gradlew clean assemble${FLAVOR}ProductionX86Beta --stacktrace || quit - cp $BASE_FILE_DIR/${FLAVOR}ProductionX86/beta/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR - ./gradlew clean assemble${FLAVOR}ProductionX86_64Beta --stacktrace || quit - cp $BASE_FILE_DIR/${FLAVOR}ProductionX86_64/beta/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR - ./gradlew clean assemble${FLAVOR}ProductionArmv7Beta --stacktrace || quit - cp $BASE_FILE_DIR/${FLAVOR}ProductionArmv7/beta/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR - ./gradlew clean assemble${FLAVOR}ProductionArm64Beta --stacktrace || quit - cp $BASE_FILE_DIR/${FLAVOR}ProductionArmv64/beta/*.apk $PREPARE_FOR_DISTRIBUTION_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}ProductionX86/beta/*.apk $PREPARE_FOR_DISTRIBUTION_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}ProductionX86_64/beta/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR + fi + if [[ $(./gradlew tasks --console plain | grep ${FLAVOR}ProductionArmv7Beta) ]]; then + ./gradlew clean assemble${FLAVOR}ProductionArmv7Beta --stacktrace || quit + cp $BASE_FILE_DIR/${FLAVOR}ProductionArmv7/beta/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR + fi + if [[ $(./gradlew tasks --console plain | grep ${FLAVOR}ProductionArmv7Beta) ]]; then + ./gradlew clean assemble${FLAVOR}ProductionArm64Beta --stacktrace || quit + cp $BASE_FILE_DIR/${FLAVOR}ProductionArmv64/beta/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR + fi else ./gradlew clean assemble${FLAVOR}ProductionFatRelease --stacktrace || quit cp $BASE_FILE_DIR/${FLAVOR}ProductionFat/release/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR - ./gradlew clean assemble${FLAVOR}ProductionX86Release --stacktrace || quit - cp $BASE_FILE_DIR/${FLAVOR}ProductionX86/release/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR - ./gradlew clean assemble${FLAVOR}ProductionX86_64Release --stacktrace || quit - cp $BASE_FILE_DIR/${FLAVOR}ProductionX86_64/release/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR - ./gradlew clean assemble${FLAVOR}ProductionArmv7Release --stacktrace || quit - cp $BASE_FILE_DIR/${FLAVOR}ProductionArmv7/release/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR - ./gradlew clean assemble${FLAVOR}ProductionArm64Release --stacktrace || quit - cp $BASE_FILE_DIR/${FLAVOR}ProductionArmv64/beta/*.apk $PREPARE_FOR_DISTRIBUTION_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}ProductionX86/release/*.apk $PREPARE_FOR_DISTRIBUTION_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}ProductionX86_64/release/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR + fi + if [[ $(./gradlew tasks --console plain | grep ${FLAVOR}ProductioArmv7Release) ]]; then + ./gradlew clean assemble${FLAVOR}ProductionArmv7Release --stacktrace || quit + cp $BASE_FILE_DIR/${FLAVOR}ProductionArmv7/release/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR + fi + if [[ $(./gradlew tasks --console plain | grep ${FLAVOR}ProductionArm64Release) ]]; then + ./gradlew clean assemble${FLAVOR}ProductionArm64Release --stacktrace || quit + cp $BASE_FILE_DIR/${FLAVOR}ProductionArmv64/beta/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR + fi fi fi -- cgit v1.2.3 From 5abafe7b6e1e4eee7b6c9a238e7e0358f20cb52b Mon Sep 17 00:00:00 2001 From: cyberta Date: Wed, 4 Dec 2019 00:49:51 +0100 Subject: avoid apk file name with spaces --- app/build.gradle | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index 31e00ffb..932fa75c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -325,6 +325,7 @@ android.applicationVariants.all { variant -> def flavors = variant.productFlavors // flavorDimensions "branding" -> 0, "implementation" -> 1, "abi" -> 2 def branding = flavors[0] + def trimmedAppName = branding.appName.replaceAll(' ', '') def abiDimension = flavors[2] def abiFilter = abiDimension.abiFilter if (abiFilter.length() > 0) { @@ -339,7 +340,7 @@ android.applicationVariants.all { variant -> variant.resValue "string", "app_name", "\"${branding.appName}${buildType.appSuffix}\"" variant.outputs.all { output -> - output.outputFileName = "${branding.appName}${abiFilter}_${buildType.name}${tag}.apk" + output.outputFileName = "${trimmedAppName}${abiFilter}_${buildType.name}${tag}.apk" } // reconfigure version codes for split builds -- cgit v1.2.3 From f4fbcda41333aabac866a5dad6f4fd4f9302fed6 Mon Sep 17 00:00:00 2001 From: cyberta Date: Wed, 4 Dec 2019 00:51:39 +0100 Subject: adapt prepareForDistribution scipt --- prepareForDistribution.sh | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/prepareForDistribution.sh b/prepareForDistribution.sh index 047fcfae..9a0d7799 100755 --- a/prepareForDistribution.sh +++ b/prepareForDistribution.sh @@ -222,7 +222,7 @@ then fi BASE_FILE_DIR="$(pwd)/app/build/outputs/apk" -PREPARE_FOR_DISTRIBUTION_FILE_DIR = "$(pwd)/prepareForDistribution" +PREPARE_FOR_DISTRIBUTION_FILE_DIR="$(pwd)/prepareForDistribution" if [[ ${DO_BUILD} == true ]] then @@ -243,52 +243,60 @@ then fi fi - #./cleanProject.sh || quit - #./build_deps.sh || quit - - mkdir $PREPARE_FOR_DISTRIBUTION_FILE_DIR + ./cleanProject.sh || quit + ./build_deps.sh || quit + + if [[ ! -d $PREPARE_FOR_DISTRIBUTION_FILE_DIR ]] + then + mkdir $PREPARE_FOR_DISTRIBUTION_FILE_DIR + fi + rm -rf $PREPARE_FOR_DISTRIBUTION_FILE_DIR/* + if [[ ${BETA} == true ]] then + + #TODO: for loop! ./gradlew clean assemble${FLAVOR}ProductionFatBeta --stacktrace || quit - cp $BASE_FILE_DIR/${FLAVOR}ProductionFat/beta/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR + echo "copy file: $(ls $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionFat/beta/*.apk)" + cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionFat/beta/*.apk $PREPARE_FOR_DISTRIBUTION_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}ProductionX86/beta/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR + cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionX86/beta/*.apk $PREPARE_FOR_DISTRIBUTION_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}ProductionX86_64/beta/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR + cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionX86_64/beta/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR/. fi if [[ $(./gradlew tasks --console plain | grep ${FLAVOR}ProductionArmv7Beta) ]]; then ./gradlew clean assemble${FLAVOR}ProductionArmv7Beta --stacktrace || quit - cp $BASE_FILE_DIR/${FLAVOR}ProductionArmv7/beta/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR + cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionArmv7/beta/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR/. fi if [[ $(./gradlew tasks --console plain | grep ${FLAVOR}ProductionArmv7Beta) ]]; then ./gradlew clean assemble${FLAVOR}ProductionArm64Beta --stacktrace || quit - cp $BASE_FILE_DIR/${FLAVOR}ProductionArmv64/beta/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR + cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionArm64/beta/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR/. fi else ./gradlew clean assemble${FLAVOR}ProductionFatRelease --stacktrace || quit - cp $BASE_FILE_DIR/${FLAVOR}ProductionFat/release/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR + cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionFat/release/*.apk $PREPARE_FOR_DISTRIBUTION_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}ProductionX86/release/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR + cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionX86/release/*.apk $PREPARE_FOR_DISTRIBUTION_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}ProductionX86_64/release/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR + cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionX86_64/release/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR/. fi - if [[ $(./gradlew tasks --console plain | grep ${FLAVOR}ProductioArmv7Release) ]]; then + if [[ $(./gradlew tasks --console plain | grep ${FLAVOR}ProductionArmv7Release) ]]; then ./gradlew clean assemble${FLAVOR}ProductionArmv7Release --stacktrace || quit - cp $BASE_FILE_DIR/${FLAVOR}ProductionArmv7/release/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR + cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionArmv7/release/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR/. fi if [[ $(./gradlew tasks --console plain | grep ${FLAVOR}ProductionArm64Release) ]]; then ./gradlew clean assemble${FLAVOR}ProductionArm64Release --stacktrace || quit - cp $BASE_FILE_DIR/${FLAVOR}ProductionArmv64/beta/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR + cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionArm64/release/*.apk $PREPARE_FOR_DISTRIBUTION_FILE_DIR/. fi fi fi -- cgit v1.2.3 From d97b28d3593d6373fd15a55fa28a984eac80971c Mon Sep 17 00:00:00 2001 From: cyBerta Date: Thu, 5 Dec 2019 16:20:55 +0100 Subject: adapt gitlab ci yml file --- .gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c044c673..fac3a92f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -104,7 +104,7 @@ build: script: - ./cleanProject.sh - ./build_deps.sh >> build_deps.log 2>&1 - - ./gradlew clean assembleDebug --stacktrace >> build.log 2>&1 + - ./gradlew clean assembleNormalProductionFatDebug --stacktrace >> build.log 2>&1 artifacts: paths: - app/build/outputs/ @@ -143,7 +143,7 @@ build_custom_release: image: "0xacab.org:4567/leap/bitmask_android/android-ndk:latest" stage: build script: - - ./prepareForDistribution.sh build -no-tag -custom RiseupVPN >> customRelease.log 2>&1 + - ./prepareForDistribution.sh build -no-tag -custom >> customRelease.log 2>&1 artifacts: paths: - app/build/outputs/ @@ -156,7 +156,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 RiseupVPN >> customBeta.log 2>&1 + - ./prepareForDistribution.sh build -no-tag -beta -custom >> customBeta.log 2>&1 artifacts: paths: - app/build/outputs/ -- cgit v1.2.3 From 00ddad068716efb80a9e10bf4cbb64786f03a50c Mon Sep 17 00:00:00 2001 From: cyBerta Date: Thu, 5 Dec 2019 19:34:02 +0100 Subject: add temporarily fix for gradle file hash cache locks bug --- prepareForDistribution.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/prepareForDistribution.sh b/prepareForDistribution.sh index 9a0d7799..b8b7aac8 100755 --- a/prepareForDistribution.sh +++ b/prepareForDistribution.sh @@ -245,6 +245,7 @@ then ./cleanProject.sh || quit ./build_deps.sh || quit + ./fix_gradle_lock.sh || quit if [[ ! -d $PREPARE_FOR_DISTRIBUTION_FILE_DIR ]] then -- cgit v1.2.3 From 17393c379760673f3c036051f1087f2adae5ef37 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sun, 8 Dec 2019 20:53:22 +0100 Subject: improve prepareForDistribution script: handle signing of multiple apks in a directory, add colored output --- prepareForDistribution.sh | 197 +++++++++++++++++++++++++--------------------- 1 file changed, 106 insertions(+), 91 deletions(-) diff --git a/prepareForDistribution.sh b/prepareForDistribution.sh index b8b7aac8..cd5dc288 100755 --- a/prepareForDistribution.sh +++ b/prepareForDistribution.sh @@ -1,8 +1,23 @@ #!/bin/bash +# Copyright (c) 2019 LEAP Encryption Access Project and contributers +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + function quit { - echo "Task failed. Exit value: $?." + echo -e "${RED}Task failed. Exit value: $?.${NC}" cleanUp exit 1 } @@ -20,10 +35,20 @@ function cleanUp { function sign { #---- ALIGN AND JARSIGN APK ----- + if [[ -z $FILE_NAME_STRING ]] + then + FILE_NAME_STRING=$1 + FILE_NAME=${FILE_NAME_STRING##*/} #remove everything till the last '/' + FILE_DIR=${FILE_NAME_STRING%/*} #remove everything after the last '/' + fi + + FINAL_APK="${FILE_DIR}/${FILE_NAME}" ALIGNED_UNSIGNED_APK="${FILE_DIR}/aligned-${FILE_NAME}" ALIGNED_SIGNED_APK="${FILE_DIR}/aligned-signed-${FILE_NAME}" - ${ANDROID_BUILD_TOOLS}/zipalign -v -p 4 "${FILE_DIR}/${FILE_NAME}" ${ALIGNED_UNSIGNED_APK} || quit + echo -e "${GREEN} -> zip align ${ALIGNED_UNSIGNED_APK}${NC}" + ${ANDROID_BUILD_TOOLS}/zipalign -v -p 4 "${FINAL_APK}" ${ALIGNED_UNSIGNED_APK} > /dev/null && echo "zip alignment successful" || quit + echo -e "${GREEN} -> apksign ${ALIGNED_UNSIGNED_APK}${NC}" ${ANDROID_BUILD_TOOLS}/apksigner sign --ks "${KEY_STORE_STRING}" --out ${ALIGNED_SIGNED_APK} ${ALIGNED_UNSIGNED_APK} || quit rm ${ALIGNED_UNSIGNED_APK} @@ -33,45 +58,34 @@ function sign { then echo "Certificate fingerprint matches: ${FINGERPRINT}" else - echo -e "Certificate fingerprint \n${FINGERPRINT} \ndid not match expected fingerprint \n\t${EXPECTED_FINGERPRINT}" + echo -e "${RED}Certificate fingerprint \n${FINGERPRINT} \ndid not match expected fingerprint \n\t${EXPECTED_FINGERPRINT}${NC}" quit fi - - #---- RENAME TO VERSION_NAME ---- - FINAL_APK=${ALIGNED_SIGNED_APK} - if [[ -z ${VERSION_NAME} ]] - then - VERSION_NAME="latest" - fi - if [[ ${BETA} == true ]] - then - FINAL_FILE_NAME="${APP_NAME}-Android-Beta-${VERSION_NAME}.apk" - else - FINAL_FILE_NAME="${APP_NAME}-Android-${VERSION_NAME}.apk" - fi - FINAL_APK="${FILE_DIR}/${FINAL_FILE_NAME}" + echo -e "${GREEN} -> rename aligned signed apk to ${FINAL_APK}${NC}" cp ${ALIGNED_SIGNED_APK} ${FINAL_APK} || quit cleanUp - #---- GPG SIGNING ---- if [[ -z ${GPG_KEY} && -z ${GPG_KEY_USER} ]] then - echo "WARNING: Could not do gpg signing!" + echo -e "${ORANGE}WARNING: Could not do gpg signing!${NC}" exit fi if [[ ${GPG_KEY} ]] 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 + 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 fi - + + echo -e "${GREEN} -> gpg verify ${FINAL_APK}${NC}" gpg --verify "${FINAL_APK}.sig" || quit } @@ -81,11 +95,21 @@ DO_BUILD=false DO_SIGN=false BETA=false NO_TAG=false -APP_NAME="Bitmask" FLAVOR="Normal" FLAVOR_LOWERCASE="normal" EXPECTED_FINGERPRINT="SHA256:9C:94:DB:F8:46:FD:95:97:47:57:17:2A:6A:8D:9A:9B:DF:8C:40:21:A6:6C:15:11:28:28:D1:72:39:1B:81:AA" +GREEN='\033[0;32m' +RED='\033[0;31m' +ORANGE='\033[0;33m' +NC='\033[0m' +export GREEN=${GREEN} +export RED=${RED} +export ORANGE=${ORANGE} +export EXPECTED_FINGERPRINT=${EXPECTED_FINGERPRINT} +export -f sign +export -f quit +export -f cleanUp # init parameters @@ -106,34 +130,38 @@ do FILE_NAME=${FILE_NAME_STRING##*/} #remove everything till the last '/' FILE_DIR=${FILE_NAME_STRING%/*} #remove everything after the last '/' + elif [[ ${!i} = "-d" || ${!i} = "-dir" ]] + then + ((i++)) + FILE_DIR=${!i} + MULTIPLE_APKS=true elif [[ ${!i} = "-ks" || ${!i} = "-keystore" ]] then ((i++)) KEY_STORE_STRING=${!i}; KEY_STORE_NAME=${KEY_STORE_STRING##*/} KEY_STORE_DIR=${KEY_STORE_STRING%/*} - + export KEY_STORE_STRING=${KEY_STORE_STRING} + elif [[ ${!i} = "-v" || ${!i} = "-version" ]] then ((i++)) VERSION_NAME=${!i}; if [[ -z $(git tag --list | grep -w ${VERSION_NAME}) ]] then - echo "ERROR: Version name has to be a git tag!" + echo -e "${RED}ERROR: Version name has to be a git tag!${NC}" exit fi elif [[ ${!i} = "-k" || ${!i} = "-key" ]]; - then - ((i++)) - GPG_KEY=${!i} - elif [[ ${!i} = "-k" || ${!i} = "-key" ]]; then ((i++)) GPG_KEY=${!i} + export GPG_KEY=${GPG_KEY} elif [[ ${!i} = "-u" || ${!i} = "-user" ]]; then ((i++)) GPG_KEY_USER=${!i} + export GPG_KEY_USER=${GPG_KEY_USER} elif [[ ${!i} = "-b" || ${!i} = "-beta" ]]; then BETA=true @@ -143,24 +171,17 @@ do elif [[ ${!i} = "-c" || ${!i} = "-custom" ]] then ((i++)) - APP_NAME=${!i} FLAVOR="Custom" FLAVOR_LOWERCASE="custom" elif [[ ${!i} = "-h" || ${!i} = "-help" ]]; then echo -e " - sign [-ks -fp -f -b -c -u -k] sign a given apk (both app signing and GPG signing) - -b / -beta -------------------------- add 'Beta' to filename of resulting apk (optional) - -c / -custom [appName] -------------- mark build as custom branded Bitmask client and add - custom app name to resulting apk (required for custom - branded builds) + sign [-ks -fp -f -b -u -k] sign a given apk (both app signing and GPG signing) -ks / -keystore [path] -------------- define path to keystore for signing (required) -fp / -fingerprint [fingerprint] ---- define the fingerprint for the app (required for non-LEAP signed apps) - -f / -file [inputfile] -------------- define path to apk going to be signed (required if - sign command is not used in conjuction with build) - -v / -version [gittag] -------------- define app version as part of the resulting apk file - name. If not used, 'latest' will be added instead + -f / -file [inputfile] -------------- define path to apk going to be signed + -d / -dir [path] -------------------- define path to directory including apks to be signed -u / -user [gpguser] ---------------- define the gpg user whose key will be used for GPG signing (optional) -k / -key [gpgkey] ------------------ define the key used for GPG signing. Using this option, @@ -185,19 +206,22 @@ do --------------- * jarsign only: - ./prepareForDistribution.sh sign -f app/build/outputs/apk/app-production-beta.apk -ks ~/path/to/bitmask-android.keystore -v 0.9.7 + ./prepareForDistribution.sh sign -f app/build/outputs/apk/app-production-beta.apk -ks ~/path/to/bitmask-android.keystore * jarsign and gpg sign only: - ./prepareForDistribution.sh sign -f app/build/outputs/apk/app-production-beta.apk -ks ~/path/to/bitmask-android.keystore -u GPG_USER -v 0.9.7 - + ./prepareForDistribution.sh sign -f app/build/outputs/apk/app-production-beta.apk -ks ~/path/to/bitmask-android.keystore -u GPG_USER + + * jarsign and gpg sign all apks in directory: + ./prepareForDistribution.sh sign -d currentReleases/ -ks ~/path/to/bitmask-android.keystore -u GPG_USER + * build custom stable - ./prepareForDistribution.sh build -v 0.9.7 -c RiseupVPN + ./prepareForDistribution.sh build -v 0.9.7 -c * build and sign custom stable: - ./prepareForDistribution.sh build sign -ks ~/path/to/bitmask-android.keystore -u GPG_USER -v 0.9.7 -c RiseupVPN + ./prepareForDistribution.sh build sign -ks ~/path/to/bitmask-android.keystore -u GPG_USER -c -v 0.9.7 * build and sign custom beta: - ./prepareForDistribution.sh build sign -ks ~/path/to/bitmask-android.keystore -u GPG_USER -b -v 0.9.7RC2 -c RiseupVPN + ./prepareForDistribution.sh build sign -ks ~/path/to/bitmask-android.keystore -u GPG_USER -c -b -v 0.9.7RC2 * build and sign stable: ./prepareForDistribution.sh build sign -ks ~/path/to/bitmask-android.keystore -u GPG_USER -v 0.9.7 @@ -207,7 +231,7 @@ do exit else - echo "Invalid argument: ${!i}" + echo -e "${RED}Invalid argument: ${!i}${NC}" exit fi @@ -217,18 +241,18 @@ done; # check what to do if [[ ${DO_BUILD} == false && ${DO_SIGN} == false ]] then - echo "ERROR: No action set. Please check ./prepareForDistribution -help!" + echo -e "${RED}ERROR: No action set. Please check ./prepareForDistribution -help!${NC}" exit fi BASE_FILE_DIR="$(pwd)/app/build/outputs/apk" -PREPARE_FOR_DISTRIBUTION_FILE_DIR="$(pwd)/prepareForDistribution" +RELEASES_FILE_DIR="$(pwd)/currentReleases" if [[ ${DO_BUILD} == true ]] then if [[ ${NO_TAG} == false && -z ${VERSION_NAME} ]] then - echo "ERROR: You didn't enter the version (git tag) to be built. If you really want to force building the current checked out commit, use -no-tag." + echo -e "${RED}ERROR: You didn't enter the version (git tag) to be built. If you really want to force building the current checked out commit, use -no-tag.${NC}" quit fi if [[ ${NO_TAG} == false ]] @@ -247,57 +271,57 @@ then ./build_deps.sh || quit ./fix_gradle_lock.sh || quit - if [[ ! -d $PREPARE_FOR_DISTRIBUTION_FILE_DIR ]] + if [[ ! -d $RELEASES_FILE_DIR ]] then - mkdir $PREPARE_FOR_DISTRIBUTION_FILE_DIR + mkdir $RELEASES_FILE_DIR fi - rm -rf $PREPARE_FOR_DISTRIBUTION_FILE_DIR/* + rm -rf $RELEASES_FILE_DIR/* if [[ ${BETA} == true ]] then - - #TODO: for loop! + echo -e "${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 $PREPARE_FOR_DISTRIBUTION_FILE_DIR/. + # echo "copy file: $(ls $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionFat/beta/*.apk)" + cp $BASE_FILE_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 $PREPARE_FOR_DISTRIBUTION_FILE_DIR/. + cp $BASE_FILE_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 $PREPARE_FOR_DISTRIBUTION_FILE_DIR/. + cp $BASE_FILE_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 $PREPARE_FOR_DISTRIBUTION_FILE_DIR/. + cp $BASE_FILE_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 $PREPARE_FOR_DISTRIBUTION_FILE_DIR/. + cp $BASE_FILE_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 $PREPARE_FOR_DISTRIBUTION_FILE_DIR/. + cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionFat/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 $PREPARE_FOR_DISTRIBUTION_FILE_DIR/. + cp $BASE_FILE_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 $PREPARE_FOR_DISTRIBUTION_FILE_DIR/. + cp $BASE_FILE_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 $PREPARE_FOR_DISTRIBUTION_FILE_DIR/. + cp $BASE_FILE_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 $PREPARE_FOR_DISTRIBUTION_FILE_DIR/. + cp $BASE_FILE_DIR/${FLAVOR_LOWERCASE}ProductionArm64/release/*.apk $RELEASES_FILE_DIR/. fi fi fi @@ -307,48 +331,39 @@ then # check global vars if [[ -z ${ANDROID_BUILD_TOOLS} ]] then - echo "ERROR: Environment variable ANDROID_BUILD_TOOLS not set! Please add it to your environment variables. Exiting." + echo -e "${RED}ERROR: Environment variable ANDROID_BUILD_TOOLS not set! Please add it to your environment variables. Exiting.${NC}" exit fi - if [[ -z ${FILE_NAME} && ${DO_BUILD} == false ]] + if [[ -z ${FILE_NAME} && -z ${FILE_DIR} && ${DO_BUILD} == false ]] then - echo -e "ERROR: Sign only needs a file name. Please check ./prepareForDistribution -help!" + echo -e "${RED}ERROR: Sign only needs a file name or a directory. Please check ./prepareForDistribution -help!${NC}" exit fi if [[ -z ${KEY_STORE_NAME} ]] then - echo "ERROR: Key store not set. Please check ./prepareForDistribution -help" + echo -e "${RED}ERROR: Key store not set. Please check ./prepareForDistribution -help${NC}" exit fi if [[ -n ${FILE_NAME_STRING} && ${DO_BUILD} == true ]] then - echo "WARNING: Ignoring parameter -file. Built APK will be used instead." + echo -e "${ORANGE}WARNING: Ignoring parameter -file. Built APK will be used instead.${NC}" fi #---- OPT: SELECT APK FROM LAST BUILD ---- if [[ ${DO_BUILD} == true ]] then - FILE_DIR=$PREPARE_FOR_DISTRIBUTION_FILE_DIR -# if [[ ${BETA} == true ]] -# then -# FILE_NAME="app-${FLAVOR_LOWERCASE}-production-beta.apk" -# BUILD_TYPE_DIR="beta" -# else -# FILE_NAME="app-${FLAVOR_LOWERCASE}-production-release.apk" -# BUILD_TYPE_DIR="release" -# fi -# if [[ ${FLAVOR_LOWERCASE} == "normal" ]] -# then -# FLAVOR_DIR="normalProduction" -# else -# FLAVOR_DIR="customProduction" -# fi -# FILE_DIR="${BASE_FILE_DIR}/${FLAVOR_DIR}/${BUILD_TYPE_DIR}" - fi - - - - ls $FILE_DIR/*\.apk | xargs -I {} sign {} - + FILE_DIR=$RELEASES_FILE_DIR + echo -e "${GREEN} -> sign apks:${NC}" + ls -w 1 $FILE_DIR/*\.apk | xargs -I {} echo {} + xargs -I _ -ra <(ls -w 1 $FILE_DIR/*\.apk) bash -c 'sign _' + elif [[ ${MULTIPLE_APKS} == true ]] + then + echo -e "${GREEN} -> sign apks:${NC}" + ls -w 1 $FILE_DIR/*\.apk | xargs -I {} echo {} + xargs -I _ -ra <(ls -w 1 $FILE_DIR/*\.apk) bash -c 'sign _' + else + echo -e "${GREEN} -> sign apk: ${FILE_NAME_STRING}${NC}" + sign $FILE_NAME_STRING + fi fi -- cgit v1.2.3 From dfc9c26427871ee6b65e7fbf1d5384c8208e9c8b Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sun, 8 Dec 2019 23:07:48 +0100 Subject: add currentReleases directory to output path for release and beta CI builds --- .gitlab-ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fac3a92f..65ae0a25 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -121,6 +121,7 @@ build_release: artifacts: paths: - app/build/outputs/ + - currentReleases/ - normalRelease.log when: always expire_in: 1 week @@ -134,6 +135,7 @@ build_fdroid_beta_release: artifacts: paths: - app/build/outputs/ + - currentReleases/ - normalBeta.log when: always expire_in: 1 week @@ -147,6 +149,7 @@ build_custom_release: artifacts: paths: - app/build/outputs/ + - currentReleases/ - customRelease.log when: always expire_in: 1 week @@ -160,6 +163,7 @@ build_fdroid_custom_beta_release: artifacts: paths: - app/build/outputs/ + - currentReleases/ - customBeta.log when: always expire_in: 1 week -- cgit v1.2.3 From 25d65ed83b8b6d7593e19907e0e4ed542f3b7aa2 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sun, 8 Dec 2019 23:08:21 +0100 Subject: delete currentReleases folder in cleanProject script --- cleanProject.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/cleanProject.sh b/cleanProject.sh index 000026dd..703788cc 100755 --- a/cleanProject.sh +++ b/cleanProject.sh @@ -7,5 +7,6 @@ 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 -- cgit v1.2.3 From 777a59fd8bd27cf4358322cb3f82b0c0910aa6df Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sun, 8 Dec 2019 23:09:40 +0100 Subject: add currentReleases directory to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 00d967a4..dfaad42a 100644 --- a/.gitignore +++ b/.gitignore @@ -80,5 +80,6 @@ jniLibs app/ovpnlibs app/.externalNativeBuild releases +currentReleases go/golang/go \ No newline at end of file -- cgit v1.2.3 From 5811f80f7b4a6e8dbc5eef53cc02d2ecb13e8c5f Mon Sep 17 00:00:00 2001 From: cyBerta Date: Wed, 11 Dec 2019 23:41:20 +0100 Subject: wrap dialogs in try catch clause for now --- .../java/se/leap/bitmaskclient/EipFragment.java | 37 ++++++++++++++-------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java index 0485e907..a6f8040f 100644 --- a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java @@ -324,13 +324,17 @@ public class EipFragment extends Fragment implements Observer { return; } - AlertDialog.Builder alertBuilder = new AlertDialog.Builder(getActivity()); - showPendingStartCancellation = true; - alertDialog = alertBuilder.setTitle(activity.getString(R.string.eip_cancel_connect_title)) - .setMessage(activity.getString(R.string.eip_cancel_connect_text)) - .setPositiveButton((android.R.string.yes), (dialog, which) -> stopEipIfPossible()) - .setNegativeButton(activity.getString(android.R.string.no), (dialog, which) -> { - }).setOnDismissListener(dialog -> showPendingStartCancellation = false).show(); + try { + AlertDialog.Builder alertBuilder = new AlertDialog.Builder(getActivity()); + showPendingStartCancellation = true; + alertDialog = alertBuilder.setTitle(activity.getString(R.string.eip_cancel_connect_title)) + .setMessage(activity.getString(R.string.eip_cancel_connect_text)) + .setPositiveButton((android.R.string.yes), (dialog, which) -> stopEipIfPossible()) + .setNegativeButton(activity.getString(android.R.string.no), (dialog, which) -> { + }).setOnDismissListener(dialog -> showPendingStartCancellation = false).show(); + } catch (IllegalStateException e) { + e.printStackTrace(); + } } @@ -340,13 +344,18 @@ public class EipFragment extends Fragment implements Observer { Log.e(TAG, "activity is null when asking to stop EIP"); return; } - AlertDialog.Builder alertBuilder = new AlertDialog.Builder(activity); - showAskToStopEip = true; - alertDialog = alertBuilder.setTitle(activity.getString(R.string.eip_cancel_connect_title)) - .setMessage(activity.getString(R.string.eip_warning_browser_inconsistency)) - .setPositiveButton((android.R.string.yes), (dialog, which) -> stopEipIfPossible()) - .setNegativeButton(activity.getString(android.R.string.no), (dialog, which) -> { - }).setOnDismissListener(dialog -> showAskToStopEip = false).show(); + try { + AlertDialog.Builder alertBuilder = new AlertDialog.Builder(activity); + showAskToStopEip = true; + alertDialog = alertBuilder.setTitle(activity.getString(R.string.eip_cancel_connect_title)) + .setMessage(activity.getString(R.string.eip_warning_browser_inconsistency)) + .setPositiveButton((android.R.string.yes), (dialog, which) -> stopEipIfPossible()) + .setNegativeButton(activity.getString(android.R.string.no), (dialog, which) -> { + }).setOnDismissListener(dialog -> showAskToStopEip = false).show(); + } catch (IllegalStateException e) { + e.printStackTrace(); + } + } @Override -- cgit v1.2.3 From 938f54ffd546fb8372e65edfd5a4de0c6ca9a569 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Thu, 12 Dec 2019 00:18:55 +0100 Subject: revert minifying sources for now --- app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 932fa75c..0726cca8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -181,8 +181,8 @@ android { //runProguard true if(signingConfigs.contains(release)) signingConfig signingConfigs.release.isSigningReady() ? signingConfigs.release : signingConfigs.debug - minifyEnabled = true - shrinkResources true + //minifyEnabled = true + //shrinkResources true } beta { initWith release -- cgit v1.2.3