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

Unified Diff: pkg/front_end/lib/src/fasta/testing/patched_sdk_location.dart

Issue 2828583003: remove dependencies to analyzer from lib/src/fasta (Closed)
Patch Set: rebase Created 3 years, 8 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: pkg/front_end/lib/src/fasta/testing/patched_sdk_location.dart
diff --git a/pkg/front_end/lib/src/fasta/testing/patched_sdk_location.dart b/pkg/front_end/lib/src/fasta/testing/patched_sdk_location.dart
new file mode 100644
index 0000000000000000000000000000000000000000..e120f365f92d655a5b5979d7405b587ecb677887
--- /dev/null
+++ b/pkg/front_end/lib/src/fasta/testing/patched_sdk_location.dart
@@ -0,0 +1,56 @@
+// Copyright (c) 2017, 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.md file.
+
+/// Utility for locating the patched_sdk. This is temporarily used to run fasta
+/// until patching support is added.
+library fasta.testing.patched_sdk_location;
+
+import 'dart:async';
+import 'dart:io' show File, Platform;
+
+import 'environment_variable.dart' show EnvironmentVariable;
+
+Future<Uri> computePatchedSdk() async {
+ String config = await testConfigVariable.value;
+ String path;
+ switch (Platform.operatingSystem) {
+ case "linux":
+ path = "out/$config/patched_sdk";
+ break;
+
+ case "macos":
+ path = "xcodebuild/$config/patched_sdk";
+ break;
+
+ case "windows":
+ path = "build/$config/patched_sdk";
+ break;
+
+ default:
+ throw "Unsupported operating system: '${Platform.operatingSystem}'.";
+ }
+ Uri sdk = Uri.base.resolve("$path/");
+ const String asyncDart = "lib/async/async.dart";
+ if (!await fileExists(sdk, asyncDart)) {
+ throw "Couldn't find '$asyncDart' in '$sdk'.";
+ }
+ const String asyncSources = "lib/async/async_sources.gypi";
+ if (await fileExists(sdk, asyncSources)) {
+ throw "Found '$asyncSources' in '$sdk', so it isn't a patched SDK.";
+ }
+ return sdk;
+}
+
+Uri computeDartVm(Uri patchedSdk) {
+ return patchedSdk.resolve(Platform.isWindows ? "../dart.exe" : "../dart");
+}
+
+Future<bool> fileExists(Uri base, String path) async {
+ return await new File.fromUri(base.resolve(path)).exists();
+}
+
+final EnvironmentVariable testConfigVariable = new EnvironmentVariable(
+ "DART_CONFIGURATION",
+ "It should be something like 'ReleaseX64', depending on which"
+ " configuration you're testing.");
« no previous file with comments | « pkg/front_end/lib/src/fasta/testing/kernel_chain.dart ('k') | pkg/front_end/lib/src/fasta/testing/suite.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698