Skip to content

Commit bcc078c

Browse files
authored
Merge pull request swiftlang#181 from xedin/sdk-cleanup
Xcode projects should know required SDK version
2 parents c2e83f1 + bdfca86 commit bcc078c

File tree

2 files changed

+4
-58
lines changed

2 files changed

+4
-58
lines changed

project.py

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,11 @@ def test(self, sandbox_profile, stdout=sys.stdout, stderr=sys.stderr,
6868
class XcodeTarget(ProjectTarget):
6969
"""An Xcode workspace scheme."""
7070

71-
def __init__(self, project, target, destination, sdk, build_settings,
71+
def __init__(self, project, target, destination, build_settings,
7272
is_workspace, has_scheme):
7373
self._project = project
7474
self._target = target
7575
self._destination = destination
76-
self._sdk = sdk
7776
self._build_settings = build_settings
7877
self._is_workspace = is_workspace
7978
self._has_scheme = has_scheme
@@ -109,8 +108,7 @@ def get_build_command(self, incremental=False):
109108
target_param, self._target,
110109
'-destination', self._destination]
111110
+ dir_override
112-
+ ['-sdk', self._sdk,
113-
'CODE_SIGN_IDENTITY=',
111+
+ ['CODE_SIGN_IDENTITY=',
114112
'CODE_SIGNING_REQUIRED=NO',
115113
'ENABLE_BITCODE=NO',
116114
'INDEX_ENABLE_DATA_STORE=NO',
@@ -135,7 +133,6 @@ def get_test_command(self, incremental=False):
135133
+ [project_param, self._project,
136134
target_param, self._target,
137135
'-destination', self._destination,
138-
'-sdk', self._sdk,
139136
# TODO: stdlib search code
140137
'SWIFT_LIBRARY_PATH=%s' %
141138
get_stdlib_platform_path(
@@ -168,28 +165,6 @@ def get_stdlib_platform_path(swiftc, destination):
168165
return stdlib_path
169166

170167

171-
def get_sdk_platform_path(destination, stdout=sys.stdout, stderr=sys.stderr):
172-
"""Return the corresponding sdk path for a destination."""
173-
platform_sdk_path = {
174-
'Xcode': 'macosx',
175-
'macOS': 'macosx',
176-
'iOS': 'iphoneos',
177-
'tvOS': 'appletvos',
178-
'watchOS': 'watchos',
179-
}
180-
sdk_dir = None
181-
for platform_key in platform_sdk_path:
182-
if platform_key in destination:
183-
sdk_dir = common.check_execute_output([
184-
'/usr/bin/xcrun',
185-
'-show-sdk-path',
186-
'-sdk', platform_sdk_path[platform_key]
187-
], stdout=stdout, stderr=stderr).strip()
188-
break
189-
assert sdk_dir, 'Unable to find SDK'
190-
return sdk_dir
191-
192-
193168
def clean_swift_package(path, swiftc, sandbox_profile,
194169
stdout=sys.stdout, stderr=sys.stderr):
195170
"""Clean a Swift package manager project."""
@@ -346,8 +321,6 @@ def dispatch(root_path, repo, action, swiftc, swift_version,
346321
XcodeTarget(project_path,
347322
action[match.group(3).lower()],
348323
action['destination'],
349-
get_sdk_platform_path(action['destination'],
350-
stdout=stdout, stderr=stderr),
351324
build_settings,
352325
is_workspace,
353326
has_scheme)

project_future.py

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,12 @@ def test(self, sandbox_profile, stdout=sys.stdout, stderr=sys.stderr,
6969
class XcodeTarget(ProjectTarget):
7070
"""An Xcode workspace scheme."""
7171

72-
def __init__(self, swiftc, project, target, destination, sdk,
72+
def __init__(self, swiftc, project, target, destination,
7373
added_xcodebuild_flags, is_workspace, has_scheme):
7474
self._swiftc = swiftc
7575
self._project = project
7676
self._target = target
7777
self._destination = destination
78-
self._sdk = sdk
7978
self._added_xcodebuild_flags = added_xcodebuild_flags
8079
self._is_workspace = is_workspace
8180
self._has_scheme = has_scheme
@@ -111,8 +110,7 @@ def get_build_command(self, incremental=False):
111110
target_param, self._target,
112111
'-destination', self._destination]
113112
+ dir_override
114-
+ ['-sdk', self._sdk,
115-
'CODE_SIGN_IDENTITY=',
113+
+ ['CODE_SIGN_IDENTITY=',
116114
'CODE_SIGNING_REQUIRED=NO',
117115
'ENABLE_BITCODE=NO',
118116
'INDEX_ENABLE_DATA_STORE=NO',
@@ -133,7 +131,6 @@ def get_test_command(self, incremental=False):
133131
+ [project_param, self._project,
134132
target_param, self._target,
135133
'-destination', self._destination,
136-
'-sdk', self._sdk,
137134
# TODO: stdlib search code
138135
'SWIFT_LIBRARY_PATH=%s' %
139136
get_stdlib_platform_path(
@@ -165,28 +162,6 @@ def get_stdlib_platform_path(swiftc, destination):
165162
return stdlib_path
166163

167164

168-
def get_sdk_platform_path(destination, stdout=sys.stdout, stderr=sys.stderr):
169-
"""Return the corresponding sdk path for a destination."""
170-
platform_sdk_path = {
171-
'Xcode': 'macosx',
172-
'macOS': 'macosx',
173-
'iOS': 'iphoneos',
174-
'tvOS': 'appletvos',
175-
'watchOS': 'watchos',
176-
}
177-
sdk_dir = None
178-
for platform_key in platform_sdk_path:
179-
if platform_key in destination:
180-
sdk_dir = common.check_execute_output([
181-
'/usr/bin/xcrun',
182-
'-show-sdk-path',
183-
'-sdk', platform_sdk_path[platform_key]
184-
], stdout=stdout, stderr=stderr).strip()
185-
break
186-
assert sdk_dir, 'Unable to find SDK'
187-
return sdk_dir
188-
189-
190165
def clean_swift_package(path, swiftc, sandbox_profile,
191166
stdout=sys.stdout, stderr=sys.stderr):
192167
"""Clean a Swift package manager project."""
@@ -349,8 +324,6 @@ def dispatch(root_path, repo, action, swiftc, swift_version,
349324
project_path,
350325
action[match.group(3).lower()],
351326
action['destination'],
352-
get_sdk_platform_path(action['destination'],
353-
stdout=stdout, stderr=stderr),
354327
initial_xcodebuild_flags + added_xcodebuild_flags,
355328
is_workspace,
356329
has_scheme)

0 commit comments

Comments
 (0)