Fix analyzer's SDK detection so that during integration tests, we use the built SDK.

R=scheglov@google.com

Review-Url: https://codereview.chromium.org/2568743003 .
This commit is contained in:
Paul Berry 2016-12-12 09:49:50 -08:00
parent a7222ac09d
commit fb2dbfce21

View file

@ -698,7 +698,16 @@ class FolderBasedDartSdk extends AbstractDartSdk {
String outDir = pathContext.dirname(pathContext.dirname(exec));
String sdkPath = pathContext.join(pathContext.dirname(outDir), "sdk");
if (resourceProvider.getFolder(sdkPath).exists) {
return sdkPath;
// We are executing in the context of a test. sdkPath is the path to the
// *source* files for the SDK. But we want to test using the path to the
// *built* SDK if possible.
String builtSdkPath =
pathContext.join(pathContext.dirname(exec), 'dart-sdk');
if (resourceProvider.getFolder(sdkPath).exists) {
return builtSdkPath;
} else {
return sdkPath;
}
}
// probably be "dart-sdk/bin/dart"
return pathContext.dirname(pathContext.dirname(exec));