[embedder] register clang toolchain in workspace.bazel

Change-Id: I1827399eff306d376d8d075d7873de738e2fc0fd
Reviewed-on: https://fuchsia-review.googlesource.com/c/flutter-embedder/+/738382
Reviewed-by: Naud Ghebre <naudzghebre@google.com>
Reviewed-by: Alexander Biggs <akbiggs@google.com>
1 file changed
tree: 7bc4db0ceb907ebce6032338c4e65dfe30b11c1c
  1. docs/
  2. hooks/
  3. scripts/
  4. src/
  5. third_party/
  6. tools/
  7. .bazelrc
  8. .clang-format
  9. .editorconfig
  10. .gitignore
  11. .gitmodules
  12. AUTHORS
  13. CONTRIBUTING.md
  14. LICENSE
  15. OWNERS
  16. PATENTS
  17. README.md
  18. SETUP_WINDOWS.md
  19. WORKSPACE.bazel
README.md

flutter-embedder.git

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.

Requirements

If you're using WSL2 (Windows Subsystem for Linux), see SETUP_WINDOWS.md first.

  1. Set $FUCHSIA_EMBEDDER_DIR to your flutter-embedder.git checkout location, for example ~/flutter-embedder.

    export FUCHSIA_EMBEDDER_DIR=$HOME/flutter-embedder
    
  2. 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.

Run an example app

  1. 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).

  2. Set the default target in ffx to be fuchsia-emulator:

    $FUCHSIA_EMBEDDER_DIR/tools/ffx target default set fuchsia-emulator
    
  3. 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.

      TODO(akbiggs): Work with Bazel SDK team to get proper support for --fidl.

TODO(akbiggs): The app occasionally gets stuck on a loading screen instead of rendering. Re-running the app usually fixes it. We need to fix this.

Making Flutter Engine changes

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.

Uploading changes for review.

See git_workflow.md.