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 contextlib | 6 import contextlib |
7 import json | 7 import json |
8 | 8 |
9 from cStringIO import StringIO | 9 from cStringIO import StringIO |
10 | 10 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 """A placeholder which will expand to a file path containing <data>.""" | 110 """A placeholder which will expand to a file path containing <data>.""" |
111 return self.m.raw_io.input(self.dumps(data), '.json') | 111 return self.m.raw_io.input(self.dumps(data), '.json') |
112 | 112 |
113 @recipe_util.returns_placeholder | 113 @recipe_util.returns_placeholder |
114 def output(self, add_json_log=True): | 114 def output(self, add_json_log=True): |
115 """A placeholder which will expand to '--output-json /tmp/file'.""" | 115 """A placeholder which will expand to '--output-json /tmp/file'.""" |
116 return JsonOutputPlaceholder(self, add_json_log) | 116 return JsonOutputPlaceholder(self, add_json_log) |
117 | 117 |
118 # TODO(phajdan.jr): Rename to layout_test_results. | 118 # TODO(phajdan.jr): Rename to layout_test_results. |
119 @recipe_util.returns_placeholder | 119 @recipe_util.returns_placeholder |
120 def test_results(self): | 120 def test_results(self, add_json_log=True): |
121 """A placeholder which will expand to '--json-test-results /tmp/file'. | 121 """A placeholder which will expand to '--json-test-results /tmp/file'. |
122 | 122 |
123 The test_results will be an instance of the TestResults class. | 123 The test_results will be an instance of the TestResults class. |
124 """ | 124 """ |
125 return TestResultsOutputPlaceholder(self, True) | 125 return TestResultsOutputPlaceholder(self, add_json_log) |
126 | 126 |
127 @recipe_util.returns_placeholder | 127 @recipe_util.returns_placeholder |
128 def gtest_results(self): | 128 def gtest_results(self, add_json_log=True): |
129 """A placeholder which will expand to '--test-launcher-summary-output /tmp/f
ile'. | 129 """A placeholder which will expand to '--test-launcher-summary-output /tmp/f
ile'. |
130 | 130 |
131 The test_results will be an instance of the GTestResults class. | 131 The test_results will be an instance of the GTestResults class. |
132 """ | 132 """ |
133 return GTestResultsOutputPlaceholder(self, True) | 133 return GTestResultsOutputPlaceholder(self, add_json_log) |
134 | 134 |
135 def property_args(self): | 135 def property_args(self): |
136 """Return --build-properties and --factory-properties arguments. LEGACY! | 136 """Return --build-properties and --factory-properties arguments. LEGACY! |
137 | 137 |
138 Since properties is the merge of build_properties and factory_properties, | 138 Since properties is the merge of build_properties and factory_properties, |
139 pass the merged dict as both arguments. | 139 pass the merged dict as both arguments. |
140 | 140 |
141 It's vastly preferable to have your recipe only pass the bare minimum | 141 It's vastly preferable to have your recipe only pass the bare minimum |
142 of arguments to steps. Passing property objects obscures the data that | 142 of arguments to steps. Passing property objects obscures the data that |
143 the script actually consumes from the property object. | 143 the script actually consumes from the property object. |
144 """ | 144 """ |
145 prop_str = self.dumps(dict(self.m.properties)) | 145 prop_str = self.dumps(dict(self.m.properties)) |
146 return [ | 146 return [ |
147 '--factory-properties', prop_str, | 147 '--factory-properties', prop_str, |
148 '--build-properties', prop_str | 148 '--build-properties', prop_str |
149 ] | 149 ] |
OLD | NEW |