Skip to content

Commit 598a668

Browse files
committed
Enhance APK, AAB, and IPA path validation in sentry_upload_build
- Added default values for apk_path, aab_path, and ipa_path parameters. - Improved verification logic to skip validation for nil or empty values. - Ensured proper error handling for invalid paths and file types. This update refines the user experience by preventing unnecessary errors during configuration.
1 parent 277ec84 commit 598a668

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib/fastlane/plugin/sentry/actions/sentry_upload_build.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,25 +91,37 @@ def self.available_options
9191
end),
9292
FastlaneCore::ConfigItem.new(key: :apk_path,
9393
description: "Path to your Android APK file (.apk). Mutually exclusive with xcarchive_path, aab_path, and ipa_path",
94+
default_value: Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH],
9495
optional: true,
9596
conflicting_options: [:xcarchive_path, :aab_path, :ipa_path],
9697
verify_block: proc do |value|
97-
UI.user_error!("Could not find APK at path '#{value}'") unless File.exist?(value)
98+
# Skip validation if value is nil or empty (will be validated in run method)
99+
next if value.nil? || value.to_s.empty?
100+
101+
UI.user_error!("Could not find APK at path '#{value}'") unless File.exist?(value)
98102
UI.user_error!("Path '#{value}' is not an APK") unless File.extname(value).casecmp('.apk').zero?
99103
end),
100104
FastlaneCore::ConfigItem.new(key: :aab_path,
101105
description: "Path to your Android App Bundle (.aab). Mutually exclusive with xcarchive_path, apk_path, and ipa_path",
106+
default_value: Actions.lane_context[SharedValues::GRADLE_AAB_OUTPUT_PATH],
102107
optional: true,
103108
conflicting_options: [:xcarchive_path, :apk_path, :ipa_path],
104109
verify_block: proc do |value|
110+
# Skip validation if value is nil or empty (will be validated in run method)
111+
next if value.nil? || value.to_s.empty?
112+
105113
UI.user_error!("Could not find AAB at path '#{value}'") unless File.exist?(value)
106114
UI.user_error!("Path '#{value}' is not an AAB") unless File.extname(value).casecmp('.aab').zero?
107115
end),
108116
FastlaneCore::ConfigItem.new(key: :ipa_path,
109117
description: "Path to your iOS app bundle (.ipa). Mutually exclusive with xcarchive_path, apk_path, and aab_path",
118+
default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH],
110119
optional: true,
111120
conflicting_options: [:xcarchive_path, :apk_path, :aab_path],
112121
verify_block: proc do |value|
122+
# Skip validation if value is nil or empty (will be validated in run method)
123+
next if value.nil? || value.to_s.empty?
124+
113125
UI.user_error!("Could not find IPA at path '#{value}'") unless File.exist?(value)
114126
UI.user_error!("Path '#{value}' is not an IPA") unless File.extname(value).casecmp('.ipa').zero?
115127
end),

0 commit comments

Comments
 (0)