From d4dcf1419c74911c29e1dd4b93156a86c57f993a Mon Sep 17 00:00:00 2001 From: Armand <4831c0@proton.me> Date: Sat, 30 Aug 2025 10:05:30 +0200 Subject: [PATCH] Jenkinsfile: transform apk on f-droid builds --- Jenkinsfile | 30 ++++++++++++++++++++++++++++-- tools/linux/build_apk.sh | 8 ++++---- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8d840be..2e04ba7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -47,6 +47,31 @@ pipeline { } } } + stage('Modify firka_bundle.dart') { + when { + branch 'main' + } + steps { + script { + sh '''#!/bin/sh + set -e + + BUNDLE_FILE="firka/lib/helpers/firka_bundle.dart" + + if [ -f "$BUNDLE_FILE" ]; then + echo "Modifying $BUNDLE_FILE" + sed -i 's/final bool _compressedBundle = false;/final bool _compressedBundle = Platform.isAndroid;/' "$BUNDLE_FILE" + echo "Modified _compressedBundle setting" + + grep "_compressedBundle" "$BUNDLE_FILE" || echo "Warning: _compressedBundle line not found after modification" + else + echo "$BUNDLE_FILE not found" + exit 1 + fi + ''' + } + } + } stage('Build firka') { steps { sh 'bash -c "./tools/linux/build_apk.sh ' + env.BRANCH_NAME + '"' @@ -202,10 +227,11 @@ pipeline { rm firka/build/app/outputs/flutter-apk/app.firka.naplo_*.apk || true rm firka/build/app/outputs/flutter-apk/app-debug.apk || true rm version_code.txt || true - git checkout -- firka/pubspec.yaml + git checkout -- firka/pubspec.yaml || true + git checkout -- firka/lib/helpers/firka_bundle.dart || true ''' } } } } -} \ No newline at end of file +} diff --git a/tools/linux/build_apk.sh b/tools/linux/build_apk.sh index 4cec07f..9a258a1 100755 --- a/tools/linux/build_apk.sh +++ b/tools/linux/build_apk.sh @@ -24,7 +24,7 @@ if [ "$1" = "main" ]; then mkdir -p build/app/tmp update_version_for_abi 1000 - flutter build apk --release --tree-shake-icons \ + TRANSFORM_APK=true flutter build apk --release --tree-shake-icons \ --local-engine-src-path "$sdk_path/engine/src" \ --local-engine=android_release --local-engine-host=host_release \ --split-per-abi \ @@ -32,7 +32,7 @@ if [ "$1" = "main" ]; then mv build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk build/app/tmp/ update_version_for_abi 2000 - flutter build apk --release --tree-shake-icons \ + TRANSFORM_APK=true flutter build apk --release --tree-shake-icons \ --local-engine-src-path "$sdk_path/engine/src" \ --local-engine=android_release_arm64 --local-engine-host=host_release \ --split-per-abi \ @@ -40,7 +40,7 @@ if [ "$1" = "main" ]; then mv build/app/outputs/flutter-apk/app-arm64-v8a-release.apk build/app/tmp/ update_version_for_abi 3000 - flutter build apk --release --tree-shake-icons \ + TRANSFORM_APK=true flutter build apk --release --tree-shake-icons \ --local-engine-src-path "$sdk_path/engine/src" \ --local-engine=android_release_x64 --local-engine-host=host_release \ --split-per-abi \ @@ -57,4 +57,4 @@ if [ "$1" = "main" ]; then else update_version_for_abi 0 TRANSFORM_APK=true flutter build apk --debug --target-platform android-arm,android-arm64,android-x64 -fi \ No newline at end of file +fi