Skip to content

Commit eab0c55

Browse files
committed
swift-api-checker.py: allow users to specify json file names when dumping framework content
1 parent b111ea4 commit eab0c55

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

utils/api_checker/swift-api-checker.py

Lines changed: 14 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):
100+
def __init__(self, tool_path, platform, platform_alias):
101101
target_map = {
102102
'iphoneos': 'arm64-apple-ios13.0',
103103
'macosx': 'x86_64-apple-macosx10.15',
@@ -110,6 +110,7 @@ def __init__(self, tool_path, platform):
110110
self.target = target_map[platform]
111111
self.sdk = get_sdk_path(platform)
112112
self.inputs = []
113+
self.platform_alias = platform_alias
113114
if self.platform == 'macosx':
114115
# We need this input search path for CreateML
115116
self.inputs.extend([self.sdk + '/usr/lib/swift/'])
@@ -156,7 +157,8 @@ def run(self, output, module, swift_ver, opts, verbose,
156157
continue
157158
dir_path = os.path.realpath(output + '/' + module)
158159
file_path = os.path.realpath(dir_path + '/' +
159-
self.platform + '.json')
160+
self.platform_alias +
161+
'.json')
160162
create_directory(dir_path)
161163
current_cmd = list(cmd)
162164
current_cmd.extend(['-module', module])
@@ -245,6 +247,12 @@ def main():
245247
action='store_true',
246248
help='When importing entire SDK, dump content '
247249
'seprately by module names')
250+
251+
basic_group.add_argument('--platform-alias', default='', help='''
252+
Specify a file name to use if using a platform name in json file isn't
253+
optimal
254+
''')
255+
248256
args = parser.parse_args(sys.argv[1:])
249257

250258
if args.action == 'dump':
@@ -263,7 +271,10 @@ def main():
263271
include_fixed_clang_modules = False
264272
else:
265273
fatal_error("cannot recognize --module-filter")
266-
runner = DumpConfig(tool_path=args.tool_path, platform=args.target)
274+
if args.platform_alias == '':
275+
args.platform_alias = args.target
276+
runner = DumpConfig(tool_path=args.tool_path, platform=args.target,
277+
platform_alias=args.platform_alias)
267278
runner.run(output=args.output, module=args.module,
268279
swift_ver=args.swift_version, opts=args.opts,
269280
verbose=args.v,

0 commit comments

Comments
 (0)