commit | 0229a7572cb3c99c36d820d49f5c0a49ff2e14df | [log] [tgz] |
---|---|---|
author | Alexander Biggs <akbiggs@google.com> | Fri Oct 21 20:42:09 2022 +0000 |
committer | Alexander Biggs <akbiggs@google.com> | Fri Oct 21 20:42:09 2022 +0000 |
tree | 6c54ecc277edd3c013652df030919f90325e3713 | |
parent | 6cf849b1803df851381f3ebbe4b044a6a7e2141f [diff] |
[embedder] Use engine in third_party. This changes the Flutter Engine workflow in the embedder repo to use a checkout of Flutter Engine at third_party/engine instead of $ENGINE_DIR. This makes it easier to juggle working on the engine code with working on the embedder code, because the hacks live in third_party/engine instead of your $ENGINE_DIR. - Renames sync_engine_artifacts_to_revision.sh --> sync_engine_to_revision.sh and drops the building and copying logic. This lets the script be used in contexts where we just want to fetch the Flutter Engine (for example during initial setup). - Adds setup_engine.sh script that fetches third_party/engine. This isn't necessary for all workflows in the embedder, so it's separate from bootstrap.sh. - Updates the instructions for working with the Flutter Engine. Change-Id: I03cfb00c85f346452de9ff11cbdb217fa403e0c2 Reviewed-on: https://fuchsia-review.googlesource.com/c/flutter-embedder/+/743590 Reviewed-by: Ben Bergkamp <benbergkamp@google.com>
The Flutter Embedder for Fuchsia is a new in-progress runtime for Flutter apps on Fuchsia. This runtime is built on top of Flutter's embedder platform.
This repository is a work in progress and should be considered experimental.
If you're using WSL2 (Windows Subsystem for Linux), see SETUP_WINDOWS.md first.
Set $FUCHSIA_EMBEDDER_DIR
to your flutter-embedder.git checkout location, for example ~/flutter-embedder
.
export FUCHSIA_EMBEDDER_DIR=$HOME/flutter-embedder
Bootstrap the repository's dependencies:
$FUCHSIA_EMBEDDER_DIR/scripts/bootstrap.sh
This script initializes tools (including bazel
and ffx
), installs some Git hooks and downloads the workstation_eng.qemu-x64
product bundle, which you can use to run the examples below.
Start the emulator.
If running in a graphical environment:
$FUCHSIA_EMBEDDER_DIR/tools/ffx emu start workstation_eng.qemu-x64
If running in a terminal environment:
$FUCHSIA_EMBEDDER_DIR/tools/ffx emu start --headless workstation_eng.qemu-x64
The workflow below also supports Fuchsia builds from source that are within Fuchsia's SDK compatibility window (six weeks).
Set the default target in ffx to be fuchsia-emulator
:
$FUCHSIA_EMBEDDER_DIR/tools/ffx target default set fuchsia-emulator
Run an example component:
$FUCHSIA_EMBEDDER_DIR/scripts/build_and_run_example.sh hello_flutter
To watch logs for the example component, run:
$FUCHSIA_EMBEDDER_DIR/scripts/build_and_run_example.sh hello_flutter --log
If you want to watch all logs, run $FUCHSIA_EMBEDDER_DIR/tools/ffx log
in a separate terminal.
To watch FIDL calls for the example component, run:
$FUCHSIA_EMBEDDER_DIR/scripts/build_and_run_example.sh hello_flutter --fidl
Caveats:
--fidl
currently requires setting $FUCHSIA_DIR
to a Fuchsia source checkout with a build in $FUCHSIA_DIR/out/default
. This directory is only used to read IR files for FIDL, you can still use the workstation_eng.qemu-x64
product bundle with --fidl
.
--fidl
attaches after the component has been run, so it does not pick up FIDL calls made when the component starts.
To attach a debugger to the example component, see debugging.md
TODO(akbiggs): Work with Bazel SDK team to get proper support for --fidl
.
Running the Flutter app is handled by the Flutter Engine's embedder platform code. This code is compiled into a shared library called libflutter_engine.so
, which we can interact with using the embedder.h
header.
If you need to make changes to this Flutter Engine code (for example for testing a new API in embedder.h
with this embedder) see making_engine_changes.md
for instructions. This isn‘t required for changes to only flutter-embedder.git’s source code.
See git_workflow.md
.