| 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 functools | 5 import functools |
| 6 import collections | 6 import collections |
| 7 import contextlib | 7 import contextlib |
| 8 import json | 8 import json |
| 9 | 9 |
| 10 from cStringIO import StringIO | 10 from cStringIO import StringIO |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 to a step's cmd list, will be replaced by annotated_run with the path to a | 40 to a step's cmd list, will be replaced by annotated_run with the path to a |
| 41 temporary file (e.g. /tmp/tmp4lp1qM) which will exist only for the duration of | 41 temporary file (e.g. /tmp/tmp4lp1qM) which will exist only for the duration of |
| 42 the step. If the script requires a flag (e.g. --output-json /path/to/file), | 42 the step. If the script requires a flag (e.g. --output-json /path/to/file), |
| 43 you must supply that flag yourself in the cmd list. | 43 you must supply that flag yourself in the cmd list. |
| 44 | 44 |
| 45 This placeholder can be optionally added when you use the Steps.step() | 45 This placeholder can be optionally added when you use the Steps.step() |
| 46 method in this module. | 46 method in this module. |
| 47 | 47 |
| 48 FIXME | 48 FIXME |
| 49 After the termination of the step, this file is expected to contain a valid | 49 After the termination of the step, this file is expected to contain a valid |
| 50 JSON document, which will be set as the json_output for that step in the | 50 JSON document, which will be set as the json.output for that step in the |
| 51 step_history OrderedDict passed to your recipe generator. | 51 step_history OrderedDict passed to your recipe generator. |
| 52 """ | 52 """ |
| 53 def __init__(self, api, add_json_log): | 53 def __init__(self, api, add_json_log): |
| 54 self.raw = api.m.raw_io.output('.json') | 54 self.raw = api.m.raw_io.output('.json') |
| 55 self.add_json_log = add_json_log | 55 self.add_json_log = add_json_log |
| 56 super(JsonOutputPlaceholder, self).__init__() | 56 super(JsonOutputPlaceholder, self).__init__() |
| 57 | 57 |
| 58 @property | 58 @property |
| 59 def backing_file(self): | 59 def backing_file(self): |
| 60 return self.raw.backing_file | 60 return self.raw.backing_file |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 163 |
| 164 It's vastly preferable to have your recipe only pass the bare minimum | 164 It's vastly preferable to have your recipe only pass the bare minimum |
| 165 of arguments to steps. Passing property objects obscures the data that | 165 of arguments to steps. Passing property objects obscures the data that |
| 166 the script actually consumes from the property object. | 166 the script actually consumes from the property object. |
| 167 """ | 167 """ |
| 168 prop_str = self.dumps(dict(self.m.properties)) | 168 prop_str = self.dumps(dict(self.m.properties)) |
| 169 return [ | 169 return [ |
| 170 '--factory-properties', prop_str, | 170 '--factory-properties', prop_str, |
| 171 '--build-properties', prop_str | 171 '--build-properties', prop_str |
| 172 ] | 172 ] |
| OLD | NEW |