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

Side by Side Diff: pkg/front_end/lib/src/fasta/patched_sdk_location.dart

Issue 2828583003: remove dependencies to analyzer from lib/src/fasta (Closed)
Patch Set: add copyright 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 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 front_end.src.fasta.patched_sdk_location;
Siggi Cherem (dart-lang) 2017/04/19 20:46:18 I extracted this code out of kernel_chain in the p
ahe 2017/04/20 09:24:50 As for the library name, I'd prefer to shorten "fr
ahe 2017/04/20 09:24:50 Agreed, but I think it should be moved to the test
Siggi Cherem (dart-lang) 2017/04/21 04:29:23 Done.
Siggi Cherem (dart-lang) 2017/04/21 04:29:23 Done.
8
9 import 'dart:async';
10 import 'dart:io' show File, Platform;
11
12 import 'environment_variable.dart' show EnvironmentVariable;
ahe 2017/04/20 09:24:50 We should now be able to move this to testing as w
Siggi Cherem (dart-lang) 2017/04/21 04:29:22 Done.
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

Powered by Google App Engine
This is Rietveld 408576698