[gardening] Fix SDKArtifactSizes benchmark.

Compress the dart-sdk directory under the root, not the grandparent of
the root which will be the SDK checkout.

Also fix so dart2 version is 2.9 compatible and dart version is
latest version compatible.

Change-Id: I6e8875d9a3c9fdabf301db379340b2d8473a54cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210440
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
diff --git a/benchmarks/SDKArtifactSizes/dart/SDKArtifactSizes.dart b/benchmarks/SDKArtifactSizes/dart/SDKArtifactSizes.dart
index 5987a50..291ad67 100644
--- a/benchmarks/SDKArtifactSizes/dart/SDKArtifactSizes.dart
+++ b/benchmarks/SDKArtifactSizes/dart/SDKArtifactSizes.dart
@@ -66,13 +66,12 @@
 
   // Measure the (compressed) sdk size.
   final tempDir = Directory.systemTemp.createTempSync('dartdev');
-  final sdkArchive =
-      compress(File(Platform.resolvedExecutable).parent.parent, tempDir);
-  await reportArtifactSize(sdkArchive?.path, 'sdk');
+  final sdkArchive = compress(Directory('$rootDir/dart-sdk'), tempDir);
+  await reportArtifactSize(sdkArchive?.path ?? '', 'sdk');
   tempDir.deleteSync(recursive: true);
 }
 
-File compress(Directory sourceDir, Directory targetDir) {
+File? compress(Directory sourceDir, Directory targetDir) {
   final outFile = File('${targetDir.path}/sdk.zip');
 
   if (Platform.isMacOS || Platform.isLinux) {
diff --git a/benchmarks/SDKArtifactSizes/dart2/SDKArtifactSizes.dart b/benchmarks/SDKArtifactSizes/dart2/SDKArtifactSizes.dart
index 0cefa4d..f5b7f05 100644
--- a/benchmarks/SDKArtifactSizes/dart2/SDKArtifactSizes.dart
+++ b/benchmarks/SDKArtifactSizes/dart2/SDKArtifactSizes.dart
@@ -2,6 +2,8 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
+// @dart=2.9
+
 // Reports the sizes of binary artifacts shipped with the SDK.
 
 import 'dart:io';
@@ -66,13 +68,12 @@
 
   // Measure the (compressed) sdk size.
   final tempDir = Directory.systemTemp.createTempSync('dartdev');
-  final sdkArchive =
-      compress(File(Platform.resolvedExecutable).parent.parent, tempDir);
+  final sdkArchive = compress(Directory('$rootDir/dart-sdk'), tempDir);
   await reportArtifactSize(sdkArchive?.path ?? '', 'sdk');
   tempDir.deleteSync(recursive: true);
 }
 
-File? compress(Directory sourceDir, Directory targetDir) {
+File compress(Directory sourceDir, Directory targetDir) {
   final outFile = File('${targetDir.path}/sdk.zip');
 
   if (Platform.isMacOS || Platform.isLinux) {