(cpu, is_debug, use_cxx23, extra_gn_args, suffix, out_dir, cwd)
| 45 | |
| 46 | |
| 47 | def _GenerateDefFileBuild(cpu, is_debug, use_cxx23, extra_gn_args, suffix, out_dir, cwd): |
| 48 | if extra_gn_args: |
| 49 | assert suffix != None, 'suffix is needed when extra_gn_args is used' |
| 50 | |
| 51 | flavor = _DebugOrRelease(is_debug) |
| 52 | gn_args = [ |
| 53 | 'ffmpeg_branding = "Chrome"', |
| 54 | 'is_component_build = true', |
| 55 | 'is_debug = {}'.format(str(is_debug).lower()), |
| 56 | 'proprietary_codecs = true', |
| 57 | 'use_cxx23={}'.format(str(use_cxx23).lower()), |
| 58 | 'symbol_level = 0', |
| 59 | 'target_cpu = "{}"'.format(cpu), |
| 60 | 'target_os = "win"', |
| 61 | 'use_remoteexec = true', |
| 62 | ] |
| 63 | gn_args.extend(extra_gn_args) |
| 64 | |
| 65 | gn = 'gn' |
| 66 | autoninja = 'autoninja' |
| 67 | llvm_nm = ['third_party/llvm-build/Release+Asserts/bin/llvm-nm'] |
| 68 | if sys.platform == 'win32': |
| 69 | gn = 'gn.bat' |
| 70 | autoninja = 'autoninja.bat' |
| 71 | llvm_nm += '.exe' |
| 72 | |
| 73 | logging.info('[%s - %s] Creating tmp out dir in %s', cpu, flavor, out_dir) |
| 74 | subprocess.check_call([gn, 'gen', out_dir, '--args=' + ' '.join(gn_args)], |
| 75 | cwd=cwd) |
| 76 | logging.info('[%s - %s] gn gen completed', cpu, flavor) |
| 77 | subprocess.check_call( |
| 78 | [autoninja, '-C', out_dir, 'third_party/abseil-cpp:absl_component_deps'], |
| 79 | cwd=os.getcwd()) |
| 80 | logging.info('[%s - %s] autoninja completed', cpu, flavor) |
| 81 | |
| 82 | obj_files = [] |
| 83 | for root, _dirnames, filenames in os.walk( |
| 84 | os.path.join(out_dir, 'obj', 'third_party', 'abseil-cpp')): |
| 85 | matched_files = fnmatch.filter(filenames, '*.obj') |
| 86 | obj_files.extend((os.path.join(root, f) for f in matched_files)) |
| 87 | |
| 88 | logging.info('[%s - %s] Found %d object files.', cpu, flavor, len(obj_files)) |
| 89 | |
| 90 | absl_symbols = set() |
| 91 | for f in obj_files: |
| 92 | stdout = subprocess.check_output(llvm_nm + [f], cwd=os.getcwd()) |
| 93 | for line in stdout.splitlines(): |
| 94 | line = line.decode('utf-8') |
| 95 | match = re.match(ABSL_SYM_RE, line) |
| 96 | if match: |
| 97 | symbol = match.group('symbol') |
| 98 | assert symbol.count(' ') == 0, ('Regex matched too much, probably got ' |
| 99 | 'undecorated name as well') |
| 100 | # Avoid to export deleting dtors since they trigger |
| 101 | # "lld-link: error: export of deleting dtor" linker errors, see |
| 102 | # crbug.com/1201277. |
| 103 | if symbol.startswith('??_G'): |
| 104 | continue |
no test coverage detected