Skip to content

Build & Deploy

Felix Hilgers edited this page Nov 26, 2024 · 2 revisions

Prerequisites

The easiest way to get all dependencies is to use the provided development shell in flake.nix. You can use a tool like direnv to automatically load the environment for this repository.

The shell will setup:

  • The rust nightly toolchain (nightly is required currently for ebpf because of the unstable build-std feature)
  • The bpf-linker
  • The Android SDK and NDK
  • The openjdk
  • The cargo-ndk package for compiling for rust for android
  • The protobuf programs for generating grpc server and client code

Build & Deploy

Client Application

The simplest way to build and test everything is the following command inside of frontend/:

./gradlew build

The apks for each build configuration are located in frontend/app/build/outputs/apk/.

To install the application configured to use the real backend on your device or emulator, run either ./gradlew app:installRealDebug or adb install path/to/real/app.apk

There are other flavors available, for example installMockDebug, for a frontend using fake data instead of the real backend. This is mainly interesting development purposes.

In order to view the full list of tasks configured in gradle, run

./gradlew tasks

Daemon

AIO deploy

If you'd like to build and run the daemon all in one command, you can use

cargo xtask daemon

After building this will ask you for root privileges to run the built executable.

By running

cargo xtask daemon --android

the executable won't start on your device but instead on an adb reachable android device or emulator by pushing it to /data/local/tmp/backend-daemon on the device and running it with root.

DIY deploy

To just build the daemon, run the following command inside of rust/ for your desired architecture:

AYA_BUILD_EBPF=true cargo ndk -t x86_64 build --package backend-daemon
AYA_BUILD_EBPF=true cargo ndk -t arm64-v8a build --package backend-daemon

You can then proceed to copy the executable (rust/target/debug/backend-daemon) to wherever you like and run it. You need root privileges in order to run it.

Clone this wiki locally