| OLD | NEW |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 from recipe_engine import recipe_api | 5 from recipe_engine import recipe_api |
| 6 | 6 |
| 7 | 7 |
| 8 class FinditApi(recipe_api.RecipeApi): | 8 class FinditApi(recipe_api.RecipeApi): |
| 9 | 9 |
| 10 def _calculate_repo_dir(self, solution_name): | 10 def _calculate_repo_dir(self, solution_name): |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 stdout=self.m.raw_io.output(), | 71 stdout=self.m.raw_io.output(), |
| 72 cwd=cwd, | 72 cwd=cwd, |
| 73 step_test_data=lambda: | 73 step_test_data=lambda: |
| 74 self.m.raw_io.test_api.stream_output('r1')) | 74 self.m.raw_io.test_api.stream_output('r1')) |
| 75 | 75 |
| 76 revisions = step_result.stdout.split() | 76 revisions = step_result.stdout.split() |
| 77 revisions.reverse() | 77 revisions.reverse() |
| 78 | 78 |
| 79 step_result.presentation.logs['revisions'] = revisions | 79 step_result.presentation.logs['revisions'] = revisions |
| 80 return revisions | 80 return revisions |
| 81 |
| 82 def existing_targets(self, targets, mb_mastername, mb_buildername): |
| 83 """Returns a sublist of the given targets that exist in the build graph. |
| 84 |
| 85 We test whether a target exists or not by ninja. |
| 86 |
| 87 A "target" here is actually a node in ninja's build graph. For example: |
| 88 1. An executable target like browser_tests |
| 89 2. An object file like obj/path/to/Source.o |
| 90 3. An action like build/linux:gio_loader |
| 91 4. An generated header file like gen/library_loaders/libgio.h |
| 92 5. and so on |
| 93 |
| 94 Args: |
| 95 targets (list): A list of targets to be tested for existence. |
| 96 mb_mastername (str): The mastername to run MB with. |
| 97 mb_buildername (str): The buildername to run MB with. |
| 98 """ |
| 99 # Run mb to generate or update ninja build files. |
| 100 if self.m.chromium.c.project_generator.tool == 'mb': |
| 101 self.m.chromium.run_mb(mb_mastername, mb_buildername, |
| 102 name='generate_build_files') |
| 103 |
| 104 # Run ninja to check existences of targets. |
| 105 args = ['--target-build-dir', self.m.chromium.output_dir] |
| 106 for target in targets: |
| 107 args.extend(['--target', target]) |
| 108 args.extend(['--json-output', self.m.json.output()]) |
| 109 step = self.m.python( |
| 110 'check_targets', self.resource('check_target_existence.py'), args=args) |
| 111 return step.json.output['found'] |
| OLD | NEW |