Add support for expression evaluation in Frontend Server + Build Daemon environment#4898
Add support for expression evaluation in Frontend Server + Build Daemon environment#4898Markzipan wants to merge 32 commits into
Conversation
…alize frontend server startup
PR HealthChangelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs. This check can be disabled by tagging the PR with |
|
At first glance I'm struggling to see how this is a good direction to take: let's discuss? The web builds already have to do lots of workarounds to use build_runner, they are not at all using it like all the other builders do. So when adding more support for web, I think we want one of:
adding expression evaluation details to build_daemon and build_runner doesn't seem to fit that. I think maybe the core feature is to be able to find and use the frontend server that's already started by the web build? If I correctly understood what the So it looks to me like something else should manage the frontend server and its reuse. Maybe new code in frontend server client? Then the frontend server will start either on the first expression evaluation or the first build, and be reused after ways. If build_runner needs new general support for startup/shutdown to make this work well then that's the kind of feature I'd be up for adding. Of course, I can be persuaded of anything that makes sense ;) happy to VC, I could do Thu morning for you / evening for me. |
|
Thanks! I'm very open to taking this in a new direction; this is just a working initial implementation to illustrate DDC's reqs. The major requirements here are just:
Re: the the web build not starting frontend server early enough, this is only an issue since the frontend server chooses a port dynamically. If we start it late (in a builder), we don't have an easy way to connect with it (especially since we can't read/write one-off files). Moving this to frontend_server_client makes logical sense, but we'd still need the host process to be able to receive messages to satisfy 2). One option could be to introduce a "Frontend Server Manager" process that we spin up early (perhaps in webdev) whose presence enables expression eval. We can continue spinning up an isolated FES in the builder if that earlier instance wasn't detected/passed in. That way the build system remains mostly unchanged (bar somehow passing a FES port and allowing a 'magic' API for socket comms). I can throw an early meeting on your calendar tomorrow 🙏🙏 |
|
Yup yup, let's chat. Thanks! |
|
This is looking promising--please let me know when it's ready for review :) |
Package publishing
Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation. |
|
I've updated the description and approach. The TL;DR from earlier is that I've moved a lot of the webdev/build_daemon comms to a separate pkg |
|
Thanks! A couple of high level questions. There is still About the new package Actually looking at users of these packages, build_modules and scratch_space are already pretty much private to webdev https://pub.dev/packages?q=dependency%3Abuild_modules ... I would consider merging them into build_web_compilers, and saying that as a library it's only intended for use by webdev + jaspr. And then build_frontend_server as well. I found it useful to merge build_runner_core and build_resolver into build_runner, it makes releasing much easier! |
Woops - I forgot to remove that from the desc!
It's not intended for general use, but anyone who wants to support a Dart web client that supports expression eval (or other frontend server-related functionality) would need. So far that's Lemme try to merge these together. Part 1: #4918 |
|
I guess I reviewed the |
|
🙃 🙃 @davidmorgan Thanks for review! That one was for easier diff-ing. I opened a new one on the main branch: #4922 |
Notable Changes:
builder_pkgs/build_frontend_server, which handles aspects of the build system related to the Frontend Server.fes_manager.dartcan be started bywebdev, after which its state will be shared with the build system. If not supplied, the build system with init FES itself (as usual).fesWorkerPortPath).To support tests:
ScratchSpace.existingto create a scratch space from a pre-existing directory.scratch-space-dirto specify the directory forscratch_spaceinbuild_daemon.Pardon the large PR, but most of this is tests and copying expression eval APIs. The meat is the comms/API between the persistent Frontend Server and Build Daemon / Builder.