From 73bc1578d96a43c848b35c354bd3a6480c623bc2 Mon Sep 17 00:00:00 2001 From: Julian Raufelder Date: Tue, 13 Jul 2021 23:49:13 +0200 Subject: [PATCH] Add F-Droids iod-apk-scanner to Fastlane build process --- fastlane/Fastfile | 40 ++++++++++++++++++++++++++++++++++++++++ fastlane/result.json | 1 + 2 files changed, 41 insertions(+) create mode 100644 fastlane/result.json diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 8237c70c..a757c90c 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -181,6 +181,8 @@ platform :android do |options| } ) + checkTrackingAddedInDependency(alpha:options[:alpha], beta:options[:beta]) + if options[:alpha] or options[:beta] puts "Skipping deployment to F-Droid cause there isn't currently a alpha/beta channel" else @@ -210,6 +212,44 @@ platform :android do |options| FileUtils.cp(lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH], "release/Cryptomator-#{version}_fdroid_signed.apk") end + desc "Check if tracking added in some dependency" + private lane :checkTrackingAddedInDependency do |options| + puts "Check if script file is latest" + sh("wget -O current_iod-scan-apk.php https://gitlab.com/fdroid/issuebot/-/raw/master/modules/iod-scan-apk.php") + + same_script = FileUtils.compare_file("iod-scan-apk.php", "current_iod-scan-apk.php") + if same_script + puts "Script file unchanged" + FileUtils.rm("current_iod-scan-apk.php") + else + UI.error("Script updated, check diff, download and save to iod-scan-apk.php") + fail + end + + FileUtils.mkdir("unsigned") + + FileUtils.cp(lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH], "unsigned/org.cryptomator_#{version}.apk") + + sh("ISSUEBOT_CURRENT_APPLICATION_ID=org.cryptomator ISSUEBOT_CURRENT_REPLY_FILE=current_result.json php iod-scan-apk.php") + + # clean up + FileUtils.rm("libinfo.txt") + FileUtils.rm("libsmali.txt") + FileUtils.rm_r("unsigned") + FileUtils.rm_r("org.cryptomator_#{version}") + + puts "Check if something changed in the APK regarding the dependencies" + same_files = FileUtils.compare_file("result.json", "current_result.json") + + if same_files + puts "Dependencies unchanged" + FileUtils.rm("current_result.json") + else + UI.error("Dependencies changed, check result of current_result.json, if no problem, move it to result.json, commit and retry") + fail + end + end + desc "Create GitHub draft release" lane :createGitHubDraftRelease do |options| target_branch = "main" diff --git a/fastlane/result.json b/fastlane/result.json new file mode 100644 index 00000000..6666c8bd --- /dev/null +++ b/fastlane/result.json @@ -0,0 +1 @@ +{"applicationId":"org.cryptomator","emoji":[],"labels":[],"report":"

APK library scanner

\nunsigned/org.cryptomator_1.6.1-SNAPSHOT.apk\nApktool failed (rc: 1), analysis skipped.\n
\n","reportData":{"log":["Fetching library definitions from https://gitlab.com/IzzyOnDroid/repo/-/raw/master/lib","Loaded 2500 library definitions","Analyzing 'unsigned/org.cryptomator_1.6.1-SNAPSHOT.apk'...","Apktool returned: 1","Apktool failed, skipping analysis."],"self_url":null}} \ No newline at end of file