-
Notifications
You must be signed in to change notification settings - Fork 5.6k
/
xcversion.rb
65 lines (53 loc) 路 2.6 KB
/
xcversion.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
module Fastlane
module Actions
class XcversionAction < Action
def self.run(params)
Actions.verify_gem!('xcode-install')
version = params[:version]
xcode = Helper::XcversionHelper.find_xcode(version)
UI.user_error!("Cannot find an installed Xcode satisfying '#{version}'") if xcode.nil?
UI.verbose("Found Xcode version #{xcode.version} at #{xcode.path} satisfying requirement #{version}")
UI.message("Setting Xcode version to #{xcode.path} for all build steps")
ENV["DEVELOPER_DIR"] = File.join(xcode.path, "/Contents/Developer")
end
def self.description
"Select an Xcode to use by version specifier"
end
def self.details
[
"Finds and selects a version of an installed Xcode that best matches the provided [`Gem::Version` requirement specifier](http://www.rubydoc.info/github/rubygems/rubygems/Gem/Version)",
"You can either manually provide a specific version using `version:` or you make use of the `.xcode-version` file."
].join("\n")
end
def self.authors
["oysta", "rogerluan"]
end
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :version,
env_name: "FL_XCODE_VERSION",
description: "The version of Xcode to select specified as a Gem::Version requirement string (e.g. '~> 7.1.0'). Defaults to the value specified in the .xcode-version file ",
default_value: Helper::XcodesHelper.read_xcode_version_file,
default_value_dynamic: true,
verify_block: Helper::XcodesHelper::Verify.method(:requirement))
]
end
def self.is_supported?(platform)
[:ios, :mac].include?(platform)
end
def self.example_code
[
'xcversion(version: "8.1") # Selects Xcode 8.1.0',
'xcversion(version: "~> 8.1.0") # Selects the latest installed version from the 8.1.x set',
'xcversion # When missing, the version value defaults to the value specified in the .xcode-version file'
]
end
def self.category
:deprecated
end
def self.deprecated_notes
"The xcode-install gem, which this action depends on, has been sunset. Please migrate to [xcodes](https://docs.fastlane.tools/actions/xcodes). You can find a migration guide here: [xcpretty/xcode-install/MIGRATION.md](https://github.com/xcpretty/xcode-install/blob/master/MIGRATION.md)"
end
end
end
end