Skip to content

Commit d5813df

Browse files
committed
Make the bootstrap script conditionally enable code coverage in a generated Xcode project based on whether llvm-profdata exists next to the swiftc that's being used (that is also the swiftc that's set as the SWIFT_EXEC in the generated scheme so this should always match).
1 parent 04f9449 commit d5813df

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Utilities/bootstrap

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,18 @@ def main():
947947

948948
# If generating an Xcode project, also use the build product to do that.
949949
if args.generate_xcodeproj:
950+
# We will use the `swift-package` binary we just built to generate the
951+
# Xcode project.
950952
cmd = [swift_package_path, "generate-xcodeproj"]
953+
954+
# If there is a `llvm-profdata` binary next to `swiftc`, we enable code
955+
# coverage in the generated project.
956+
llvm_profdata_path = os.path.join(os.path.dirname(args.swiftc_path),
957+
"llvm-profdata")
958+
if os.path.exists(llvm_profdata_path):
959+
cmd.append("--enable-code-coverage")
960+
961+
# Call `swift-package` to generate the Xcode project.
951962
result = subprocess.call(cmd)
952963
if result != 0:
953964
error("xcodeproj generation failed with exit status %d" % (result,))

0 commit comments

Comments
 (0)