define ndk in gradle props

This commit is contained in:
Fabian Freund
2026-05-26 18:57:26 +02:00
parent 7bbdf172ba
commit 7e3c933bef
5 changed files with 26 additions and 6 deletions
+4 -3
View File
@@ -39,6 +39,7 @@ The output AAR is written to `native/go_mobile_runtime/build/weblibre-go.aar`.
GitHub release builds clone the pinned sources from `pins.env` and run the same
Melos command before building the Flutter APK/AAB artifacts. The app Gradle
build and CI native runtime build both use Android NDK r28c (`28.2.13676358`),
matching Flutter 3.44's default NDK. This is new enough for the `cronet-go`
Android arm64 archives linked by sing-box's naive outbound path.
build and CI native runtime build both read `weblibre.ndkVersion` from
`apps/weblibre/android/gradle.properties`; it is currently Android NDK r28c
(`28.2.13676358`), matching Flutter 3.44's default NDK. This is new enough for
the `cronet-go` Android arm64 archives linked by sing-box's naive outbound path.
@@ -9,6 +9,11 @@ REPO_ROOT="$(cd "$RUNTIME_DIR/../.." && pwd -P)"
# shellcheck source=../pins.env
source "$RUNTIME_DIR/pins.env"
GRADLE_PROPERTIES="$REPO_ROOT/apps/weblibre/android/gradle.properties"
DEFAULT_ANDROID_NDK_VERSION="$(
sed -n 's/^weblibre\.ndkVersion[[:space:]]*=[[:space:]]*//p' "$GRADLE_PROPERTIES"
)"
DEFAULT_SING_BOX_SOURCE="$(cd "$REPO_ROOT/.." && pwd -P)/sing-box"
DEFAULT_IPTPROXY_SOURCE="$(cd "$REPO_ROOT/.." && pwd -P)/IPtProxy"
@@ -18,7 +23,7 @@ DNSTT_SOURCE="${DNSTT_SOURCE:-$IPTPROXY_SOURCE/dnstt}"
OUTPUT_AAR="${OUTPUT_AAR:-$RUNTIME_DIR/build/weblibre-go.aar}"
TARGET="${TARGET:-android}"
ANDROID_API="${ANDROID_API:-24}"
ANDROID_NDK_VERSION="${ANDROID_NDK_VERSION:-28.2.13676358}"
ANDROID_NDK_VERSION="${ANDROID_NDK_VERSION:-$DEFAULT_ANDROID_NDK_VERSION}"
INSTALL_GOMOBILE=1
ALLOW_DIRTY=0
DEBUG=0
@@ -193,6 +198,11 @@ if ! command -v go >/dev/null 2>&1; then
exit 1
fi
if [[ -z "$ANDROID_NDK_VERSION" ]]; then
echo "Missing weblibre.ndkVersion in $GRADLE_PROPERTIES." >&2
exit 1
fi
if [[ -z "${ANDROID_HOME:-}" && -d "$HOME/Android/Sdk" ]]; then
export ANDROID_HOME="$HOME/Android/Sdk"
fi