Class: Fastlane::Actions::XcodeSelectAction

Inherits:
Fastlane::Action show all
Defined in:
fastlane/lib/fastlane/actions/xcode_select.rb

Overview

See: developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcode-select.1.html

DESCRIPTION

xcode-select controls the location of the developer directory used by xcrun(1), xcodebuild(1), cc(1),
and other Xcode and BSD development tools. This also controls the locations that are searched for  by
man(1) for developer tool manpages.

DEVELOPER_DIR

Overrides the active developer directory. When DEVELOPER_DIR  is  set,  its  value  will  be  used
instead of the system-wide active developer directory.

Note that for historical reason, the developer directory is considered to be the Developer content
directory inside the Xcode application (for  example  /Applications/Xcode.app/Contents/Developer).
You  can  set  the  environment variable to either the actual Developer contents directory, or the
Xcode application directory -- the xcode-select provided  shims  will  automatically  convert  the
environment variable into the full Developer content path.

Constant Summary

Constants inherited from Fastlane::Action

Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, authors, available_options, deprecated_notes, lane_context, method_missing, other_action, output, return_type, return_value, sample_return_value, shell_out_should_use_bundle_exec?, step_text

Class Method Details

.authorObject



49
50
51
# File 'fastlane/lib/fastlane/actions/xcode_select.rb', line 49

def self.author
  "dtrenz"
end

.categoryObject



63
64
65
# File 'fastlane/lib/fastlane/actions/xcode_select.rb', line 63

def self.category
  :building
end

.descriptionObject



36
37
38
# File 'fastlane/lib/fastlane/actions/xcode_select.rb', line 36

def self.description
  "Change the xcode-path to use. Useful for beta versions of Xcode"
end

.detailsObject



40
41
42
43
44
45
46
47
# File 'fastlane/lib/fastlane/actions/xcode_select.rb', line 40

def self.details
  [
    "Select and build with the Xcode installed at the provided path.",
    "Use the `xcodes` action if you want to select an Xcode:",
    "- Based on a version specifier or",
    "- You don't have known, stable paths, as may happen in a CI environment."
  ].join("\n")
end

.example_codeObject



57
58
59
60
61
# File 'fastlane/lib/fastlane/actions/xcode_select.rb', line 57

def self.example_code
  [
    'xcode_select("/Applications/Xcode-8.3.2.app")'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:



53
54
55
# File 'fastlane/lib/fastlane/actions/xcode_select.rb', line 53

def self.is_supported?(platform)
  [:ios, :mac].include?(platform)
end

.run(params) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'fastlane/lib/fastlane/actions/xcode_select.rb', line 21

def self.run(params)
  params = nil unless params.kind_of?(Array)
  xcode_path = (params || []).first

  # Verify that a param was passed in
  UI.user_error!("Path to Xcode application required (e.g. `xcode_select(\"/Applications/Xcode.app\")`)") unless xcode_path.to_s.length > 0

  # Verify that a path to a directory was passed in
  UI.user_error!("Path '#{xcode_path}' doesn't exist") unless Dir.exist?(xcode_path)

  UI.message("Setting Xcode version to #{xcode_path} for all build steps")

  ENV["DEVELOPER_DIR"] = File.join(xcode_path, "/Contents/Developer")
end