Skip to content

Commit

Permalink
Additional fixes for watchOS support.
Browse files Browse the repository at this point in the history
  • Loading branch information
neonichu committed Jun 24, 2015
1 parent f30b8c8 commit a8487bf
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
8 changes: 4 additions & 4 deletions lib/xcodeproj/project/object/native_target.rb
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ def sdk_version
# platform.
#
def deployment_target
if platform_name == :ios
common_resolved_build_setting('IPHONEOS_DEPLOYMENT_TARGET')
else
common_resolved_build_setting('MACOSX_DEPLOYMENT_TARGET')
case platform_name
when :ios then common_resolved_build_setting('IPHONEOS_DEPLOYMENT_TARGET')
when :osx then common_resolved_build_setting('MACOSX_DEPLOYMENT_TARGET')
when :watchos then common_resolved_build_setting('WATCHOS_DEPLOYMENT_TARGET')
end
end

Expand Down
8 changes: 4 additions & 4 deletions lib/xcodeproj/project/project_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,10 @@ def self.common_build_settings(type, platform = nil, deployment_target = nil, ta
end

if deployment_target
if platform == :ios
settings['IPHONEOS_DEPLOYMENT_TARGET'] = deployment_target
elsif platform == :osx
settings['MACOSX_DEPLOYMENT_TARGET'] = deployment_target
case platform
when :ios then settings['IPHONEOS_DEPLOYMENT_TARGET'] = deployment_target
when :osx then settings['MACOSX_DEPLOYMENT_TARGET'] = deployment_target
when :watchos then settings['WATCHOS_DEPLOYMENT_TARGET'] = deployment_target
end
end

Expand Down
11 changes: 10 additions & 1 deletion lib/xcodeproj/xcodebuild_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ def last_osx_sdk
verions_by_sdk[:osx].sort.last
end

# @return [String] The version of the last watchOS sdk.
#
def last_watchos_sdk
parse_sdks_if_needed
verions_by_sdk[:watchos].sort.last
end

private

# !@group Private Helpers
Expand All @@ -38,12 +45,14 @@ def parse_sdks_if_needed
@verions_by_sdk = {}
@verions_by_sdk[:osx] = []
@verions_by_sdk[:ios] = []
@verions_by_sdk[:watchos] = []
if xcodebuild_available?
skds = parse_sdks_information(xcodebuild_sdks)
skds.each do |(name, version)|
case
when name == 'macosx' then @verions_by_sdk[:osx] << version
when name == 'iphoneos' then @verions_by_sdk[:ios] << version
when name == 'watchos' then @verions_by_sdk[:watchos] << version
end
end
end
Expand All @@ -64,7 +73,7 @@ def xcodebuild_available?
# is the name of the SDK and the second is the version.
#
def parse_sdks_information(output)
output.scan(/-sdk (macosx|iphoneos)(.+\w)/)
output.scan(/-sdk (macosx|iphoneos|watchos)(.+\w)/)
end

# @return [String] The sdk information reported by xcodebuild.
Expand Down

0 comments on commit a8487bf

Please sign in to comment.