Files
moonlight-android/justfile
T
Oleks 3319749c0d justfile: add install-tv for Chromecast with Google TV (network adb over WiFi)
Adds an adb variable (from nixpkgs android-tools), an install-tv <ip> recipe
that adb-connects to :5555 and installs the debug APK, and tv-disconnect.
2026-05-29 18:20:28 +03:00

60 lines
2.2 KiB
Makefile

# moonlight-android — task runner (https://github.com/casey/just)
#
# Wraps the Nix flake (devShell + hermetic nonRoot debug APK build). Two flake
# gotchas are baked in so `just <recipe>` just works:
# * `?submodules=1` — the build needs the moonlight-common-c + enet submodule
# sources, which Nix only includes when the flake is fetched with submodules.
# * `--builders ""` — force a LOCAL build. Without it the Android SDK/NDK
# closure (multi-GB) gets copied to the remote builder (eu.nixbuild.net),
# which is far slower than building here where the SDK is already realised.
pkg := ".?submodules=1#moonlight-android"
build_flags := "--builders '' --print-build-logs"
# adb from nixpkgs (no system install needed). The adb server daemon persists
# between invocations, so `connect` in one recipe line carries to the next.
adb := "nix run nixpkgs#android-tools -- adb"
# list available recipes
default:
@just --list
# enter the dev shell (JDK 17 + Android SDK 34 / NDK 27 + Gradle), then e.g. ./gradlew assembleNonRootDebug
dev:
nix develop '.?submodules=1'
# build the nonRoot debug APK -> ./result/app-nonRoot-debug.apk
build:
nix build '{{ pkg }}' {{ build_flags }}
# build and print the resulting APK path
apk: build
@ls -l result/app-nonRoot-debug.apk
# install the built debug APK onto a USB-connected device/emulator (needs USB debugging)
install: build
{{ adb }} install -r result/app-nonRoot-debug.apk
# install over WiFi to a Chromecast with Google TV (enable Developer options -> USB debugging first): just install-tv 192.168.1.x
install-tv ip: build
{{ adb }} connect {{ ip }}:5555
{{ adb }} -s {{ ip }}:5555 install -r result/app-nonRoot-debug.apk
@echo "Installed. Launch Moonlight from the TV's app list (apps row / 'See all apps')."
# disconnect a network adb device (e.g. the TV) when done
tv-disconnect ip:
{{ adb }} disconnect {{ ip }}:5555
# regenerate the offline Maven lockfile (deps.json) after changing dependencies
deps:
nix build '.?submodules=1#moonlight-android.mitmCache.updateScript'
./result
# evaluate the flake without building (catches eval errors fast)
check:
nix flake check '.?submodules=1' --no-build
# remove the build result symlink
clean:
rm -f result