os/mac/sdk: add SDK source attribute
This commit is contained in:
parent
bd082011c2
commit
bb33a59c7b
@ -5,11 +5,12 @@ require "os/mac/version"
|
|||||||
module OS
|
module OS
|
||||||
module Mac
|
module Mac
|
||||||
class SDK
|
class SDK
|
||||||
attr_reader :version, :path
|
attr_reader :version, :path, :source
|
||||||
|
|
||||||
def initialize(version, path)
|
def initialize(version, path, source)
|
||||||
@version = OS::Mac::Version.new version
|
@version = OS::Mac::Version.new version
|
||||||
@path = Pathname.new(path)
|
@path = Pathname.new(path)
|
||||||
|
@source = source
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -20,14 +21,14 @@ module OS
|
|||||||
path = sdk_paths[v]
|
path = sdk_paths[v]
|
||||||
raise NoSDKError if path.nil?
|
raise NoSDKError if path.nil?
|
||||||
|
|
||||||
SDK.new v, path
|
SDK.new v, path, source
|
||||||
end
|
end
|
||||||
|
|
||||||
def latest_sdk
|
def latest_sdk
|
||||||
return if sdk_paths.empty?
|
return if sdk_paths.empty?
|
||||||
|
|
||||||
v, path = sdk_paths.max { |a, b| OS::Mac::Version.new(a[0]) <=> OS::Mac::Version.new(b[0]) }
|
v, path = sdk_paths.max { |a, b| OS::Mac::Version.new(a[0]) <=> OS::Mac::Version.new(b[0]) }
|
||||||
SDK.new v, path
|
SDK.new v, path, source
|
||||||
end
|
end
|
||||||
|
|
||||||
def sdk_if_applicable(v = nil)
|
def sdk_if_applicable(v = nil)
|
||||||
@ -48,6 +49,10 @@ module OS
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def source
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
def source_version
|
def source_version
|
||||||
OS::Mac::Version::NULL
|
OS::Mac::Version::NULL
|
||||||
end
|
end
|
||||||
@ -78,6 +83,10 @@ module OS
|
|||||||
class XcodeSDKLocator < BaseSDKLocator
|
class XcodeSDKLocator < BaseSDKLocator
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def source
|
||||||
|
:xcode
|
||||||
|
end
|
||||||
|
|
||||||
def source_version
|
def source_version
|
||||||
OS::Mac::Xcode.version
|
OS::Mac::Xcode.version
|
||||||
end
|
end
|
||||||
@ -98,6 +107,10 @@ module OS
|
|||||||
class CLTSDKLocator < BaseSDKLocator
|
class CLTSDKLocator < BaseSDKLocator
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def source
|
||||||
|
:clt
|
||||||
|
end
|
||||||
|
|
||||||
def source_version
|
def source_version
|
||||||
OS::Mac::CLT.version
|
OS::Mac::CLT.version
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user