[build] Add fuchsia_builder_group target

This is a top-level target which provides an abstraction layer for the
infrastructure to perform builds.

Bug: 112403
Change-Id: I8997771d9d8aadfb012a4c2e461a725b54006c09
3 files changed
tree: a3c6b360446da56986f8932eedd113deeb79e48b
  1. scripts/
  2. src/
  3. third_party/
  4. tools/
  5. .bazelrc
  6. .gitignore
  7. .gitmodules
  8. AUTHORS
  9. BUILD.bazel
  10. CONTRIBUTING.md
  11. LICENSE
  12. OWNERS
  13. PATENTS
  14. README.md
  15. WORKSPACE.bazel
README.md

Fuchsia samples using the Fuchsia SDK with Rust

Note: Rust is not yet supported in the Fuchsia SDK.

This repository contains instructions and source code to build, package and run an example rust component which runs on Fuchsia using only the Fuchsia SDK.

Requirements

  1. Make sure this repository has the required submodules:

    git submodule update --recursive --init
    
  2. Run the bootstrap script that downloads the appropriate Bazel binary:

    scripts/bootstrap.sh
    
  3. 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"
    

Build, run and test the samples

Now the repository is ready to build the samples.

  1. Fetch the system images

    tools/ffx product-bundle get workstation_eng.qemu-x64 --repository workstation-repo
    

    Note: if the product-bundle command above fails with an error message that states that there are multiple product bundles with the same name, you can either specify the fully qualified URL as printed in the error message that corresponds to your SDK version (use tools/ffx sdk version if needed), or you can wipe out old and unused product bundles in the pbms storage, which should be located in ~/.local/share/Fuchsia/ffx/pbms on Linux, or ~/Library/Fuchsia/ffx/pbms on MacOS.

  2. Start the emulator

    tools/ffx emu start workstation_eng.qemu-x64 --headless
    
  3. The product bundle comes with on-demand packages in a separate repository. Use the following command to register it with the emulator:

    tools/ffx target repository register -r workstation-repo --alias fuchsia.com
    
  4. watch the device log in a separate window

    tools/ffx log --filter core/ffx-laboratory:hello_rust
    
  5. Run the hello world component

    tools/bazel run //src/hello_rust:pkg.component
    

    Watch in the log that the message “Hello, Rust!” is printed. Modify the Hello world message in src/hello_rust/src/main.rs, repeat this step and see that the log shows the new message.