Add F-Droids iod-apk-scanner to Fastlane build process

This commit is contained in:
Julian Raufelder 2021-07-13 23:49:13 +02:00
parent e76e8016e6
commit 73bc1578d9
No known key found for this signature in database
GPG Key ID: 17EE71F6634E381D
2 changed files with 41 additions and 0 deletions

View File

@ -181,6 +181,8 @@ platform :android do |options|
} }
) )
checkTrackingAddedInDependency(alpha:options[:alpha], beta:options[:beta])
if options[:alpha] or options[:beta] if options[:alpha] or options[:beta]
puts "Skipping deployment to F-Droid cause there isn't currently a alpha/beta channel" puts "Skipping deployment to F-Droid cause there isn't currently a alpha/beta channel"
else else
@ -210,6 +212,44 @@ platform :android do |options|
FileUtils.cp(lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH], "release/Cryptomator-#{version}_fdroid_signed.apk") FileUtils.cp(lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH], "release/Cryptomator-#{version}_fdroid_signed.apk")
end 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" desc "Create GitHub draft release"
lane :createGitHubDraftRelease do |options| lane :createGitHubDraftRelease do |options|
target_branch = "main" target_branch = "main"

1
fastlane/result.json Normal file
View File

@ -0,0 +1 @@
{"applicationId":"org.cryptomator","emoji":[],"labels":[],"report":"<h3>APK library scanner</h3><details>\n<summary>unsigned/org.cryptomator_1.6.1-SNAPSHOT.apk</summary>\nApktool failed (rc: 1), analysis skipped.\n</details>\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}}