OLD | NEW |
1 # Copyright (c) 2011 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 |
11 from compiler.ast import Stmt | 11 from compiler.ast import Stmt |
(...skipping 2133 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 and not action_command[0]: |
| 2157 raise Exception("Empty action as command in target %s." % target_name) |
2155 | 2158 |
2156 | 2159 |
2157 def ValidateRunAsInTarget(target, target_dict, build_file): | 2160 def ValidateRunAsInTarget(target, target_dict, build_file): |
2158 target_name = target_dict.get('target_name') | 2161 target_name = target_dict.get('target_name') |
2159 run_as = target_dict.get('run_as') | 2162 run_as = target_dict.get('run_as') |
2160 if not run_as: | 2163 if not run_as: |
2161 return | 2164 return |
2162 if not isinstance(run_as, dict): | 2165 if not isinstance(run_as, dict): |
2163 raise Exception("The 'run_as' in target %s from file %s should be a " | 2166 raise Exception("The 'run_as' in target %s from file %s should be a " |
2164 "dictionary." % | 2167 "dictionary." % |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2373 ValidateRunAsInTarget(target, target_dict, build_file) | 2376 ValidateRunAsInTarget(target, target_dict, build_file) |
2374 ValidateActionsInTarget(target, target_dict, build_file) | 2377 ValidateActionsInTarget(target, target_dict, build_file) |
2375 | 2378 |
2376 # Generators might not expect ints. Turn them into strs. | 2379 # Generators might not expect ints. Turn them into strs. |
2377 TurnIntIntoStrInDict(data) | 2380 TurnIntIntoStrInDict(data) |
2378 | 2381 |
2379 # TODO(mark): Return |data| for now because the generator needs a list of | 2382 # 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 | 2383 # build files that came in. In the future, maybe it should just accept |
2381 # a list, and not the whole data dict. | 2384 # a list, and not the whole data dict. |
2382 return [flat_list, targets, data] | 2385 return [flat_list, targets, data] |
OLD | NEW |