File tree Expand file tree Collapse file tree 2 files changed +35
-5
lines changed
lib/fastlane/plugin/firebase_app_distribution/actions Expand file tree Collapse file tree 2 files changed +35
-5
lines changed Original file line number Diff line number Diff line change @@ -23,11 +23,9 @@ def self.run(params)
2323
2424 if params [ :app ] # Set app_id if it is specified as a parameter
2525 app_id = params [ :app ]
26- elsif platform == :ios
27- archive_path = Actions . lane_context [ SharedValues ::XCODEBUILD_ARCHIVE ]
28- if archive_path
29- app_id = get_ios_app_id_from_archive_plist ( archive_path , params [ :googleservice_info_plist_path ] )
30- end
26+ elsif xcode_archive_path
27+ plist_path = params [ :googleservice_info_plist_path ]
28+ app_id = get_ios_app_id_from_archive_plist ( xcode_archive_path , plist_path )
3129 end
3230 if app_id . nil?
3331 UI . crash! ( ErrorMessage ::MISSING_APP_ID )
@@ -68,6 +66,14 @@ def self.details
6866 "Release your beta builds with Firebase App Distribution"
6967 end
7068
69+ def self . xcode_archive_path
70+ # prevents issues on cross-platform build environments where an XCode build happens within
71+ # the same lane
72+ return nil if lane_platform == :android
73+
74+ Actions . lane_context [ SharedValues ::XCODEBUILD_ARCHIVE ]
75+ end
76+
7177 def self . lane_platform
7278 Actions . lane_context [ Actions ::SharedValues ::PLATFORM_NAME ]
7379 end
Original file line number Diff line number Diff line change 1+ require 'fastlane/action'
2+
13describe Fastlane ::Actions ::FirebaseAppDistributionAction do
24 let ( :action ) { Fastlane ::Actions ::FirebaseAppDistributionAction }
35 describe '#platform_from_app_id' do
3537 expect ( action . binary_path_from_platform ( nil , nil , nil ) ) . to eq ( nil )
3638 end
3739 end
40+
41+ describe '#xcode_archive_path' do
42+ it 'returns the archive path is set, and platform is not Android' do
43+ allow ( Fastlane ::Actions ) . to receive ( :lane_context ) . and_return ( {
44+ XCODEBUILD_ARCHIVE : '/path/to/archive'
45+ } )
46+ expect ( action . xcode_archive_path ) . to eq ( '/path/to/archive' )
47+ end
48+
49+ it 'returns nil if platform is Android' do
50+ allow ( Fastlane ::Actions ) . to receive ( :lane_context ) . and_return ( {
51+ XCODEBUILD_ARCHIVE : '/path/to/archive' ,
52+ PLATFORM_NAME : :android
53+ } )
54+ expect ( action . xcode_archive_path ) . to be_nil
55+ end
56+
57+ it 'returns nil if the archive path is not set' do
58+ allow ( Fastlane ::Actions ) . to receive ( :lane_context ) . and_return ( { } )
59+ expect ( action . xcode_archive_path ) . to be_nil
60+ end
61+ end
3862end
You can’t perform that action at this time.
0 commit comments