Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (c) 2011 Google Inc. All rights reserved. | 1 # Copyright (c) 2011 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 2134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2145 '''Validates the inputs to the actions in a target.''' | 2145 '''Validates the inputs to the actions in a target.''' |
| 2146 target_name = target_dict.get('target_name') | 2146 target_name = target_dict.get('target_name') |
| 2147 actions = target_dict.get('actions', []) | 2147 actions = target_dict.get('actions', []) |
| 2148 for action in actions: | 2148 for action in actions: |
| 2149 action_name = action.get('action_name') | 2149 action_name = action.get('action_name') |
| 2150 if not action_name: | 2150 if not action_name: |
| 2151 raise Exception("Anonymous action in target %s. " | 2151 raise Exception("Anonymous action in target %s. " |
| 2152 "An action must have an 'action_name' field." % | 2152 "An action must have an 'action_name' field." % |
| 2153 target_name) | 2153 target_name) |
| 2154 inputs = action.get('inputs', []) | 2154 inputs = action.get('inputs', []) |
| 2155 action_command = action.get('action') | |
| 2156 if action_command: | |
|
(unused - use chromium)
2012/02/23 01:55:19
if action_command and not action-command[0]:
rai
| |
| 2157 if action_command[0] == '': | |
| 2158 raise Exception("Empty action as command in target %s. " % | |
| 2159 target_name) | |
| 2155 | 2160 |
| 2156 | 2161 |
| 2157 def ValidateRunAsInTarget(target, target_dict, build_file): | 2162 def ValidateRunAsInTarget(target, target_dict, build_file): |
| 2158 target_name = target_dict.get('target_name') | 2163 target_name = target_dict.get('target_name') |
| 2159 run_as = target_dict.get('run_as') | 2164 run_as = target_dict.get('run_as') |
| 2160 if not run_as: | 2165 if not run_as: |
| 2161 return | 2166 return |
| 2162 if not isinstance(run_as, dict): | 2167 if not isinstance(run_as, dict): |
| 2163 raise Exception("The 'run_as' in target %s from file %s should be a " | 2168 raise Exception("The 'run_as' in target %s from file %s should be a " |
| 2164 "dictionary." % | 2169 "dictionary." % |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2373 ValidateRunAsInTarget(target, target_dict, build_file) | 2378 ValidateRunAsInTarget(target, target_dict, build_file) |
| 2374 ValidateActionsInTarget(target, target_dict, build_file) | 2379 ValidateActionsInTarget(target, target_dict, build_file) |
| 2375 | 2380 |
| 2376 # Generators might not expect ints. Turn them into strs. | 2381 # Generators might not expect ints. Turn them into strs. |
| 2377 TurnIntIntoStrInDict(data) | 2382 TurnIntIntoStrInDict(data) |
| 2378 | 2383 |
| 2379 # TODO(mark): Return |data| for now because the generator needs a list of | 2384 # TODO(mark): Return |data| for now because the generator needs a list of |
| 2380 # build files that came in. In the future, maybe it should just accept | 2385 # build files that came in. In the future, maybe it should just accept |
| 2381 # a list, and not the whole data dict. | 2386 # a list, and not the whole data dict. |
| 2382 return [flat_list, targets, data] | 2387 return [flat_list, targets, data] |
| OLD | NEW |