Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
|
siva
2017/07/20 00:33:52
Nit! 2017
Bob Nystrom
2017/07/20 19:42:26
Done.
| |
| 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 'utils.dart'; | |
| 9 | |
| 10 Future _contentShellFuture; | |
| 11 | |
| 12 /// Runs "tools/get_archive.py" to download and install Content Shell. | |
| 13 Future updateContentShell(String drtPath) { | |
| 14 if (_contentShellFuture == null) { | |
| 15 _contentShellFuture = | |
| 16 new _RuntimeUpdater('Content Shell', 'tools/get_archive.py', 'drt') | |
| 17 .update(); | |
| 18 } | |
| 19 | |
| 20 return _contentShellFuture; | |
| 21 } | |
| 22 | |
| 23 class _RuntimeUpdater { | |
| 24 String _name; | |
| 25 String _script; | |
| 26 String _option; | |
| 27 | |
| 28 _RuntimeUpdater(this._name, this._script, [this._option]); | |
| 29 | |
| 30 Future update() async { | |
| 31 try { | |
| 32 print('Updating $_name...'); | |
| 33 | |
| 34 var arguments = [TestUtils.dartDirUri.resolve(_script).toFilePath()]; | |
| 35 | |
| 36 if (_option != null) arguments.add(_option); | |
| 37 | |
| 38 var result = await Process.run('python', arguments); | |
| 39 if (result.exitCode == 0) { | |
| 40 print('Updated $_name.'); | |
| 41 } else { | |
| 42 print('Failed to update $_name (exit code ${result.exitCode}):'); | |
| 43 print(result.stdout); | |
| 44 print(result.stderr); | |
| 45 exit(1); | |
| 46 } | |
| 47 } catch (error) { | |
| 48 print("Error starting $_script process: $error"); | |
| 49 exit(1); | |
| 50 } | |
| 51 } | |
| 52 } | |
| OLD | NEW |