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
+9 -1
View File
@@ -13,7 +13,6 @@ jobs:
KEY_PATH: ${{ github.workspace }}/apps/weblibre/key.jks
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
ANDROID_NDK_VERSION: 28.2.13676358
permissions:
contents: write
steps:
@@ -41,6 +40,14 @@ jobs:
- name: Install Android NDK
run: |
set -euo pipefail
ANDROID_NDK_VERSION="$(
sed -n 's/^weblibre\.ndkVersion[[:space:]]*=[[:space:]]*//p' \
apps/weblibre/android/gradle.properties
)"
if [[ -z "$ANDROID_NDK_VERSION" ]]; then
echo "Missing weblibre.ndkVersion in apps/weblibre/android/gradle.properties" >&2
exit 1
fi
set +e
yes | "$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" --install "ndk;$ANDROID_NDK_VERSION"
sdkmanager_status=${PIPESTATUS[1]}
@@ -50,6 +57,7 @@ jobs:
fi
test -f "$ANDROID_HOME/ndk/$ANDROID_NDK_VERSION/source.properties"
{
echo "ANDROID_NDK_VERSION=$ANDROID_NDK_VERSION"
echo "ANDROID_NDK_HOME=$ANDROID_HOME/ndk/$ANDROID_NDK_VERSION"
echo "ANDROID_NDK_ROOT=$ANDROID_HOME/ndk/$ANDROID_NDK_VERSION"
echo "NDK_HOME=$ANDROID_HOME/ndk/$ANDROID_NDK_VERSION"
+1 -1
View File
@@ -2,7 +2,7 @@
ext {
compileSdkVersion = 36
targetSdkVersion = 36
ndkVersion = "28.2.13676358"
ndkVersion = providers.gradleProperty("weblibre.ndkVersion").get()
}
buildscript {
+1
View File
@@ -1,4 +1,5 @@
org.gradle.jvmargs=-Xmx4G -XX:+HeapDumpOnOutOfMemoryError
weblibre.ndkVersion=28.2.13676358
android.useAndroidX=true
android.enableJetifier=true
# This builtInKotlin flag was added automatically by Flutter migrator
+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