Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1672)

Unified Diff: tools/testing/dart/runtime_updater.dart

Issue 2981223002: Remove Dartium support from test.dart. (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/testing/dart/runtime_updater.dart
diff --git a/tools/testing/dart/runtime_updater.dart b/tools/testing/dart/runtime_updater.dart
new file mode 100644
index 0000000000000000000000000000000000000000..f4705c3ad516a62c605af81485d31830d225d9d1
--- /dev/null
+++ b/tools/testing/dart/runtime_updater.dart
@@ -0,0 +1,53 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+import 'dart:io';
+
+import 'configuration.dart';
+import 'utils.dart';
+
+Future _contentShellFuture;
+
+/// 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.
+Future updateContentShell(Runtime runtime, String drtPath) {
+ if (_contentShellFuture == null) {
+ _contentShellFuture =
+ new _RuntimeUpdater('Content Shell', 'tools/get_archive.py', 'drt')
+ .update();
+ }
+
+ return _contentShellFuture;
+}
+
+class _RuntimeUpdater {
+ String _name;
+ String _script;
+ String _option;
+
+ _RuntimeUpdater(this._name, this._script, [this._option]);
+
+ Future update() async {
+ try {
+ print('Updating $_name...');
+
+ var arguments = [TestUtils.dartDirUri.resolve(_script).toFilePath()];
+
+ if (_option != null) arguments.add(_option);
+
+ var result = await Process.run('python', arguments);
+ if (result.exitCode == 0) {
+ print('Updated $_name.');
+ } else {
+ print('Failed to update $_name (exit code ${result.exitCode}):');
+ print(result.stdout);
+ print(result.stderr);
+ exit(1);
+ }
+ } catch (error) {
+ print("Error starting $_script process: $error");
+ exit(1);
+ }
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698