Add DartSdk.languageVersion

Bug: https://github.com/dart-lang/build/issues/2763#issuecomment-666707445
Change-Id: I8232bd395abc9efea0e5c27716450d6a5442b3bb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156489
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
Konstantin Shcheglov
2020-08-04 21:01:09 +00:00
committed by commit-bot@chromium.org
parent a99edb8ac5
commit ebd5b622ba
19 changed files with 212 additions and 54 deletions
+13 -1
View File
@@ -218,7 +218,7 @@ Future<Null> analyzeUris(
List<String> arguments = <String>[
"--packages=${toFilePath(packages)}",
"--format=machine",
"--dart-sdk=${Uri.base.resolve('sdk/').toFilePath()}",
"--dart-sdk=${_findSdkPath()}",
];
if (analysisOptions != null) {
arguments.add("--options=${toFilePath(analysisOptions)}");
@@ -274,6 +274,18 @@ Future<Null> analyzeUris(
}
}
String _findSdkPath() {
var executableUri = Uri.file(Platform.executable);
if (File.fromUri(executableUri.resolve('../version')).existsSync()) {
return executableUri.resolve('..').toFilePath();
} else if (File.fromUri(executableUri.resolve('dart-sdk/version'))
.existsSync()) {
return executableUri.resolve('dart-sdk').toFilePath();
} else {
throw StateError('Cannot find dart-sdk for $executableUri');
}
}
Future<String> git(String command, Iterable<String> arguments,
{String workingDirectory}) async {
ProcessResult result = await Process.run(