| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import re | 5 import re |
| 6 | 6 |
| 7 from slave import recipe_api | 7 from slave import recipe_api |
| 8 | 8 |
| 9 class FilterApi(recipe_api.RecipeApi): | 9 class FilterApi(recipe_api.RecipeApi): |
| 10 def __init__(self, **kwargs): | 10 def __init__(self, **kwargs): |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 analyze_input = {'files': paths, 'targets': self._matching_exes} | 71 analyze_input = {'files': paths, 'targets': self._matching_exes} |
| 72 | 72 |
| 73 test_output = {'status': 'No dependency', 'targets': []} | 73 test_output = {'status': 'No dependency', 'targets': []} |
| 74 | 74 |
| 75 kwargs.setdefault('env', {}) | 75 kwargs.setdefault('env', {}) |
| 76 kwargs['env'].update(self.m.chromium.c.gyp_env.as_jsonish()) | 76 kwargs['env'].update(self.m.chromium.c.gyp_env.as_jsonish()) |
| 77 | 77 |
| 78 try: | 78 try: |
| 79 step_result = self.m.python('analyze', | 79 step_result = self.m.python('analyze', |
| 80 self.m.path['checkout'].join('build', 'gyp_chromium'), | 80 self.m.path['checkout'].join('build', 'gyp_chromium'), |
| 81 args=['--analyzer2', | 81 args=['--analyzer', |
| 82 self.m.json.input(analyze_input), | 82 self.m.json.input(analyze_input), |
| 83 self.m.json.output()], | 83 self.m.json.output()], |
| 84 step_test_data=lambda: self.m.json.test_api.output( | 84 step_test_data=lambda: self.m.json.test_api.output( |
| 85 test_output), | 85 test_output), |
| 86 **kwargs) | 86 **kwargs) |
| 87 except self.m.step.StepFailure as f: | 87 except self.m.step.StepFailure as f: |
| 88 # Continue on if there is an error executing python. Most likely runhooks | 88 # Continue on if there is an error executing python. Most likely runhooks |
| 89 # will fail too, but errors there are more well understood than here. | 89 # will fail too, but errors there are more well understood than here. |
| 90 self._result = True | 90 self._result = True |
| 91 step_result = f.result | 91 step_result = f.result |
| 92 step_result.presentation.status = 'WARNING' | 92 step_result.presentation.status = 'WARNING' |
| 93 return | 93 return |
| 94 | 94 |
| 95 if 'error' in step_result.json.output: | 95 if 'error' in step_result.json.output: |
| 96 self._result = True | 96 self._result = True |
| 97 step_result.presentation.step_text = 'Error: ' + \ | 97 step_result.presentation.step_text = 'Error: ' + \ |
| 98 step_result.json.output['error'] | 98 step_result.json.output['error'] |
| 99 elif step_result.json.output['status'] == 'Found dependency': | 99 elif step_result.json.output['status'] == 'Found dependency': |
| 100 self._matching_exes = step_result.json.output['targets'] | 100 self._matching_exes = step_result.json.output['targets'] |
| 101 self._result = True | 101 self._result = True |
| 102 else: | 102 else: |
| 103 step_result.presentation.step_text = 'No compile necessary' | 103 step_result.presentation.step_text = 'No compile necessary' |
| OLD | NEW |