Skip to content

Commit fca6fa4

Browse files
authored
Merge pull request swiftlang#26846 from nkcsgexi/platform-alis-abi-checker
swift-api-checker.py: allow users to specify json file names when dumping framework content
2 parents c501131 + cdd4eed commit fca6fa4

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

utils/api_checker/swift-api-checker.py

Lines changed: 15 additions & 6 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,12 +110,11 @@ 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/'])
116-
self.frameworks = [
117-
self.sdk + '/System/Library/Frameworks/',
118-
os.path.realpath(self.sdk + '/../../Library/Frameworks/')]
117+
self.frameworks = []
119118
if self.platform.startswith('iosmac'):
120119
# Catalyst modules need this extra framework dir
121120
iOSSupport = self.sdk + \
@@ -156,7 +155,8 @@ def run(self, output, module, swift_ver, opts, verbose,
156155
continue
157156
dir_path = os.path.realpath(output + '/' + module)
158157
file_path = os.path.realpath(dir_path + '/' +
159-
self.platform + '.json')
158+
self.platform_alias +
159+
'.json')
160160
create_directory(dir_path)
161161
current_cmd = list(cmd)
162162
current_cmd.extend(['-module', module])
@@ -245,6 +245,12 @@ def main():
245245
action='store_true',
246246
help='When importing entire SDK, dump content '
247247
'seprately by module names')
248+
249+
basic_group.add_argument('--platform-alias', default='', help='''
250+
Specify a file name to use if using a platform name in json file isn't
251+
optimal
252+
''')
253+
248254
args = parser.parse_args(sys.argv[1:])
249255

250256
if args.action == 'dump':
@@ -263,7 +269,10 @@ def main():
263269
include_fixed_clang_modules = False
264270
else:
265271
fatal_error("cannot recognize --module-filter")
266-
runner = DumpConfig(tool_path=args.tool_path, platform=args.target)
272+
if args.platform_alias == '':
273+
args.platform_alias = args.target
274+
runner = DumpConfig(tool_path=args.tool_path, platform=args.target,
275+
platform_alias=args.platform_alias)
267276
runner.run(output=args.output, module=args.module,
268277
swift_ver=args.swift_version, opts=args.opts,
269278
verbose=args.v,

0 commit comments

Comments
 (0)