fastlane/lib/fastlane/actions/get_version_number.rb in fastlane-2.133.0 vs fastlane/lib/fastlane/actions/get_version_number.rb in fastlane-2.134.0
- old
+ new
@@ -16,18 +16,24 @@
project = get_project!(folder)
target = get_target!(project, target_name)
plist_file = get_plist!(folder, target, configuration)
version_number = get_version_number_from_plist!(plist_file)
- # Get from build settings if needed (ex: $(MARKETING_VERSION) is default in Xcode 11)
+ # Get from build settings (or project settings) if needed (ex: $(MARKETING_VERSION) is default in Xcode 11)
if version_number =~ /\$\(([\w\-]+)\)/
- version_number = get_version_number_from_build_settings!(target, $1, configuration)
+ version_number = get_version_number_from_build_settings!(target, $1, configuration) || get_version_number_from_build_settings!(project, $1, configuration)
+
# ${MARKETING_VERSION} also works
elsif version_number =~ /\$\{([\w\-]+)\}/
- version_number = get_version_number_from_build_settings!(target, $1, configuration)
+ version_number = get_version_number_from_build_settings!(target, $1, configuration) || get_version_number_from_build_settings!(project, $1, configuration)
end
+ # Error out if version_number is not set
+ if version_number.nil?
+ UI.user_error!("Unable to find Xcode build setting: #{$1}")
+ end
+
# Store the number in the shared hash
Actions.lane_context[SharedValues::VERSION_NUMBER] = version_number
# Return the version number because Swift might need this return value
return version_number
@@ -79,10 +85,10 @@
value = config.build_settings[variable]
return value if value
end
end
- UI.user_error!("Unable to find Xcode build setting: #{variable}")
+ return nil
end
def self.get_plist!(folder, target, configuration = nil)
plist_files = target.resolved_build_setting("INFOPLIST_FILE")
plist_files_count = plist_files.values.compact.uniq.count