OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 | 5 |
6 from recipe_engine import recipe_api | 6 from recipe_engine import recipe_api |
7 import shlex | 7 import shlex |
8 | 8 |
9 | 9 |
10 DEFAULT_TASK_EXPIRATION = 4*60*60 | 10 DEFAULT_TASK_EXPIRATION = 4*60*60 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 include_hashes: list of str. Hashes of the new includes. | 154 include_hashes: list of str. Hashes of the new includes. |
155 Returns: | 155 Returns: |
156 Updated hash of the .isolated file. | 156 Updated hash of the .isolated file. |
157 """ | 157 """ |
158 isolated_file = self.isolated_file_path(task_name) | 158 isolated_file = self.isolated_file_path(task_name) |
159 self.m.python.inline('add_isolated_input', program=""" | 159 self.m.python.inline('add_isolated_input', program=""" |
160 import json | 160 import json |
161 import sys | 161 import sys |
162 with open(sys.argv[1]) as f: | 162 with open(sys.argv[1]) as f: |
163 isolated = json.load(f) | 163 isolated = json.load(f) |
| 164 if not isolated.get('includes'): |
| 165 isolated['includes'] = [] |
164 for h in sys.argv[2:]: | 166 for h in sys.argv[2:]: |
165 isolated['includes'].append(h) | 167 isolated['includes'].append(h) |
166 with open(sys.argv[1], 'w') as f: | 168 with open(sys.argv[1], 'w') as f: |
167 json.dump(isolated, f, sort_keys=True) | 169 json.dump(isolated, f, sort_keys=True) |
168 """, args=[isolated_file] + include_hashes) | 170 """, args=[isolated_file] + include_hashes) |
169 isolateserver = self.m.swarming_client.path.join('isolateserver.py') | 171 isolateserver = self.m.swarming_client.path.join('isolateserver.py') |
170 r = self.m.python('upload new .isolated file for %s' % task_name, | 172 r = self.m.python('upload new .isolated file for %s' % task_name, |
171 script=isolateserver, | 173 script=isolateserver, |
172 args=['archive', '--isolate-server', | 174 args=['archive', '--isolate-server', |
173 self.m.isolate.isolate_server, isolated_file], | 175 self.m.isolate.isolate_server, isolated_file], |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 def collect_swarming_task_isolate_hash(self, swarming_task): | 231 def collect_swarming_task_isolate_hash(self, swarming_task): |
230 """Wait for the given swarming task to finish and return its output hash. | 232 """Wait for the given swarming task to finish and return its output hash. |
231 | 233 |
232 Args: | 234 Args: |
233 swarming_task: An instance of swarming.SwarmingTask. | 235 swarming_task: An instance of swarming.SwarmingTask. |
234 Returns: | 236 Returns: |
235 the hash of the isolate output of the task. | 237 the hash of the isolate output of the task. |
236 """ | 238 """ |
237 res = self.collect_swarming_task(swarming_task) | 239 res = self.collect_swarming_task(swarming_task) |
238 return res.json.output['shards'][0]['isolated_out']['isolated'] | 240 return res.json.output['shards'][0]['isolated_out']['isolated'] |
OLD | NEW |