mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
swift_build_sdk_interfaces.py: adjust output directory path to an SDK-versioned directory
When clients specify an output directory without SDK version, the script will change the input so we emit all prebuilt module caches into SDK-versioned directories without modifying the client side. rdar://67951012
This commit is contained in:
@@ -354,6 +354,14 @@ def process_module_files(pool, module_files):
|
||||
return overall_exit_status
|
||||
|
||||
|
||||
def getSDKVersion(sdkroot):
|
||||
settingPath = os.path.join(sdkroot, 'SDKSettings.json')
|
||||
with open(settingPath) as json_file:
|
||||
data = json.load(json_file)
|
||||
return data['Version']
|
||||
fatal("Failed to get SDK version from: " + settingPath)
|
||||
|
||||
|
||||
def main():
|
||||
global args, shared_output_lock
|
||||
parser = create_parser()
|
||||
@@ -373,6 +381,12 @@ def main():
|
||||
if not os.path.isdir(args.sdk):
|
||||
fatal("invalid SDK: " + args.sdk)
|
||||
|
||||
# if the given output dir ends with 'prebuilt-modules', we should
|
||||
# append the SDK version number so all modules will built into
|
||||
# the SDK-versioned sub-directory.
|
||||
if os.path.basename(args.output_dir) == 'prebuilt-modules':
|
||||
args.output_dir = os.path.join(args.output_dir, getSDKVersion(args.sdk))
|
||||
|
||||
xfails = ()
|
||||
if args.ignore_non_stdlib_failures:
|
||||
if args.xfails:
|
||||
|
||||
Reference in New Issue
Block a user