Chromium Code Reviews| 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') | |
|
Nico
2016/03/08 19:41:36
I suppose this assumes we don't need this with gyp
stgao
2016/03/09 20:09:11
I think so. If the project generator tool is gyp,
| |
| 103 | |
| 104 # Run ninja to check existences of targets. | |
| 105 args = [] | |
| 106 args.extend(['--target-build-dir', self.m.chromium.output_dir]) | |
|
Nico
2016/03/08 19:41:36
nit: replace previous two lines with
args = ['-
stgao
2016/03/09 20:09:11
Done.
| |
| 107 for target in targets: | |
| 108 args.extend(['--target', target]) | |
| 109 args.extend(['--json-output', self.m.json.output()]) | |
| 110 step = self.m.python( | |
| 111 'check_targets', | |
| 112 self.m.path['build'].join( | |
| 113 'scripts', 'slave', 'check_target_existence.py'), | |
| 114 args=args) | |
| 115 return step.json.output['found'] | |
|
Nico
2016/03/08 19:41:36
If you don't need the not_found output, why write
stgao
2016/03/09 20:09:11
Removed.
Original idea is to keep them for complet
| |
| OLD | NEW |