Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 import 'dart:async'; | |
| 6 import 'dart:io'; | |
| 7 | |
| 8 import 'configuration.dart'; | |
| 9 import 'utils.dart'; | |
| 10 | |
| 11 Future _contentShellFuture; | |
| 12 | |
| 13 /// Runs "tools/get_archive.py" to download and install Content Shell. | |
|
Bill Hesse
2017/07/19 14:13:06
Check runtime against drt here, and return null (o
Bob Nystrom
2017/07/20 00:00:00
Done.
| |
| 14 Future updateContentShell(Runtime runtime, String drtPath) { | |
| 15 if (_contentShellFuture == null) { | |
| 16 _contentShellFuture = | |
| 17 new _RuntimeUpdater('Content Shell', 'tools/get_archive.py', 'drt') | |
| 18 .update(); | |
| 19 } | |
| 20 | |
| 21 return _contentShellFuture; | |
| 22 } | |
| 23 | |
| 24 class _RuntimeUpdater { | |
| 25 String _name; | |
| 26 String _script; | |
| 27 String _option; | |
| 28 | |
| 29 _RuntimeUpdater(this._name, this._script, [this._option]); | |
| 30 | |
| 31 Future update() async { | |
| 32 try { | |
| 33 print('Updating $_name...'); | |
| 34 | |
| 35 var arguments = [TestUtils.dartDirUri.resolve(_script).toFilePath()]; | |
| 36 | |
| 37 if (_option != null) arguments.add(_option); | |
| 38 | |
| 39 var result = await Process.run('python', arguments); | |
| 40 if (result.exitCode == 0) { | |
| 41 print('Updated $_name.'); | |
| 42 } else { | |
| 43 print('Failed to update $_name (exit code ${result.exitCode}):'); | |
| 44 print(result.stdout); | |
| 45 print(result.stderr); | |
| 46 exit(1); | |
| 47 } | |
| 48 } catch (error) { | |
| 49 print("Error starting $_script process: $error"); | |
| 50 exit(1); | |
| 51 } | |
| 52 } | |
| 53 } | |
| OLD | NEW |