Skip to content

Instantly share code, notes, and snippets.

@grigorye
Last active January 10, 2022 12:37
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grigorye/f6dfaa9f7bd9dbb192fe25a6cdb419d4 to your computer and use it in GitHub Desktop.
Save grigorye/f6dfaa9f7bd9dbb192fe25a6cdb419d4 to your computer and use it in GitHub Desktop.
Disable coverage for cocoapods (incl. Swift)
# Append the block below to your Podfile
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |configuration|
configuration.build_settings['CLANG_ENABLE_CODE_COVERAGE'] = 'NO'
configuration.build_settings['SWIFT_EXEC'] = '$(SRCROOT)/SWIFT_EXEC-no-coverage'
end
end
end
#! /usr/bin/perl -w
use strict;
use Getopt::Long qw(:config pass_through);
my $profile_coverage_mapping;
GetOptions("profile-coverage-mapping" => \$profile_coverage_mapping);
# At this point @ARGV will have the above options filtered out.
exec(
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc",
@ARGV);
@ppamorim
Copy link

ppamorim commented Jan 9, 2022

I am getting the error Unexpected error in driver invocation: invalid driver name: SWIFT_EXEC-no-coverage on Xcode 13.2.1.

@grigorye
Copy link
Author

grigorye commented Jan 9, 2022

@ppamorim Try renaming "SWIFT_EXEC-no-coverage" to "swiftc" (and adjust the value in Podfile). There seems to be an extra check in the current compiler: https://github.com/apple/swift-driver/blob/16111276386b8bad5e713e72d0f1c08130558171/Sources/SwiftDriver/Driver/Driver.swift#L1105

@ppamorim
Copy link

@grigorye
Copy link
Author

Does it (renaming) work/help at all? If not, I feel a bit hesitant to add it to Stackoverflow...

@ppamorim
Copy link

Yes it does work.

@grigorye
Copy link
Author

👍 (Replied on Stackoverflow)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment