(self, vals)
| 1000 | return self.RelPath(path, self.chromium_src_dir) |
| 1001 | |
| 1002 | def RunGNAnalyze(self, vals): |
| 1003 | # Analyze runs before 'gn gen' now, so we need to run gn gen |
| 1004 | # in order to ensure that we have a build directory. |
| 1005 | ret = self.RunGNGen(vals, compute_grit_inputs_for_analyze=True) |
| 1006 | if ret: |
| 1007 | return ret |
| 1008 | |
| 1009 | build_path = self.args.path[0] |
| 1010 | input_path = self.args.input_path[0] |
| 1011 | gn_input_path = input_path + '.gn' |
| 1012 | output_path = self.args.output_path[0] |
| 1013 | gn_output_path = output_path + '.gn' |
| 1014 | |
| 1015 | inp = self.ReadInputJSON(['files', 'test_targets', |
| 1016 | 'additional_compile_targets']) |
| 1017 | if self.args.verbose: |
| 1018 | self.Print() |
| 1019 | self.Print('analyze input:') |
| 1020 | self.PrintJSON(inp) |
| 1021 | self.Print() |
| 1022 | |
| 1023 | |
| 1024 | # This shouldn't normally happen, but could due to unusual race conditions, |
| 1025 | # like a try job that gets scheduled before a patch lands but runs after |
| 1026 | # the patch has landed. |
| 1027 | if not inp['files']: |
| 1028 | self.Print('Warning: No files modified in patch, bailing out early.') |
| 1029 | self.WriteJSON({ |
| 1030 | 'status': 'No dependency', |
| 1031 | 'compile_targets': [], |
| 1032 | 'test_targets': [], |
| 1033 | }, output_path) |
| 1034 | return 0 |
| 1035 | |
| 1036 | gn_inp = {} |
| 1037 | gn_inp['files'] = ['//' + f for f in inp['files'] if not f.startswith('//')] |
| 1038 | |
| 1039 | isolate_map = self.ReadIsolateMap() |
| 1040 | err, gn_inp['additional_compile_targets'] = self.MapTargetsToLabels( |
| 1041 | isolate_map, inp['additional_compile_targets']) |
| 1042 | if err: |
| 1043 | raise MBErr(err) |
| 1044 | |
| 1045 | err, gn_inp['test_targets'] = self.MapTargetsToLabels( |
| 1046 | isolate_map, inp['test_targets']) |
| 1047 | if err: |
| 1048 | raise MBErr(err) |
| 1049 | labels_to_targets = {} |
| 1050 | for i, label in enumerate(gn_inp['test_targets']): |
| 1051 | labels_to_targets[label] = inp['test_targets'][i] |
| 1052 | |
| 1053 | try: |
| 1054 | self.WriteJSON(gn_inp, gn_input_path) |
| 1055 | cmd = self.GNCmd('analyze', build_path, gn_input_path, gn_output_path) |
| 1056 | ret, output, _ = self.Run(cmd, force_verbose=True) |
| 1057 | if ret: |
| 1058 | if self.args.json_output: |
| 1059 | # write errors to json.output |
no test coverage detected