Class: Fastlane::Actions::XcodeInstallAction
Constant Summary
Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES
Class Method Summary
collapse
action_name, author, deprecated_notes, lane_context, method_missing, other_action, sample_return_value, shell_out_should_use_bundle_exec?, step_text
Class Method Details
.authors ⇒ Object
89
90
91
|
# File 'fastlane/lib/fastlane/actions/xcode_install.rb', line 89
def self.authors
["Krausefx"]
end
|
.available_options ⇒ Object
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'fastlane/lib/fastlane/actions/xcode_install.rb', line 45
def self.available_options
user = CredentialsManager::AppfileConfig.try_fetch_value(:apple_dev_portal_id)
user ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)
[
FastlaneCore::ConfigItem.new(key: :version,
env_name: "FL_XCODE_VERSION",
description: "The version number of the version of Xcode to install"),
FastlaneCore::ConfigItem.new(key: :username,
short_option: "-u",
env_name: "XCODE_INSTALL_USER",
description: "Your Apple ID Username",
default_value: user,
default_value_dynamic: true),
FastlaneCore::ConfigItem.new(key: :team_id,
short_option: "-b",
env_name: "XCODE_INSTALL_TEAM_ID",
description: "The ID of your team if you're in multiple teams",
optional: true,
code_gen_sensitive: true,
default_value: CredentialsManager::AppfileConfig.try_fetch_value(:team_id),
default_value_dynamic: true),
FastlaneCore::ConfigItem.new(key: :download_retry_attempts,
env_name: "XCODE_INSTALL_DOWNLOAD_RETRY_ATTEMPTS",
description: "Number of times the download will be retried in case of failure",
type: Integer,
default_value: 3)
]
end
|
.category ⇒ Object
103
104
105
|
# File 'fastlane/lib/fastlane/actions/xcode_install.rb', line 103
def self.category
:building
end
|
.description ⇒ Object
37
38
39
|
# File 'fastlane/lib/fastlane/actions/xcode_install.rb', line 37
def self.description
"Make sure a certain version of Xcode is installed"
end
|
.details ⇒ Object
41
42
43
|
# File 'fastlane/lib/fastlane/actions/xcode_install.rb', line 41
def self.details
"Makes sure a specific version of Xcode is installed. If that's not the case, it will automatically be downloaded by the [xcode_install](https://github.com/neonichu/xcode-install) gem. This will make sure to use the correct Xcode for later actions."
end
|
.example_code ⇒ Object
97
98
99
100
101
|
# File 'fastlane/lib/fastlane/actions/xcode_install.rb', line 97
def self.example_code
[
'xcode_install(version: "7.1")'
]
end
|
.is_supported?(platform) ⇒ Boolean
93
94
95
|
# File 'fastlane/lib/fastlane/actions/xcode_install.rb', line 93
def self.is_supported?(platform)
[:ios, :mac].include?(platform)
end
|
.output ⇒ Object
75
76
77
78
79
|
# File 'fastlane/lib/fastlane/actions/xcode_install.rb', line 75
def self.output
[
['XCODE_INSTALL_XCODE_PATH', 'The path to the newly installed Xcode']
]
end
|
.return_type ⇒ Object
85
86
87
|
# File 'fastlane/lib/fastlane/actions/xcode_install.rb', line 85
def self.return_type
:string
end
|
.return_value ⇒ Object
81
82
83
|
# File 'fastlane/lib/fastlane/actions/xcode_install.rb', line 81
def self.return_value
"The path to the newly installed Xcode version"
end
|
.run(params) ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'fastlane/lib/fastlane/actions/xcode_install.rb', line 8
def self.run(params)
Actions.verify_gem!('xcode-install')
ENV["XCODE_INSTALL_USER"] = params[:username]
ENV["XCODE_INSTALL_TEAM_ID"] = params[:team_id]
require 'xcode/install'
installer = XcodeInstall::Installer.new
if installer.installed?(params[:version])
UI.success("Xcode #{params[:version]} is already installed ✨")
else
installer.install_version(params[:version], true, true, true, true, nil, true, nil, params[:download_retry_attempts])
end
xcode = installer.installed_versions.find { |x| x.version == params[:version] }
UI.user_error!("Could not find Xcode with version '#{params[:version]}'") unless xcode
UI.message("Using Xcode #{params[:version]} on path '#{xcode.path}'")
xcode.approve_license
ENV["DEVELOPER_DIR"] = File.join(xcode.path, "/Contents/Developer")
Actions.lane_context[SharedValues::XCODE_INSTALL_XCODE_PATH] = xcode.path
return xcode.path
end
|