Removed covmap code that hasn't worked since Xcode 7. Following reports that this feature has not worked for Xcode 8, and we are well aware that post_processor has a chance of corrupting binaries, this is absolutely not something we should be keeping in Tulsi. We could look into leveraging LLVM/Clang tooling to address coverage map path remapping, which doesn't seem to work in Swift, but should provide some solutions for (Obj-)C(++) in our projects. PiperOrigin-RevId: 187666858
diff --git a/src/TulsiGenerator/Scripts/bazel_build.py b/src/TulsiGenerator/Scripts/bazel_build.py index c4f4812..6e28663 100755 --- a/src/TulsiGenerator/Scripts/bazel_build.py +++ b/src/TulsiGenerator/Scripts/bazel_build.py
@@ -527,9 +527,6 @@ # Path into which generated artifacts should be copied. self.built_products_dir = os.environ['BUILT_PRODUCTS_DIR'] - # Whether or not code coverage information should be generated. - self.code_coverage_enabled = ( - os.environ.get('CLANG_COVERAGE_MAPPING') == 'YES') # Path where Xcode expects generated sources to be placed. self.derived_sources_folder_path = os.environ.get('DERIVED_SOURCES_DIR') # Full name of the target artifact (e.g., "MyApp.app" or "Test.xctest"). @@ -750,14 +747,6 @@ _PrintXcodeWarning('Updating .lldbinit action failed with code %d' % exit_code) - if self.code_coverage_enabled: - timer = Timer('Patching LLVM covmap', 'patching_llvm_covmap').Start() - exit_code = self._PatchLLVMCovmapPaths() - timer.End() - if exit_code: - _PrintXcodeWarning('Patch LLVM covmap action failed with code %d' % - exit_code) - if self.generate_dsym: # TODO(b/71705491): Find a means where LLDB and associated tooling can # locate the dSYM bundle, accounting for Spotlight latency. @@ -810,12 +799,6 @@ '--override_repository=tulsi=%s' % tulsi_package_dir, '--tool_tag=tulsi:bazel_build']) - if self.code_coverage_enabled: - self._PrintVerbose('Enabling code coverage information.') - bazel_command.extend([ - '--collect_code_coverage', - '--experimental_use_llvm_covmap']) - if self.generate_dsym: bazel_command.append('--apple_generate_dsym') @@ -1498,34 +1481,6 @@ return 0 - def _PatchLLVMCovmapPaths(self): - """Invokes post_processor to fix source paths in LLVM coverage maps.""" - if not os.path.isfile(self.binary_path): - return 0 - - self._PrintVerbose('Patching %r -> %r' % (BAZEL_EXECUTION_ROOT, - self.workspace_root), 1) - args = [ - self.post_processor_binary, - '-c', - ] - if self.verbose > 1: - args.append('-v') - args.extend([ - self.binary_path, - BAZEL_EXECUTION_ROOT, - self.workspace_root - ]) - returncode, output = self._RunSubprocess(args) - if returncode: - _PrintXcodeWarning('Coverage map patching failed on binary %r (%d). Code ' - 'coverage will probably fail.' % - (self.binary_path, returncode)) - _PrintXcodeWarning('Output: %s' % output or '<no output>') - return 0 - - return 0 - def _DWARFdSYMBinaries(self, dsym_bundle_path): """Returns an array of abs paths to DWARF binaries in the dSYM bundle.