commit | 352290aaba06e1a7f82cb6203a3c383b4d398ff1 | [log] [tgz] |
---|---|---|
author | Alexander Biggs <akbiggs@google.com> | Wed May 11 00:06:58 2022 +0000 |
committer | Alexander Biggs <akbiggs@google.com> | Wed May 11 00:06:58 2022 +0000 |
tree | ba6b95ab005076faeca4905298f5c995dd48a745 | |
parent | 2b1f43703322b66f1e24e265451e7003045f451c [diff] |
[embedder] Copy code from workstation.git. This gives us a basic embedder executable and some build rules to run a Flutter sample app. However the app crashes on startup with the product bundle workflow due to not having an ambient_mark_vmo_exec allowlist entry. We are talking with security to figure out how to handle this. In addition I added a script to sync Engine artifacts to a new revision since copying changes over was a pain. Bug: 46971 Change-Id: Ic7f361862b878cee9faddffafbd89fce64dca403
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.
Install a Bazel version no older than the one defined in the WORKSPACE.bazel file, by following the instructions at https://bazel.build/install. In some Linux distributions, sudo apt-get install bazel
should be enough.
Make sure this repository has the required submodules:
git submodule update --recursive --init
Ensure that there are Fuchsia SSH keys in your host machine. You will need them for running the Fuchsia emulator.
[[ -f "${HOME}/.ssh/fuchsia_ed25519" ]] || ssh-keygen -P "" -t ed25519 -f "${HOME}/.ssh/fuchsia_ed25519" -C "${USER}@$(hostname -f) Shared SSH Key for Fuchsia" [[ -f "${HOME}/.ssh/fuchsia_authorized_keys" ]] || ssh-keygen -y -f "${HOME}/.ssh/fuchsia_ed25519" > "${HOME}/.ssh/fuchsia_authorized_keys"
You will need the Flutter tool in your PATH. For example if your Flutter framework source checkout is at ~/flutter
, add the following to your ~/.zprofile
for zsh
or ~/.bash_profile
for bash
:
export PATH=~/flutter/bin:$PATH
TODO(akbiggs): Get rid of the dependency on the Flutter tool by using Bazel build rules to build the Flutter app instead.
Now the repository is ready to build the sample.
Fetch an emulator image and start an emulator:
tools/ffx product-bundle get workstation.qemu-x64 tools/ffx emu start --headless workstation.qemu-x64
(optional) Watch the device log in a separate window:
tools/ffx log
Run the sample app component:
scripts/build_and_run_sample_app.sh
TODO(akbiggs): Currently the component crashes on startup with an ambient_mark_vmo_exec
allowlist issue. We are talking to security to figure out how to handle this.
Occasionally you will need to update the Flutter Engine artifacts (embedder.h and libengine_flutter.so) that are used by the embedder to run Flutter apps. A script is provided for this workflow.
$ENGINE_DIR
should be set to the src
folder of your Flutter Engine checkout, for example ~/engine/src
.$FUCHSIA_EMBEDDER_DIR
should be set to your flutter-embedder.git checkout, for example ~/flutter-embedder
.$DEPOT_TOOLS
should be set to your depot_tools
location, for example ~/depot_tools
.git stash
or git commit
any local changes to the Flutter Engine or the script will fail.You can run the script with a flutter/engine
Git commit to sync the Engine artifacts to that revision.
scripts/sync_engine_artifacts_to_revision.sh <ENGINE_COMMIT_SHA>
A common workflow is to sync your Engine commit to your Flutter tool. If your Flutter tool lives at ~/flutter/bin/flutter
, you can do cat ~/flutter/bin/internal/engine.version
to get your Flutter tool's Engine commit.