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

Side by Side 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, 7 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2017, 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.md file.
4
5 /// Utility for locating the patched_sdk. This is temporarily used to run fasta
6 /// until patching support is added.
7 library fasta.testing.patched_sdk_location;
8
9 import 'dart:async';
10 import 'dart:io' show File, Platform;
11
12 import 'environment_variable.dart' show EnvironmentVariable;
13
14 Future<Uri> computePatchedSdk() async {
15 String config = await testConfigVariable.value;
16 String path;
17 switch (Platform.operatingSystem) {
18 case "linux":
19 path = "out/$config/patched_sdk";
20 break;
21
22 case "macos":
23 path = "xcodebuild/$config/patched_sdk";
24 break;
25
26 case "windows":
27 path = "build/$config/patched_sdk";
28 break;
29
30 default:
31 throw "Unsupported operating system: '${Platform.operatingSystem}'.";
32 }
33 Uri sdk = Uri.base.resolve("$path/");
34 const String asyncDart = "lib/async/async.dart";
35 if (!await fileExists(sdk, asyncDart)) {
36 throw "Couldn't find '$asyncDart' in '$sdk'.";
37 }
38 const String asyncSources = "lib/async/async_sources.gypi";
39 if (await fileExists(sdk, asyncSources)) {
40 throw "Found '$asyncSources' in '$sdk', so it isn't a patched SDK.";
41 }
42 return sdk;
43 }
44
45 Uri computeDartVm(Uri patchedSdk) {
46 return patchedSdk.resolve(Platform.isWindows ? "../dart.exe" : "../dart");
47 }
48
49 Future<bool> fileExists(Uri base, String path) async {
50 return await new File.fromUri(base.resolve(path)).exists();
51 }
52
53 final EnvironmentVariable testConfigVariable = new EnvironmentVariable(
54 "DART_CONFIGURATION",
55 "It should be something like 'ReleaseX64', depending on which"
56 " configuration you're testing.");
OLDNEW
« 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