Skip to content

Commit b0fa0ae

Browse files
aamcommit-bot@chromium.org
authored andcommitted
[build] Ensure kernel service trains on the source.
This is follow-up to https://dart-review.googlesource.com/c/sdk/+/117286. Fixes dartbug.com/38427. Change-Id: I8e3227addf459577e5126e9c48d1cb95b170157a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/117464 Commit-Queue: Alexander Aprelev <[email protected]> Reviewed-by: Ryan Macnak <[email protected]> Reviewed-by: Alexander Markov <[email protected]>
1 parent d4fd853 commit b0fa0ae

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

pkg/vm/lib/frontend_server.dart

+6-2
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,11 @@ Future<int> starter(
902902
}
903903

904904
if (options['train']) {
905+
if (options.rest.isEmpty) {
906+
throw Exception('Must specify input.dart');
907+
}
908+
909+
final String input = options.rest[0];
905910
final String sdkRoot = options['sdk-root'];
906911
final String platform = options['platform'];
907912
final Directory temp =
@@ -920,8 +925,7 @@ Future<int> starter(
920925
compiler ??=
921926
new FrontendCompiler(output, printerFactory: binaryPrinterFactory);
922927

923-
await compiler.compile(Platform.script.toFilePath(), options,
924-
generator: generator);
928+
await compiler.compile(input, options, generator: generator);
925929
compiler.acceptLastDelta();
926930
await compiler.recompileDelta();
927931
compiler.acceptLastDelta();

pkg/vm/test/frontend_server_test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Future<int> main() async {
2828
final CompilerInterface compiler = new _MockedCompiler();
2929

3030
test('train with mocked compiler completes', () async {
31-
await starter(<String>['--train'], compiler: compiler);
31+
await starter(<String>['--train', 'foo.dart'], compiler: compiler);
3232
});
3333
});
3434

utils/kernel-service/BUILD.gn

+2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ kernel_application_snapshot("kernel-service_snapshot") {
2929
]
3030
training_args = [
3131
"--train",
32+
3233
# Force triple-slashes both on Windows and otherwise.
3334
# Becomes e.g. file:///full/path/to/file and "file:///C:/full/path/to/file.
3435
# Without the ', "/"' part, on Linux it would get four slashes.
@@ -62,6 +63,7 @@ application_snapshot("frontend_server") {
6263
"--train",
6364
"--sdk-root=$sdk_root/",
6465
"--platform=$sdk_root/vm_platform_strong.dill",
66+
rebase_path(main_dart),
6567
]
6668
output = "$root_out_dir/frontend_server.dart.snapshot"
6769
}

0 commit comments

Comments
 (0)