Files
tsunagi/android/app/build.gradle
T
Aleksandr Bogomiakov ef67e1c0ae Add a Rust Android mesh client with shared tray views
Run one agent for all joined networks behind Android's VPN service. Share
transport registration and reporting with the CLI, and move the tray's
egui forms into a Rust UI crate. Phones use compact device rows and a
full-width exit picker with RTT and data path. All four transports retain
their per-network selection and priority. The phone consumes remote IPv4
exits and keeps the existing desktop identity and wire protocols.

Send discovery and transport traffic over the physical network and bind
VIP TCP health checks to the mesh. Build local DNS zones from the same
signed membership and VIP records on desktop and Android. Answer UDP and
TCP queries on the VPN, keep unknown mesh names local, and resolve public
names through Android's underlying resolver, including with an exit.

Show an ongoing notification for the selected exit. Guard its disconnect
action against a stale selection and keep mesh routing and DNS alive when
it removes the default route. Remove the app notification in mesh-only
mode. Document Android 14's unlocked-device swipe behavior.

Checked formatting and ran locked all-target workspace Clippy with
warnings denied and tests on macOS (547 passed, 2 ignored). Built the
arm64 debug APK. A physical Pixel resolved a mesh member and a Kubernetes
VIP, answered UDP and TCP DNS, and reached the API over TLS (HTTP 401
without credentials). On a separate Android emulator the notification
action removed the default route and notice while mesh DNS still worked.
2026-11-24 17:28:23 +02:00

60 lines
2.2 KiB
Groovy

import groovy.json.JsonSlurper
plugins { id 'com.android.application' version '9.2.1' }
def workspace = rootProject.projectDir.parentFile
def abi = 'arm64-v8a'
android {
namespace 'cy.hexor.tsunagi'
compileSdk 35
// Cargo also builds standalone cdylibs for these dependencies. Their code
// is linked into tsunagi_android; the JVM loads only the application library.
packaging.jniLibs.excludes += ['**/libboringtun.so', '**/libiroh.so', '**/libiroh_relay.so']
defaultConfig {
applicationId 'cy.hexor.tsunagi'
minSdk 26
targetSdk 35
versionCode 1
versionName '1.0.0'
ndk { abiFilters abi }
}
}
// rustls ships its Android trust manager as an AAR in the locked Cargo package.
def metadata = providers.exec {
workingDir workspace
commandLine 'cargo', 'metadata', '--locked', '--format-version', '1', '--filter-platform', 'aarch64-linux-android'
}.standardOutput.asText.get()
def verifier = new JsonSlurper().parseText(metadata).packages.find { it.name == 'rustls-platform-verifier-android' }
repositories {
maven {
url new File(new File(verifier.manifest_path).parent, 'maven')
metadataSources { mavenPom() }
content { includeModule 'rustls', 'rustls-platform-verifier' }
}
google()
mavenCentral()
}
dependencies { implementation "rustls:rustls-platform-verifier:${verifier.version}" }
abstract class BuildRust extends Exec {
@OutputDirectory abstract DirectoryProperty getJniLibs()
}
androidComponents.onVariants(androidComponents.selector().all()) { variant ->
def mode = variant.buildType
def libs = layout.buildDirectory.dir("generated/rust/${mode}")
def nativeBuild = tasks.register("cargo${mode.capitalize()}", BuildRust) {
workingDir workspace
inputs.files(fileTree(workspace) {
include 'Cargo.toml', 'Cargo.lock', '.cargo/**', 'crates/**/Cargo.toml', 'crates/**/src/**', 'vendor/**'
})
jniLibs.set(libs)
commandLine 'cargo', 'ndk', '--target', abi, '--platform', '26', '-o', libs.get().asFile,
'build', '--locked', '--lib', '-p', 'tsunagi-android'
if (mode == 'release') args '--release'
}
variant.sources.jniLibs.addGeneratedSourceDirectory(nativeBuild) { it.jniLibs }
}