[Android] Add a path environment var for fastlane

Nicolas Pomepuy git at videolan.org
Wed Nov 25 15:47:43 CET 2020


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Nov 25 15:31:12 2020 +0100| [366b3b302d6ce1d07484ba91f83c18b08b658aa7] | committer: Nicolas Pomepuy

Add a path environment var for fastlane

> https://code.videolan.org/videolan/vlc-android/commit/366b3b302d6ce1d07484ba91f83c18b08b658aa7
---

 buildsystem/automation/README.md         |  2 +-
 buildsystem/automation/fastlane/Fastfile | 20 +++++++++++++++-----
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/buildsystem/automation/README.md b/buildsystem/automation/README.md
index 6daa2f2c9..89880472f 100644
--- a/buildsystem/automation/README.md
+++ b/buildsystem/automation/README.md
@@ -30,7 +30,7 @@ Available lanes:
 
 ### Deployment
 
-Once the build is done by the CI and signed, copy the apks into this directory
+Once the build is done by the CI and signed, copy the apks into this directory or you can use the `FASTLANE_APK_PATH` env var to tell fastlane the path to use (relative path only) 
 
 #### Play Store:
 
diff --git a/buildsystem/automation/fastlane/Fastfile b/buildsystem/automation/fastlane/Fastfile
index fe24974b4..ef5ebf17b 100644
--- a/buildsystem/automation/fastlane/Fastfile
+++ b/buildsystem/automation/fastlane/Fastfile
@@ -18,11 +18,12 @@ default_platform(:android)
 platform :android do
 
     @variants = ['arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64']
+    @apkPath = ENV["FASTLANE_APK_PATH"]
 
     def checkAPKFileExists(version, checkSha)
         allExist = true
         @variants.each { |variant|
-            file_name = "VLC-Android-"+version+"-"+variant+".apk"
+            file_name = @apkPath+"VLC-Android-"+version+"-"+variant+".apk"
             # checking apks
             if (!File.file?("../"+file_name))
                allExist = false
@@ -44,7 +45,7 @@ platform :android do
     def getFileList(version)
         files = Array.new
         @variants.each { |variant|
-            files.push("VLC-Android-"+version+"-"+variant+".apk")
+            files.push(@apkPath+"VLC-Android-"+version+"-"+variant+".apk")
         }
         return files
     end
@@ -61,6 +62,15 @@ platform :android do
     slack(message: 'Successfully created a new draft for '+options[:version])
   end
 
+  lane :test_files do |options|
+    sh("pwd")
+    checkAPKFileExists options[:version], false
+    getFileList(options[:version]).each { |version|
+        UI.message version
+    }
+
+  end
+
   lane :deploy_screenshots do
     upload_to_play_store(skip_upload_changelogs:true, skip_upload_images:true, skip_upload_apk:true, release_status:"draft")
     slack(message: 'Successfully uploaded screenshots to Play Store')
@@ -115,7 +125,7 @@ platform :android do
         client_id: ENV["HUAWEI_CLIENT_ID"],
         client_secret: ENV["HUAWEI_CLIENT_SECRET"],
         app_id: ENV["HUAWEI_APP_ID"],
-        apk_path: "VLC-Android-"+options[:version]+"-arm64-v8a.apk",
+        apk_path: @apkPath+"VLC-Android-"+options[:version]+"-arm64-v8a.apk",
         submit_for_review: false,
     )
     slack(message: 'Successfully created a new draft for '+options[:version]+' on Huawei AppGallery')
@@ -132,7 +142,7 @@ platform :android do
             username: 'anonymous',
             password: '',
             upload:{
-                src: "./VLC-Android-"+options[:version]+"-"+variant+".apk",
+                src: @apkPath+"VLC-Android-"+options[:version]+"-"+variant+".apk",
                 dest: "/incoming/"+options[:version]
             }
         )
@@ -141,7 +151,7 @@ platform :android do
             username: 'anonymous',
             password: '',
             upload:{
-                src: "./VLC-Android-"+options[:version]+"-"+variant+".apk.sha256",
+                src: @apkPath+"VLC-Android-"+options[:version]+"-"+variant+".apk.sha256",
                 dest: "/incoming/"+options[:version]
             }
         )



More information about the Android mailing list