Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2012 Google Inc. All rights reserved. | 1 # Copyright (c) 2012 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 from compiler.ast import Const | 5 from compiler.ast import Const |
| 6 from compiler.ast import Dict | 6 from compiler.ast import Dict |
| 7 from compiler.ast import Discard | 7 from compiler.ast import Discard |
| 8 from compiler.ast import List | 8 from compiler.ast import List |
| 9 from compiler.ast import Module | 9 from compiler.ast import Module |
| 10 from compiler.ast import Node | 10 from compiler.ast import Node |
| (...skipping 2499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2510 # Prepare a key like 'path/to:target_name'. | 2510 # Prepare a key like 'path/to:target_name'. |
| 2511 key = subdir + ':' + name | 2511 key = subdir + ':' + name |
| 2512 if key in used: | 2512 if key in used: |
| 2513 # Complain if this target is already used. | 2513 # Complain if this target is already used. |
| 2514 raise GypError('Duplicate target name "%s" in directory "%s" used both ' | 2514 raise GypError('Duplicate target name "%s" in directory "%s" used both ' |
| 2515 'in "%s" and "%s".' % (name, subdir, gyp, used[key])) | 2515 'in "%s" and "%s".' % (name, subdir, gyp, used[key])) |
| 2516 used[key] = gyp | 2516 used[key] = gyp |
| 2517 | 2517 |
| 2518 | 2518 |
| 2519 def Load(build_files, variables, includes, depth, generator_input_info, check, | 2519 def Load(build_files, variables, includes, depth, generator_input_info, check, |
| 2520 circular_check, parallel): | 2520 circular_check, allow_duplicates, parallel): |
| 2521 # Set up path_sections and non_configuration_keys with the default data plus | 2521 # Set up path_sections and non_configuration_keys with the default data plus |
| 2522 # the generator-specifc data. | 2522 # the generator-specifc data. |
| 2523 global path_sections | 2523 global path_sections |
| 2524 path_sections = base_path_sections[:] | 2524 path_sections = base_path_sections[:] |
| 2525 path_sections.extend(generator_input_info['path_sections']) | 2525 path_sections.extend(generator_input_info['path_sections']) |
| 2526 | 2526 |
| 2527 global non_configuration_keys | 2527 global non_configuration_keys |
| 2528 non_configuration_keys = base_non_configuration_keys[:] | 2528 non_configuration_keys = base_non_configuration_keys[:] |
| 2529 non_configuration_keys.extend(generator_input_info['non_configuration_keys']) | 2529 non_configuration_keys.extend(generator_input_info['non_configuration_keys']) |
| 2530 | 2530 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2648 build_file = gyp.common.BuildFile(target) | 2648 build_file = gyp.common.BuildFile(target) |
| 2649 ProcessVariablesAndConditionsInDict( | 2649 ProcessVariablesAndConditionsInDict( |
| 2650 target_dict, PHASE_LATELATE, variables, build_file) | 2650 target_dict, PHASE_LATELATE, variables, build_file) |
| 2651 | 2651 |
| 2652 # Make sure that the rules make sense, and build up rule_sources lists as | 2652 # Make sure that the rules make sense, and build up rule_sources lists as |
| 2653 # needed. Not all generators will need to use the rule_sources lists, but | 2653 # needed. Not all generators will need to use the rule_sources lists, but |
| 2654 # some may, and it seems best to build the list in a common spot. | 2654 # some may, and it seems best to build the list in a common spot. |
| 2655 # Also validate actions and run_as elements in targets. | 2655 # Also validate actions and run_as elements in targets. |
| 2656 for target in flat_list: | 2656 for target in flat_list: |
| 2657 target_dict = targets[target] | 2657 target_dict = targets[target] |
| 2658 target_variables = {} | |
| 2659 if 'variables' in target_dict: | |
| 2660 target_variables = target_dict['variables'] | |
|
Sam Clegg
2013/02/09 17:52:47
You can just do:
target_variables = target_dict.g
| |
| 2658 build_file = gyp.common.BuildFile(target) | 2661 build_file = gyp.common.BuildFile(target) |
| 2659 ValidateTargetType(target, target_dict) | 2662 ValidateTargetType(target, target_dict) |
| 2660 # TODO(thakis): Get vpx_scale/arm/scalesystemdependent.c to be renamed to | 2663 allow_duplicates_variable = False |
| 2661 # scalesystemdependent_arm_additions.c or similar. | 2664 if target_variables and 'allow_duplicate_basenames' in target_variables: |
| 2662 if 'arm' not in variables.get('target_arch', ''): | 2665 allow_duplicates_variable = target_variables['allow_duplicate_basenames'] |
|
Sam Clegg
2013/02/09 17:52:47
You can just do:
allow_duplicates_variable = targ
| |
| 2663 ValidateSourcesInTarget(target, target_dict, build_file) | 2666 if not (allow_duplicates or allow_duplicates_variable): |
| 2667 # TODO(thakis): Get vpx_scale/arm/scalesystemdependent.c to be renamed to | |
| 2668 # scalesystemdependent_arm_additions.c or similar. | |
| 2669 if 'arm' not in variables.get('target_arch', ''): | |
| 2670 ValidateSourcesInTarget(target, target_dict, build_file) | |
|
Sam Clegg
2013/02/09 17:52:47
Seems like it would be nice to remove this TODO, a
| |
| 2664 ValidateRulesInTarget(target, target_dict, extra_sources_for_rules) | 2671 ValidateRulesInTarget(target, target_dict, extra_sources_for_rules) |
| 2665 ValidateRunAsInTarget(target, target_dict, build_file) | 2672 ValidateRunAsInTarget(target, target_dict, build_file) |
| 2666 ValidateActionsInTarget(target, target_dict, build_file) | 2673 ValidateActionsInTarget(target, target_dict, build_file) |
| 2667 | 2674 |
| 2668 # Generators might not expect ints. Turn them into strs. | 2675 # Generators might not expect ints. Turn them into strs. |
| 2669 TurnIntIntoStrInDict(data) | 2676 TurnIntIntoStrInDict(data) |
| 2670 | 2677 |
| 2671 # TODO(mark): Return |data| for now because the generator needs a list of | 2678 # TODO(mark): Return |data| for now because the generator needs a list of |
| 2672 # build files that came in. In the future, maybe it should just accept | 2679 # build files that came in. In the future, maybe it should just accept |
| 2673 # a list, and not the whole data dict. | 2680 # a list, and not the whole data dict. |
| 2674 return [flat_list, targets, data] | 2681 return [flat_list, targets, data] |
| OLD | NEW |