Skip to content

Commit d1a033c

Browse files
authored
Merge pull request swiftlang#33796 from nkcsgexi/copy-build-version
swift_build_sdk_interfaces.py: copy SDK build version file into prebuilt module cache directory
2 parents 1d72ec9 + e97a6ff commit d1a033c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

utils/swift_build_sdk_interfaces.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import subprocess
1313
import sys
1414
import traceback
15+
from shutil import copyfile
1516

1617
BARE_INTERFACE_SEARCH_PATHS = [
1718
"usr/lib/swift",
@@ -362,6 +363,16 @@ def getSDKVersion(sdkroot):
362363
fatal("Failed to get SDK version from: " + settingPath)
363364

364365

366+
def copySystemVersionFile(sdkroot, output):
367+
sysInfoPath = os.path.join(sdkroot,
368+
'System/Library/CoreServices/SystemVersion.plist')
369+
destInfoPath = os.path.join(output, 'SystemVersion.plist')
370+
try:
371+
copyfile(sysInfoPath, destInfoPath)
372+
except BaseException as e:
373+
print("cannot copy from " + sysInfoPath + " to " + destInfoPath + ": " + str(e))
374+
375+
365376
def main():
366377
global args, shared_output_lock
367378
parser = create_parser()
@@ -398,6 +409,10 @@ def main():
398409
xfails = json.load(xfails_file)
399410

400411
make_dirs_if_needed(args.output_dir, args.dry_run)
412+
413+
# Copy a file containing SDK build version into the prebuilt module dir,
414+
# so we can keep track of the SDK version we built from.
415+
copySystemVersionFile(args.sdk, args.output_dir)
401416
if 'ANDROID_DATA' not in os.environ:
402417
shared_output_lock = multiprocessing.Lock()
403418
pool = multiprocessing.Pool(args.jobs, set_up_child,

0 commit comments

Comments
 (0)