Files
sdk/pkg/front_end/test/compile_platform_coverage.dart
T
Johnni Winther c5cd8ff349 [cfe] Remove agnostic mode
The agnostic mode was added to allow the platform dill embedded in
the VM to support both weak and strong mode. Since weak mode is no
longer supported in the VM, the agnostic mode can new be deleted.

All uses of the agnostic in Dart and Flutter have been removed prior
to this change.

Change-Id: Iff0f69d9cd64e887e01cd7e7d336a97761bd6d4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366801
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2024-06-06 11:02:37 +00:00

51 lines
1.7 KiB
Dart

// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
// 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.
import 'dart:io';
import '../tool/_fasta/entry_points.dart' show compilePlatformEntryPoint;
import 'coverage_helper.dart';
Future<void> main(List<String> arguments) async {
Uri? coverageUri;
for (String argument in arguments) {
if (argument.startsWith("--coverage=")) {
coverageUri = Uri.base
.resolveUri(Uri.file(argument.substring("--coverage=".length)));
} else {
throw "Unsupported argument: $argument";
}
}
if (coverageUri == null) {
throw "Need --coverage=<dir>/ argument";
}
Directory tmp =
Directory.systemTemp.createTempSync("compile_platform_coverage");
String outlinePath = tmp.uri.resolve("vm_outline_strong.dill").toFilePath();
String platformPath = tmp.uri.resolve("vm_platform_strong.dill").toFilePath();
await compilePlatformEntryPoint([
"dart:core",
"-Ddart.vm.product=false",
"-Ddart.isVM=true",
"--nnbd-strong",
"--single-root-scheme=org-dartlang-sdk",
"--single-root-base=.",
"org-dartlang-sdk:///sdk/lib/libraries.json",
outlinePath,
platformPath,
outlinePath,
]);
tmp.deleteSync(recursive: true);
const String displayName = "compile platform";
File f = new File.fromUri(coverageUri.resolve("$displayName.coverage"));
// Force compiling seems to add something like 1 second to the collection
// time, but we get rid of uncompiled functions so it seems to be worth it.
(await collectCoverage(displayName: displayName, forceCompile: true))
?.writeToFile(f);
}