Skip to content

Commit 6a77828

Browse files
committed
Merge remote-tracking branch 'origin/master' into master-rebranch
2 parents 65a70fe + 0a67fd5 commit 6a77828

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

utils/api_checker/swift-api-checker.py

Lines changed: 18 additions & 3 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, verbose):
100+
def __init__(self, tool_path, platform, platform_alias, abi, verbose):
101101
target_map = {
102102
'iphoneos': 'arm64-apple-ios13.0',
103103
'macosx': 'x86_64-apple-macosx10.15',
@@ -111,6 +111,7 @@ def __init__(self, tool_path, platform, platform_alias, verbose):
111111
self.sdk = get_sdk_path(platform)
112112
self.inputs = []
113113
self.platform_alias = platform_alias
114+
self.abi = abi
114115
if self.platform == 'macosx':
115116
# We need this input search path for CreateML
116117
self.inputs.extend([self.sdk + '/usr/lib/swift/'])
@@ -126,6 +127,10 @@ def __init__(self, tool_path, platform, platform_alias, verbose):
126127

127128
def dumpZipperedContent(self, cmd, output, module):
128129
dir_path = os.path.realpath(output + '/' + module)
130+
if self.abi:
131+
dir_path = os.path.join(dir_path, 'ABI')
132+
else:
133+
dir_path = os.path.join(dir_path, 'API')
129134
file_path = os.path.realpath(dir_path + '/' + self.platform_alias +
130135
'.json')
131136
create_directory(dir_path)
@@ -145,6 +150,8 @@ def run(self, output, module, swift_ver, opts,
145150
cmd.extend(['-iframework', path])
146151
for path in self.inputs:
147152
cmd.extend(['-I', path])
153+
if self.abi:
154+
cmd.extend(['-abi'])
148155
cmd.extend(['-' + o for o in opts])
149156
if self.verbose:
150157
cmd.extend(['-v'])
@@ -176,14 +183,17 @@ def run(self, output, module, swift_ver, opts,
176183

177184

178185
class DiagnoseConfig:
179-
def __init__(self, tool_path):
186+
def __init__(self, tool_path, abi):
180187
self.tool_path = get_api_digester_path(tool_path)
188+
self.abi = abi
181189

182190
def run(self, opts, before, after, output, verbose):
183191
cmd = [self.tool_path, '-diagnose-sdk', '-input-paths', before,
184192
'-input-paths', after, '-print-module']
185193
if output:
186194
cmd.extend(['-o', output])
195+
if self.abi:
196+
cmd.extend(['-abi'])
187197
cmd.extend(['-' + o for o in opts])
188198
if verbose:
189199
cmd.extend(['-v'])
@@ -258,6 +268,10 @@ def main():
258268
help='dump module content to a dir with files for'
259269
'seprately targets')
260270

271+
basic_group.add_argument('--abi',
272+
action='store_true',
273+
help='Process verbosely')
274+
261275
basic_group.add_argument('--platform-alias', default='', help='''
262276
Specify a file name to use if using a platform name in json file isn't
263277
optimal
@@ -285,6 +299,7 @@ def main():
285299
args.platform_alias = args.target
286300
runner = DumpConfig(tool_path=args.tool_path, platform=args.target,
287301
platform_alias=args.platform_alias,
302+
abi=args.abi,
288303
verbose=args.v)
289304
runner.run(output=args.output, module=args.module,
290305
swift_ver=args.swift_version, opts=args.opts,
@@ -297,7 +312,7 @@ def main():
297312
fatal_error("Need to specify --dump-before")
298313
if not args.dump_after:
299314
fatal_error("Need to specify --dump-after")
300-
runner = DiagnoseConfig(tool_path=args.tool_path)
315+
runner = DiagnoseConfig(tool_path=args.tool_path, abi=args.abi)
301316
runner.run(opts=args.opts, before=args.dump_before,
302317
after=args.dump_after, output=args.output, verbose=args.v)
303318
else:

0 commit comments

Comments
 (0)