| # 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](https://fuchsia.dev/fuchsia-src/get-started/get_fuchsia_source). |
| |
| 2. Set up your Fuchsia build. For example for Workstation on emulator: |
| |
| ```sh |
| cd $FUCHSIA_DIR |
| fx set workstation_eng.qemu-x64 |
| ``` |
| |
| 3. 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. |
| |
| ```sh |
| cd $LOCAL_FUCHSIA_PLATFORM_BUILD |
| fx build |
| fx ffx emu start |
| ``` |
| |
| 3. Run an example using `--with-fuchsia` to build the embedder against |
| `$LOCAL_FUCHSIA_PLATFORM_BUILD`'s Fuchsia SDK. |
| |
| ```sh |
| $FUCHSIA_EMBEDDER_DIR/scripts/build_and_run_example.sh hello_flutter --with-fuchsia |
| ``` |
| |
| See |
| [this guide](https://fuchsia.googlesource.com/flutter-embedder/+/refs/heads/main/README.md#run-an-example-app) |
| 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: |
| |
| ```sh |
| unset $LOCAL_FUCHSIA_PLATFORM_BUILD |
| $FUCHSIA_EMBEDDER_DIR/tools/bazel configure --sync |
| ``` |