Skip to content

Commit ace1214

Browse files
authored
[bootstrap] Use separate module cache for builds (#3061)
This will ensure that multiple build jobs running in parallel on the same machine using different Swift compilers (like it could be the case in CI) do not interfere with each other. Addresses rdar://71487295
1 parent e887924 commit ace1214

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Utilities/bootstrap

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,9 @@ def build_with_cmake(args, cmake_args, source_path, build_dir, targets=[]):
449449
if args.sysroot:
450450
swift_flags = "-sdk %s" % args.sysroot
451451

452+
# Ensure we are not sharing the module cache with concurrent builds in CI
453+
swift_flags += ' -module-cache-path "{}"'.format(os.path.join(build_dir, 'module-cache'))
454+
452455
cmd = [
453456
args.cmake_path, "-G", "Ninja",
454457
"-DCMAKE_MAKE_PROGRAM=%s" % args.ninja_path,
@@ -775,6 +778,11 @@ def get_swiftpm_flags(args):
775778
elif cross_compile_hosts:
776779
error("cannot cross-compile for %s" % cross_compile_hosts)
777780

781+
# Ensure we are not sharing the module cache with concurrent builds in CI
782+
local_module_cache_path=os.path.join(args.build_dir, "module-cache")
783+
for modifier in ["-Xswiftc", "-Xmanifest"]:
784+
build_flags.extend([modifier, "-module-cache-path", modifier, local_module_cache_path])
785+
778786
return build_flags
779787

780788
if __name__ == '__main__':

0 commit comments

Comments
 (0)