Method: FastlaneCore::Project#build_settings
- Defined in:
- fastlane_core/lib/fastlane_core/project.rb
permalink #build_settings(key: nil, optional: true) ⇒ Object
Get the build settings for our project e.g. to properly get the DerivedData folder
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 |
# File 'fastlane_core/lib/fastlane_core/project.rb', line 341 def build_settings(key: nil, optional: true) unless @build_settings if is_workspace if schemes.count == 0 UI.user_error!("Could not find any schemes for Xcode workspace at path '#{self.path}'. Please make sure that the schemes you want to use are marked as `Shared` from Xcode.") end [:scheme] ||= schemes.first end command = build_xcodebuild_showbuildsettings_command # Xcode might hang here and retrying fixes the problem, see fastlane#4059 begin timeout = FastlaneCore::Project.xcode_build_settings_timeout retries = FastlaneCore::Project.xcode_build_settings_retries @build_settings = FastlaneCore::Project.run_command(command, timeout: timeout, retries: retries, print: !self.xcodebuild_list_silent) if @build_settings.empty? UI.error("Could not read build settings. Make sure that the scheme \"#{[:scheme]}\" is configured for running by going to Product → Scheme → Edit Scheme…, selecting the \"Build\" section, checking the \"Run\" checkbox and closing the scheme window.") end rescue Timeout::Error raise FastlaneCore::Interface::FastlaneDependencyCausedException.new, "xcodebuild -showBuildSettings timed out after #{retries + 1} retries with a base timeout of #{timeout}." \ " You can override the base timeout value with the environment variable FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT," \ " and the number of retries with the environment variable FASTLANE_XCODEBUILD_SETTINGS_RETRIES ".red end end begin result = @build_settings.split("\n").find do |c| sp = c.split(" = ") next if sp.length == 0 sp.first.strip == key end return result.split(" = ").last rescue => ex return nil if optional # an optional value, we really don't care if something goes wrong UI.error(caller.join("\n\t")) UI.error("Could not fetch #{key} from project file: #{ex}") end nil end |