| OLD | NEW |
| 1 # Copyright (c) 2014 Google Inc. All rights reserved. | 1 # Copyright (c) 2014 Google Inc. 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 """ | 5 """ |
| 6 This script is intended for use as a GYP_GENERATOR. It takes as input (by way of | 6 This script is intended for use as a GYP_GENERATOR. It takes as input (by way of |
| 7 the generator flag config_path) the path of a json file that dictates the files | 7 the generator flag config_path) the path of a json file that dictates the files |
| 8 and targets to search for. The following keys are supported: | 8 and targets to search for. The following keys are supported: |
| 9 files: list of paths (relative) of the files to search for. | 9 files: list of paths (relative) of the files to search for. |
| 10 test_targets: unqualified target names to search for. Any target in this list | 10 test_targets: unqualified target names to search for. Any target in this list |
| 11 that depends upon a file in |files| is output regardless of the type of target | 11 that depends upon a file in |files| is output regardless of the type of target |
| 12 or chain of dependencies. | 12 or chain of dependencies. |
| 13 additional_compile_targets: Unqualified targets to search for in addition to | 13 additional_compile_targets: Unqualified targets to search for in addition to |
| 14 test_targets. Targets in the combined list that depend upon a file in |files| | 14 test_targets. Targets in the combined list that depend upon a file in |files| |
| 15 are not necessarily output. For example, if the target is of type none then the | 15 are not necessarily output. For example, if the target is of type none then the |
| 16 target is not output (but one of the descendants of the target will be). | 16 target is not output (but one of the descendants of the target will be). |
| 17 | 17 |
| 18 The following is output: | 18 The following is output: |
| 19 error: only supplied if there is an error. | 19 error: only supplied if there is an error. |
| 20 compile_targets: minimal set of targets that directly or indirectly (for | 20 compile_targets: minimal set of targets that directly or indirectly (for |
| 21 targets of type none) depend on the files in |files| and is one of the | 21 targets of type none) depend on the files in |files| and is one of the |
| 22 supplied targets or a target that one of the supplied targets depends on. | 22 supplied targets or a target that one of the supplied targets depends on. |
| 23 The expectation is this set of targets is passed into a build step. | 23 The expectation is this set of targets is passed into a build step. This list |
| 24 always contains the output of test_targets as well. |
| 24 test_targets: set of targets from the supplied |test_targets| that either | 25 test_targets: set of targets from the supplied |test_targets| that either |
| 25 directly or indirectly depend upon a file in |files|. This list if useful | 26 directly or indirectly depend upon a file in |files|. This list if useful |
| 26 if additional processing needs to be done for certain targets after the | 27 if additional processing needs to be done for certain targets after the |
| 27 build, such as running tests. | 28 build, such as running tests. |
| 28 status: outputs one of three values: none of the supplied files were found, | 29 status: outputs one of three values: none of the supplied files were found, |
| 29 one of the include files changed so that it should be assumed everything | 30 one of the include files changed so that it should be assumed everything |
| 30 changed (in this case test_targets and compile_targets are not output) or at | 31 changed (in this case test_targets and compile_targets are not output) or at |
| 31 least one file was found. | 32 least one file was found. |
| 32 invalid_targets: list of supplied targets that were not found. | 33 invalid_targets: list of supplied targets that were not found. |
| 33 | 34 |
| (...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 result_dict['invalid_targets'] = calculator.invalid_targets | 826 result_dict['invalid_targets'] = calculator.invalid_targets |
| 826 _WriteOutput(params, **result_dict) | 827 _WriteOutput(params, **result_dict) |
| 827 return | 828 return |
| 828 | 829 |
| 829 test_target_names = calculator.find_matching_test_target_names() | 830 test_target_names = calculator.find_matching_test_target_names() |
| 830 compile_target_names = calculator.find_matching_compile_target_names() | 831 compile_target_names = calculator.find_matching_compile_target_names() |
| 831 found_at_least_one_target = compile_target_names or test_target_names | 832 found_at_least_one_target = compile_target_names or test_target_names |
| 832 result_dict = { 'test_targets': test_target_names, | 833 result_dict = { 'test_targets': test_target_names, |
| 833 'status': found_dependency_string if | 834 'status': found_dependency_string if |
| 834 found_at_least_one_target else no_dependency_string, | 835 found_at_least_one_target else no_dependency_string, |
| 835 'compile_targets': compile_target_names} | 836 'compile_targets': list( |
| 837 set(compile_target_names) | |
| 838 set(test_target_names)) } |
| 836 if calculator.invalid_targets: | 839 if calculator.invalid_targets: |
| 837 result_dict['invalid_targets'] = calculator.invalid_targets | 840 result_dict['invalid_targets'] = calculator.invalid_targets |
| 838 _WriteOutput(params, **result_dict) | 841 _WriteOutput(params, **result_dict) |
| 839 | 842 |
| 840 except Exception as e: | 843 except Exception as e: |
| 841 _WriteOutput(params, error=str(e)) | 844 _WriteOutput(params, error=str(e)) |
| OLD | NEW |