-
Notifications
You must be signed in to change notification settings - Fork 6k
Add dart_executable gn rule #52241
Add dart_executable gn rule #52241
Conversation
612f2e2
to
41a5400
Compare
args = [] | ||
metadata = { | ||
action_type = [ "dart_executable" ] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll need to send a patch upstream to copy this over onto the underlying action
target in the dart_action
template.
fc7ba2c
to
827f0a2
Compare
} | ||
|
||
abs_output = rebase_path(output) | ||
exe_vm_args += [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how it's spelled, but we'll want to pass the flag here that disables analytics/telemetry.
|
||
abs_output = rebase_path(output) | ||
exe_vm_args += [ | ||
"compile", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does dart compile exe
run pub
? If so, we'll need a way to keep it from touching the network.
Does dart compile exe
have a flag that causes it to dump a depfile like flutter_frontend_server does? See https://github.com/flutter/engine/blob/main/build/dart/rules.gni#L71. Without that, GN won't do dependency tracking correctly. You might be able to see that in this PR by editing et
source files, and seeing that rebuilds might not happen when you need them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does dart compile exe run pub?
That's a good question. I haven't looked at the implementation. My guess is probably, which we should avoid. Will take a look.
Does dart compile exe have a flag that causes it to dump a depfile like flutter_frontend_server does?
Not one that's documented (even with -v -v
set). This patch is still a draft experiment to test the general concept/tool integration. It should work even if we swap out the implementation with an invocation of dart_snapshot
(wrapped with a launch script) instead, that approach does support --depfile
(and is already implemented above). Will play with that a little.
# | ||
# deps (optional): | ||
# Additional dependencies. Dependencies on the frontend server and | ||
# Flutter's platform.dill are included by default. This rule creates and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't create a depfile as written =)
827f0a2
to
07b54c5
Compare
(triage): I spoke to @cbracken and this is still on his radar. It needs some small tweaks to land. |
07b54c5
to
fb747aa
Compare
Adds a dart_executable rule that compiles Dart code to an ELF, Mach-O, or PE binary. Can be used to build tools written in Dart, or Dart unit tests. Issue: flutter/flutter#147013
fb747aa
to
513dc77
Compare
Closing this as @matanlurey is picking this one up, starting with #55404. |
…#55475) Closes flutter/flutter#155769. This is a variant of the approach in #52241, based on feedback from @jakemac53 and @jonahwilliams (who originally sped up `dart test` significantly by using `frontend_server` under the scenes: dart-lang/test#1399), in short: ```gn # tools/engine_tool/BUILD.gn import("//flutter/build/dart/internal/gen_dartcli_call.gni") gen_dartcli_call("tests") { args = [ "test" ] cwd = "//flutter/tools/engine_tool" } ``` This stanza, when built (`ninja -C ../out/host_debug flutter/tools/engine_tool:tests`) generates the following file: ```sh # ../out/host_debug/gen/flutter/tools/engine_tool/tests set -e # Needed because if it is set, cd may print the path it changed to. unset CDPATH # Store the current working directory. prev_cwd=$(pwd) # Set a trap to restore the working directory. trap 'cd "$prev_cwd"' EXIT CD_PATH="/Users/matanl/Developer/engine/src/flutter/tools/engine_tool" if [ -n "$CD_PATH" ]; then cd "$CD_PATH" fi /Users/matanl/Developer/engine/src/flutter/prebuilts/macos-arm64/dart-sdk/bin/dart "test" ``` In turn, when executed (`../out/host_debug/gen/flutter/tools/engine_tool/tests`) it just runs `dart test`: ```sh flutter % ../out/host_debug/gen/flutter/tools/engine_tool/tests Building package executable... Built test:test. 00:00 +0: test/test_command_test.dart: test command executes test 00:00 +3: test/run_command_test.dart: run command invokes flutter run ... 00:00 +117: All tests passed! ``` There is no actual compilation performed by the tool (that is handled implicitly by `dart test`), and as a result neither a `depfile` is needed, nor generating a pre-compiled artifact like a snapshot or AOT elf/assembly. --- This work is incomplete, that is, we'd want to properly tag the executable so `et` can find it, and create a wrapper template (i.e. `dart_test`) that tightens things up a bit, but I wanted to show the work at this intermediate step to get feedback before moving forward. /cc @jonahwilliams, @jtmcdole as well.
Adds a dart_executable rule that compiles Dart code to an ELF, Mach-O, or PE binary. Can be used to build tools written in Dart, or Dart unit tests.
Issue: flutter/flutter#147013
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.