OLD | NEW |
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. 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 import contextlib | 5 import contextlib |
6 | 6 |
7 from recipe_engine import recipe_api | 7 from recipe_engine import recipe_api |
8 | 8 |
9 | 9 |
10 # Inherit from RecipeApiPlain because the only thing which is a step is | 10 # Inherit from RecipeApiPlain because the only thing which is a step is |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 kwargs['cmd'] = command | 124 kwargs['cmd'] = command |
125 | 125 |
126 kwargs['ok_ret'] = ok_ret | 126 kwargs['ok_ret'] = ok_ret |
127 kwargs['infra_step'] = bool(infra_step) | 127 kwargs['infra_step'] = bool(infra_step) |
128 | 128 |
129 # Obtain information from composite step parent. | 129 # Obtain information from composite step parent. |
130 compositor = recipe_api._STEP_CONTEXT | 130 compositor = recipe_api._STEP_CONTEXT |
131 name = compositor.get_with_context('name', name) | 131 name = compositor.get_with_context('name', name) |
132 kwargs['env'] = compositor.get_with_context('env', kwargs.get('env', {})) | 132 kwargs['env'] = compositor.get_with_context('env', kwargs.get('env', {})) |
133 kwargs['step_nest_level'] = compositor.get_with_context('nest_level', 0) | 133 kwargs['step_nest_level'] = compositor.get_with_context('nest_level', 0) |
| 134 kwargs.setdefault('cwd', self.m.path['slave_build']) |
134 | 135 |
135 # Disambiguate repeated names | 136 # Disambiguate repeated names |
136 step_count = self._step_names.setdefault(name, 0) + 1 | 137 step_count = self._step_names.setdefault(name, 0) + 1 |
137 self._step_names[name] = step_count | 138 self._step_names[name] = step_count |
138 if step_count > 1: | 139 if step_count > 1: |
139 name = "%s (%d)" % (name, step_count) | 140 name = "%s (%d)" % (name, step_count) |
140 kwargs['name'] = name | 141 kwargs['name'] = name |
141 | 142 |
142 schema = self.make_config() | 143 schema = self.make_config() |
143 schema.set_val(kwargs) | 144 schema.set_val(kwargs) |
144 return self.run_from_dict(self._engine.create_step(schema)) | 145 return self.run_from_dict(self._engine.create_step(schema)) |
145 | 146 |
146 # TODO(martiniss) delete, and make generator_script use **kwargs on step() | 147 # TODO(martiniss) delete, and make generator_script use **kwargs on step() |
147 @recipe_api.composite_step | 148 @recipe_api.composite_step |
148 def run_from_dict(self, dct): | 149 def run_from_dict(self, dct): |
149 return self._engine.run_step(dct) | 150 return self._engine.run_step(dct) |
OLD | NEW |