Skip to content

Commit

Permalink
[ CLI ] Simplify check for SDK root
Browse files Browse the repository at this point in the history
Removes the check for the `gen` directory when trying to identify a
non-standard SDK root. This allows for the non-standard SDK in google3
to correctly load snapshots.

TEST=CQ

Change-Id: I9766ca83a02b19b1c059c13f06e4894e0ec03ae2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366200
Auto-Submit: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
  • Loading branch information
bkonyi authored and Commit Queue committed May 13, 2024
1 parent b550c3f commit 219e61e
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions pkg/dartdev/lib/src/sdk.dart
Expand Up @@ -148,17 +148,9 @@ class Sdk {
if (!Directory(snapshotsDir).existsSync()) {
// This is the less common case where the user is in
// the checked out Dart SDK, and is executing `dart` via:
// ./out/ReleaseX64/dart ...
// We confirm in a similar manner with the gen directory existence
// and then return the correct sdk path:
final altPath = path.absolute(path.dirname(Platform.resolvedExecutable));
final genPath = path.join(altPath, 'gen');
if (Directory(genPath).existsSync()) {
sdkPath = altPath;
runFromBuildRoot = true;
}
// If that snapshot dir does not exist either,
// we use the first guess anyway.
// ./out/ReleaseX64/dart ... or in google3.
sdkPath = path.absolute(path.dirname(Platform.resolvedExecutable));
runFromBuildRoot = true;
}

// Defer to [Runtime] for the version.
Expand Down

0 comments on commit 219e61e

Please sign in to comment.