Returns a map of targets to possible .runtime_deps paths. Each ninja target maps on to a GN label, but depending on the type of the GN target, `gn gen --runtime-deps-list-file` will write the .runtime_deps files into different locations. Unfortunately, in some cases we don't actuall
(self, vals, ninja_targets, isolate_map)
| 827 | self.RemoveFile(path) |
| 828 | |
| 829 | def PossibleRuntimeDepsPaths(self, vals, ninja_targets, isolate_map): |
| 830 | """Returns a map of targets to possible .runtime_deps paths. |
| 831 | |
| 832 | Each ninja target maps on to a GN label, but depending on the type |
| 833 | of the GN target, `gn gen --runtime-deps-list-file` will write |
| 834 | the .runtime_deps files into different locations. Unfortunately, in |
| 835 | some cases we don't actually know which of multiple locations will |
| 836 | actually be used, so we return all plausible candidates. |
| 837 | |
| 838 | The paths that are returned are relative to the build directory. |
| 839 | """ |
| 840 | |
| 841 | android = 'target_os="android"' in vals['gn_args'] |
| 842 | ios = 'target_os="ios"' in vals['gn_args'] |
| 843 | fuchsia = 'target_os="fuchsia"' in vals['gn_args'] |
| 844 | win = self.platform == 'win32' or 'target_os="win"' in vals['gn_args'] |
| 845 | possible_runtime_deps_rpaths = {} |
| 846 | for target in ninja_targets: |
| 847 | target_type = isolate_map[target]['type'] |
| 848 | label = isolate_map[target]['label'] |
| 849 | target_runtime_deps = 'obj/%s.runtime_deps' % label.replace(':', '/') |
| 850 | stamp_runtime_deps = 'obj/%s.stamp.runtime_deps' % label.replace(':', '/') |
| 851 | # TODO(crbug.com/40590196): 'official_tests' use |
| 852 | # type='additional_compile_target' to isolate tests. This is not the |
| 853 | # intended use for 'additional_compile_target'. |
| 854 | if (target_type == 'additional_compile_target' and |
| 855 | target != 'official_tests'): |
| 856 | # By definition, additional_compile_targets are not tests, so we |
| 857 | # shouldn't generate isolates for them. |
| 858 | raise MBErr('Cannot generate isolate for %s since it is an ' |
| 859 | 'additional_compile_target.' % target) |
| 860 | if fuchsia or ios or target_type == 'generated_script': |
| 861 | # iOS and Fuchsia targets end up as groups. |
| 862 | # generated_script targets are always actions. |
| 863 | rpaths = [stamp_runtime_deps, target_runtime_deps] |
| 864 | elif android: |
| 865 | # Android targets may be either android_apk or executable. The former |
| 866 | # will result in runtime_deps associated with the stamp file, while the |
| 867 | # latter will result in runtime_deps associated with the executable. |
| 868 | label = isolate_map[target]['label'] |
| 869 | rpaths = [ |
| 870 | target + '.runtime_deps', stamp_runtime_deps, target_runtime_deps |
| 871 | ] |
| 872 | elif (target_type == 'script' or |
| 873 | isolate_map[target].get('label_type') == 'group'): |
| 874 | # For script targets, the build target is usually a group, |
| 875 | # for which gn generates the runtime_deps next to the stamp file |
| 876 | # for the label, which lives under the obj/ directory, but it may |
| 877 | # also be an executable. |
| 878 | label = isolate_map[target]['label'] |
| 879 | rpaths = [stamp_runtime_deps, target_runtime_deps] |
| 880 | if win: |
| 881 | rpaths += [target + '.exe.runtime_deps'] |
| 882 | else: |
| 883 | rpaths += [target + '.runtime_deps'] |
| 884 | elif win: |
| 885 | rpaths = [target + '.exe.runtime_deps'] |
| 886 | else: |
no test coverage detected