Skip to content

Commit db0a6f7

Browse files
authored
Merge pull request swiftlang#33691 from nkcsgexi/fix-67951012
swift_build_sdk_interfaces.py: adjust output directory path to an SDK-versioned directory
2 parents 8573c99 + dbd16d2 commit db0a6f7

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

utils/swift_build_sdk_interfaces.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,14 @@ def process_module_files(pool, module_files):
354354
return overall_exit_status
355355

356356

357+
def getSDKVersion(sdkroot):
358+
settingPath = os.path.join(sdkroot, 'SDKSettings.json')
359+
with open(settingPath) as json_file:
360+
data = json.load(json_file)
361+
return data['Version']
362+
fatal("Failed to get SDK version from: " + settingPath)
363+
364+
357365
def main():
358366
global args, shared_output_lock
359367
parser = create_parser()
@@ -373,6 +381,12 @@ def main():
373381
if not os.path.isdir(args.sdk):
374382
fatal("invalid SDK: " + args.sdk)
375383

384+
# if the given output dir ends with 'prebuilt-modules', we should
385+
# append the SDK version number so all modules will built into
386+
# the SDK-versioned sub-directory.
387+
if os.path.basename(args.output_dir) == 'prebuilt-modules':
388+
args.output_dir = os.path.join(args.output_dir, getSDKVersion(args.sdk))
389+
376390
xfails = ()
377391
if args.ignore_non_stdlib_failures:
378392
if args.xfails:

0 commit comments

Comments
 (0)