Chromium Code Reviews| Index: scripts/slave/recipe_modules/findit/api.py |
| diff --git a/scripts/slave/recipe_modules/findit/api.py b/scripts/slave/recipe_modules/findit/api.py |
| index 24db0173609f40c186763dbf5480a66b7dc45d4d..90cefaf2814f17a74ded3ae14429f306204b0621 100644 |
| --- a/scripts/slave/recipe_modules/findit/api.py |
| +++ b/scripts/slave/recipe_modules/findit/api.py |
| @@ -78,3 +78,38 @@ class FinditApi(recipe_api.RecipeApi): |
| step_result.presentation.logs['revisions'] = revisions |
| return revisions |
| + |
| + def existing_targets(self, targets, mb_mastername, mb_buildername): |
| + """Returns a sublist of the given targets that exist in the build graph. |
| + |
| + We test whether a target exists or not by ninja. |
| + |
| + A "target" here is actually a node in ninja's build graph. For example: |
| + 1. An executable target like browser_tests |
| + 2. An object file like obj/path/to/Source.o |
| + 3. An action like build/linux:gio_loader |
| + 4. An generated header file like gen/library_loaders/libgio.h |
| + 5. and so on |
| + |
| + Args: |
| + targets (list): A list of targets to be tested for existence. |
| + mb_mastername (str): The mastername to run MB with. |
| + mb_buildername (str): The buildername to run MB with. |
| + """ |
| + # Run mb to generate or update ninja build files. |
| + if self.m.chromium.c.project_generator.tool == 'mb': |
| + self.m.chromium.run_mb(mb_mastername, mb_buildername, |
| + 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,
|
| + |
| + # Run ninja to check existences of targets. |
| + args = [] |
| + 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.
|
| + for target in targets: |
| + args.extend(['--target', target]) |
| + args.extend(['--json-output', self.m.json.output()]) |
| + step = self.m.python( |
| + 'check_targets', |
| + self.m.path['build'].join( |
| + 'scripts', 'slave', 'check_target_existence.py'), |
| + args=args) |
| + 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
|