-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
- Write a
tool_executable(name TBD) rule that generates a shell (and later, batch, for Windows) inout/
- [ ] Write adart_snapshotrule that generates a [kernel snapshot]1 and depfile for a given Dart entrypoint - Write a
dart_testrule that generates atool_executableandand usesdart_snapshot,dart testto run a file
Working on #147013 and wanted to write out some of my thoughts to explain what I think needs to get done, and why it will take a different path the @cbracken's original PR, flutter/engine#52241, and need (likely 1-2 PRs) foundational work as a starting step.
We'd like to get to a world where (something) like the following can be written:
# //flutter/tools/engine_tool/BUILD.gn
import("//flutter/build/dart/rules.gni")
dart_test_suite("tests") {
sources = ["test/**/*_test.dart"],
}But let's break that down a bit, and make it more verbose to make it more understandable:
# //flutter/tools/engine_tool/BUILD.gn
import("//flutter/build/dart/rules.gni")
dart_test("build_command_test") {
script = "test/build_command_test.dart",
}
dart_test("utils_test") {
script = "test/utils_test.dart",
}
dart_test("worker_pool_test") {
script = "test/worker_pool_test.dart",
}Ok, now one step further, what does/would et test //flutter/tools/engine_tool:build_command_test do?
-
Generate a
build_command_test.depfile(and as a side-effect, snapshot) -
Generate a
build_command_test.shfile that has contents something like:#!/bin/bash set -e pushd {{WORKING_DIR}} {{DART_BINARY}} test test/build_command_test.dart popd
-
Runs a ninja build that builds (1) and (2)
-
Runs the executable output by (2), i.e.
../out/host_debug/build_command_test.sh(or whatever)
/cc @jonahwilliams @cbracken @jakemac53 @johnmccutchan
Footnotes
-
Technically the snapshot is not needed, and we could work with the VM team to skip if it would improve build times. ↩