Testing Fuchsia SDK changes

You may want to experiment with Fuchsia SDK changes in a Flutter component before submitting them to fuchsia.git, for example to validate a new UI API in the SDK with a Flutter component that uses that API.

This is a workflow for making local changes to the Fuchsia SDK and testing those changes in flutter-embedder.git.

Requirements

  1. Get a Fuchsia source checkout here.

  2. Set up your Fuchsia build. For example for Workstation on emulator:

    cd $FUCHSIA_DIR
    fx set workstation_eng.qemu-x64
    
  3. Configure IPv6 networking for Fuchsia (reference):

    sudo ip tuntap add dev qemu mode tap user $USER
    sudo ip link set qemu up
    
  4. Set $LOCAL_FUCHSIA_PLATFORM_BUILD to your out directory for your Fuchsia build. For example:

    export LOCAL_FUCHSIA_PLATFORM_BUILD=$FUCHSIA_DIR/out/default
    

Workflow

  1. Make your platform changes to the Fuchsia checkout that $LOCAL_FUCHSIA_PLATFORM_BUILD points to.

  2. Build Fuchsia and start the emulator in TAP mode.

    cd $LOCAL_FUCHSIA_PLATFORM_BUILD
    fx build
    fx ffx emu start --net tap
    
  3. Run an example using --with-fuchsia to build the embedder against $LOCAL_FUCHSIA_PLATFORM_BUILD's Fuchsia SDK.

    $FUCHSIA_EMBEDDER_DIR/scripts/build_and_run_example.sh hello_flutter --with-fuchsia
    

    See this guide for the full list of options that can be passed to build_and_run_example.sh.

  4. To iterate on changes ...

    • ... to only flutter-embedder.git, you can re-run step 3.
    • ... to only internal fuchsia.git code, you can re-run step 2.
    • ... to Fuchsia SDK code (third_party/fuchsia/sdk), you need to re-run steps 2 and 3.

Switching back to the prebuilt Fuchsia SDK

If you want to switch back to working with flutter-embedder's prebuilt Fuchsia SDK and Fuchsia images instead of the local one, run:

unset $LOCAL_FUCHSIA_PLATFORM_BUILD
$FUCHSIA_EMBEDDER_DIR/tools/bazel sync --configure