Skip to content

Commit aba6e27

Browse files
committed
---
yaml --- r: 349605 b: refs/heads/master-next c: ab8bf43 h: refs/heads/master i: 349603: 1b296b2
1 parent ae5c8e3 commit aba6e27

File tree

2 files changed

+38
-25
lines changed

2 files changed

+38
-25
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: 3574c513bbc5578dd9346b4ea9ab5995c5927bb5
3-
refs/heads/master-next: 83bf812d9190f82f073c36d6a8c441df9e9d78ac
3+
refs/heads/master-next: ab8bf4387dfca581046a68acd3f10b99dd5825a3
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea
66
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-b: 66d897bfcf64a82cb9a87f5e663d889189d06d07

branches/master-next/utils/api_checker/swift-api-checker.py

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def create_directory(path):
9797

9898

9999
class DumpConfig:
100-
def __init__(self, tool_path, platform, platform_alias):
100+
def __init__(self, tool_path, platform, platform_alias, verbose):
101101
target_map = {
102102
'iphoneos': 'arm64-apple-ios13.0',
103103
'macosx': 'x86_64-apple-macosx10.15',
@@ -120,30 +120,45 @@ def __init__(self, tool_path, platform, platform_alias):
120120
iOSSupport = self.sdk + \
121121
'/System/iOSSupport/System/Library/Frameworks'
122122
self.frameworks.extend([iOSSupport])
123-
124-
def run(self, output, module, swift_ver, opts, verbose,
123+
self._environ = dict(os.environ)
124+
self._environ['SWIFT_FORCE_MODULE_LOADING'] = 'prefer-interface'
125+
self.verbose = verbose
126+
127+
def dumpZipperedContent(self, cmd, output, module):
128+
dir_path = os.path.realpath(output + '/' + module)
129+
file_path = os.path.realpath(dir_path + '/' + self.platform_alias +
130+
'.json')
131+
create_directory(dir_path)
132+
current_cmd = list(cmd)
133+
current_cmd.extend(['-module', module])
134+
current_cmd.extend(['-o', file_path])
135+
check_call(current_cmd, env=self._environ, verbose=self.verbose)
136+
137+
def run(self, output, module, swift_ver, opts,
125138
module_filter_flags, include_fixed_clang_modules,
126-
separate_by_module):
139+
separate_by_module, zippered):
127140
cmd = [self.tool_path, '-sdk', self.sdk, '-target',
128141
self.target, '-dump-sdk', '-module-cache-path',
129142
'/tmp/ModuleCache', '-swift-version',
130143
swift_ver, '-abort-on-module-fail']
131-
_environ = dict(os.environ)
132-
_environ['SWIFT_FORCE_MODULE_LOADING'] = 'prefer-interface'
133144
for path in self.frameworks:
134145
cmd.extend(['-iframework', path])
135146
for path in self.inputs:
136147
cmd.extend(['-I', path])
137148
cmd.extend(['-' + o for o in opts])
138-
if verbose:
149+
if self.verbose:
139150
cmd.extend(['-v'])
140151
if module:
141-
cmd.extend(['-module', module])
142-
cmd.extend(['-o', output])
143-
check_call(cmd, env=_environ, verbose=verbose)
152+
if zippered:
153+
create_directory(output)
154+
self.dumpZipperedContent(cmd, output, module)
155+
else:
156+
cmd.extend(['-module', module])
157+
cmd.extend(['-o', output])
158+
check_call(cmd, env=self._environ, verbose=self.verbose)
144159
else:
145160
with tempfile.NamedTemporaryFile() as tmp:
146-
prepare_module_list(self.platform, tmp, verbose,
161+
prepare_module_list(self.platform, tmp, self.verbose,
147162
module_filter_flags,
148163
include_fixed_clang_modules)
149164
if separate_by_module:
@@ -153,19 +168,11 @@ def run(self, output, module, swift_ver, opts, verbose,
153168
# Skip comments
154169
if module.startswith('//'):
155170
continue
156-
dir_path = os.path.realpath(output + '/' + module)
157-
file_path = os.path.realpath(dir_path + '/' +
158-
self.platform_alias +
159-
'.json')
160-
create_directory(dir_path)
161-
current_cmd = list(cmd)
162-
current_cmd.extend(['-module', module])
163-
current_cmd.extend(['-o', file_path])
164-
check_call(current_cmd, env=_environ, verbose=verbose)
171+
self.dumpZipperedContent(cmd, output, module)
165172
else:
166173
cmd.extend(['-o', output])
167174
cmd.extend(['-module-list-file', tmp.name])
168-
check_call(cmd, env=_environ, verbose=verbose)
175+
check_call(cmd, env=self._environ, verbose=self.verbose)
169176

170177

171178
class DiagnoseConfig:
@@ -246,6 +253,11 @@ def main():
246253
help='When importing entire SDK, dump content '
247254
'seprately by module names')
248255

256+
basic_group.add_argument('--zippered',
257+
action='store_true',
258+
help='dump module content to a dir with files for'
259+
'seprately targets')
260+
249261
basic_group.add_argument('--platform-alias', default='', help='''
250262
Specify a file name to use if using a platform name in json file isn't
251263
optimal
@@ -272,13 +284,14 @@ def main():
272284
if args.platform_alias == '':
273285
args.platform_alias = args.target
274286
runner = DumpConfig(tool_path=args.tool_path, platform=args.target,
275-
platform_alias=args.platform_alias)
287+
platform_alias=args.platform_alias,
288+
verbose=args.v)
276289
runner.run(output=args.output, module=args.module,
277290
swift_ver=args.swift_version, opts=args.opts,
278-
verbose=args.v,
279291
module_filter_flags=module_filter_flags,
280292
include_fixed_clang_modules=include_fixed_clang_modules,
281-
separate_by_module=args.separate_by_module)
293+
separate_by_module=args.separate_by_module,
294+
zippered=args.zippered)
282295
elif args.action == 'diagnose':
283296
if not args.dump_before:
284297
fatal_error("Need to specify --dump-before")

0 commit comments

Comments
 (0)