Compare commits
2 Commits
2026-08-31
...
ci-aab-nat
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0bf7f6b387 | ||
|
|
1ac5f0d7fa |
@@ -96,14 +96,28 @@ jobs:
|
|||||||
set -euxo pipefail
|
set -euxo pipefail
|
||||||
printf 'sdk.dir=%s/.android/sdk\n' "$HOME" > local.properties
|
printf 'sdk.dir=%s/.android/sdk\n' "$HOME" > local.properties
|
||||||
|
|
||||||
|
- name: Install Rust toolchain
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
set -euxo pipefail
|
||||||
|
if ! command -v cargo >/dev/null 2>&1; then
|
||||||
|
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal
|
||||||
|
fi
|
||||||
|
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
|
||||||
|
export PATH="$HOME/.cargo/bin:$PATH"
|
||||||
|
cargo --version
|
||||||
|
rustc --version
|
||||||
|
rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android
|
||||||
|
|
||||||
- name: Compile bundled native Git binaries
|
- name: Compile bundled native Git binaries
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
set -euxo pipefail
|
set -euxo pipefail
|
||||||
|
export PATH="$HOME/.cargo/bin:$PATH"
|
||||||
export ANDROID_SDK_ROOT="$HOME/.android/sdk"
|
export ANDROID_SDK_ROOT="$HOME/.android/sdk"
|
||||||
export ANDROID_HOME="$ANDROID_SDK_ROOT"
|
export ANDROID_HOME="$ANDROID_SDK_ROOT"
|
||||||
chmod +x ./AndroidProjectTooling.sh
|
chmod +x ./AndroidProjectTooling.sh
|
||||||
bash ./AndroidProjectTooling.sh --compile-git
|
bash ./AndroidProjectTooling.sh --compile-android-git
|
||||||
|
|
||||||
- name: Prepare CI build metadata
|
- name: Prepare CI build metadata
|
||||||
id: build_meta
|
id: build_meta
|
||||||
@@ -151,6 +165,8 @@ jobs:
|
|||||||
required = {
|
required = {
|
||||||
'lib/arm64-v8a/libgit.so',
|
'lib/arm64-v8a/libgit.so',
|
||||||
'lib/armeabi-v7a/libgit.so',
|
'lib/armeabi-v7a/libgit.so',
|
||||||
|
'lib/x86/libgit.so',
|
||||||
|
'lib/x86_64/libgit.so',
|
||||||
}
|
}
|
||||||
found = {name for name in names if name in required}
|
found = {name for name in names if name in required}
|
||||||
print('APK_NATIVE_GIT', sorted(found))
|
print('APK_NATIVE_GIT', sorted(found))
|
||||||
@@ -182,6 +198,8 @@ jobs:
|
|||||||
required = {
|
required = {
|
||||||
'base/lib/arm64-v8a/libgit.so',
|
'base/lib/arm64-v8a/libgit.so',
|
||||||
'base/lib/armeabi-v7a/libgit.so',
|
'base/lib/armeabi-v7a/libgit.so',
|
||||||
|
'base/lib/x86/libgit.so',
|
||||||
|
'base/lib/x86_64/libgit.so',
|
||||||
}
|
}
|
||||||
found = {name for name in names if name in required}
|
found = {name for name in names if name in required}
|
||||||
print('AAB_NATIVE_GIT', sorted(found))
|
print('AAB_NATIVE_GIT', sorted(found))
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ quiet_log_name() {
|
|||||||
local arg
|
local arg
|
||||||
for arg in "$@"; do
|
for arg in "$@"; do
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
--build|--build-release-aab|--test|--clean-test|--test-emulator|--compile-git)
|
--build|--build-release-aab|--test|--clean-test|--test-emulator|--compile-git|--compile-android-git)
|
||||||
mode="${arg#--}"
|
mode="${arg#--}"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -502,10 +502,11 @@ build_host_git() {
|
|||||||
build_android_git_for_abi() {
|
build_android_git_for_abi() {
|
||||||
local abi="$1"
|
local abi="$1"
|
||||||
local cc="$2"
|
local cc="$2"
|
||||||
|
local rust_target="$3"
|
||||||
local output_dir="$ANDROID_JNI_DIR/$abi"
|
local output_dir="$ANDROID_JNI_DIR/$abi"
|
||||||
local output_binary="$output_dir/libgit.so"
|
local output_binary="$output_dir/libgit.so"
|
||||||
local stamp="$output_dir/.source-fingerprint"
|
local stamp="$output_dir/.source-fingerprint"
|
||||||
local fingerprint="$3:android:$abi:$cc:$ANDROID_API:githug-embedded-main"
|
local fingerprint="$4:android:$abi:$cc:$rust_target:$ANDROID_API:githug-embedded-main"
|
||||||
|
|
||||||
require_path "$ANDROID_TOOLBIN/$cc"
|
require_path "$ANDROID_TOOLBIN/$cc"
|
||||||
|
|
||||||
@@ -530,6 +531,7 @@ build_android_git_for_abi() {
|
|||||||
AR=llvm-ar \
|
AR=llvm-ar \
|
||||||
RANLIB=llvm-ranlib \
|
RANLIB=llvm-ranlib \
|
||||||
STRIP=llvm-strip \
|
STRIP=llvm-strip \
|
||||||
|
RUST_TARGETS="$rust_target" \
|
||||||
"${make_args[@]}" \
|
"${make_args[@]}" \
|
||||||
git
|
git
|
||||||
|
|
||||||
@@ -554,10 +556,10 @@ build_android_git() {
|
|||||||
local fingerprint
|
local fingerprint
|
||||||
fingerprint="$(git_source_fingerprint)"
|
fingerprint="$(git_source_fingerprint)"
|
||||||
|
|
||||||
build_android_git_for_abi "arm64-v8a" "aarch64-linux-android${ANDROID_API}-clang" "$fingerprint"
|
build_android_git_for_abi "arm64-v8a" "aarch64-linux-android${ANDROID_API}-clang" "aarch64-linux-android" "$fingerprint"
|
||||||
build_android_git_for_abi "armeabi-v7a" "armv7a-linux-androideabi${ANDROID_API}-clang" "$fingerprint"
|
build_android_git_for_abi "armeabi-v7a" "armv7a-linux-androideabi${ANDROID_API}-clang" "armv7-linux-androideabi" "$fingerprint"
|
||||||
build_android_git_for_abi "x86" "i686-linux-android${ANDROID_API}-clang" "$fingerprint"
|
build_android_git_for_abi "x86" "i686-linux-android${ANDROID_API}-clang" "i686-linux-android" "$fingerprint"
|
||||||
build_android_git_for_abi "x86_64" "x86_64-linux-android${ANDROID_API}-clang" "$fingerprint"
|
build_android_git_for_abi "x86_64" "x86_64-linux-android${ANDROID_API}-clang" "x86_64-linux-android" "$fingerprint"
|
||||||
}
|
}
|
||||||
|
|
||||||
build_all_git_targets() {
|
build_all_git_targets() {
|
||||||
@@ -786,6 +788,11 @@ maybe_run_operation() {
|
|||||||
build_all_git_targets
|
build_all_git_targets
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
|
--compile-android-git)
|
||||||
|
setup_env
|
||||||
|
build_android_git
|
||||||
|
return
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
return
|
return
|
||||||
;;
|
;;
|
||||||
@@ -850,7 +857,7 @@ maybe_run_operation() {
|
|||||||
|
|
||||||
print_usage() {
|
print_usage() {
|
||||||
cat <<EOF_USAGE
|
cat <<EOF_USAGE
|
||||||
Usage: bash ./AndroidProjectTooling.sh [--quiet] [--build | --build-release-aab | --test | --clean-test | --test-emulator [--hide-emulator-window] | --compile-git]
|
Usage: bash ./AndroidProjectTooling.sh [--quiet] [--build | --build-release-aab | --test | --clean-test | --test-emulator [--hide-emulator-window] | --compile-git | --compile-android-git]
|
||||||
|
|
||||||
--build Set up the environment and build the debug APK
|
--build Set up the environment and build the debug APK
|
||||||
--build-release-aab Set up the environment and build a release Android App Bundle (AAB)
|
--build-release-aab Set up the environment and build a release Android App Bundle (AAB)
|
||||||
@@ -859,6 +866,7 @@ Usage: bash ./AndroidProjectTooling.sh [--quiet] [--build | --build-release-aab
|
|||||||
--test-emulator Set up a visible Android emulator and run debug instrumentation tests on it
|
--test-emulator Set up a visible Android emulator and run debug instrumentation tests on it
|
||||||
--hide-emulator-window Run --test-emulator with the emulator window hidden
|
--hide-emulator-window Run --test-emulator with the emulator window hidden
|
||||||
--compile-git Compile Git for the development host and all Android target ABIs
|
--compile-git Compile Git for the development host and all Android target ABIs
|
||||||
|
--compile-android-git Compile Git only for the Android target ABIs used by the app
|
||||||
--quiet Write full output to build/reports/android-project-tooling/ and print only a concise result
|
--quiet Write full output to build/reports/android-project-tooling/ and print only a concise result
|
||||||
EOF_USAGE
|
EOF_USAGE
|
||||||
}
|
}
|
||||||
@@ -872,7 +880,7 @@ validate_args() {
|
|||||||
shift || true
|
shift || true
|
||||||
|
|
||||||
case "$mode" in
|
case "$mode" in
|
||||||
""|--build|--build-release-aab|--test|--clean-test|--test-emulator|--compile-git)
|
""|--build|--build-release-aab|--test|--clean-test|--test-emulator|--compile-git|--compile-android-git)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unknown argument: $mode" >&2
|
echo "Unknown argument: $mode" >&2
|
||||||
@@ -913,11 +921,18 @@ main() {
|
|||||||
require_tool git
|
require_tool git
|
||||||
require_tool perl
|
require_tool perl
|
||||||
require_tool make
|
require_tool make
|
||||||
require_tool clang
|
|
||||||
require_tool pkg-config
|
require_tool pkg-config
|
||||||
require_tool readelf
|
require_tool readelf
|
||||||
require_tool file
|
require_tool file
|
||||||
|
|
||||||
|
local mode="${1:-}"
|
||||||
|
if [ "$mode" = "--build" ] || [ "$mode" = "--build-release-aab" ] || [ "$mode" = "--test" ] || [ "$mode" = "--clean-test" ] || [ "$mode" = "--compile-git" ] || [ "$mode" = "--test-emulator" ] || [ "$mode" = "--compile-android-git" ]; then
|
||||||
|
require_tool cargo
|
||||||
|
fi
|
||||||
|
if [ "$mode" = "--build" ] || [ "$mode" = "--build-release-aab" ] || [ "$mode" = "--test" ] || [ "$mode" = "--clean-test" ] || [ "$mode" = "--compile-git" ] || [ "$mode" = "--test-emulator" ]; then
|
||||||
|
require_tool clang
|
||||||
|
fi
|
||||||
|
|
||||||
ensure_dir "$TMP_DIR"
|
ensure_dir "$TMP_DIR"
|
||||||
ensure_dir "$SDK_DIR"
|
ensure_dir "$SDK_DIR"
|
||||||
ensure_dir "$GRADLE_USER_HOME_DIR"
|
ensure_dir "$GRADLE_USER_HOME_DIR"
|
||||||
@@ -936,6 +951,7 @@ main() {
|
|||||||
log "NDK dir: $ANDROID_NDK_DIR"
|
log "NDK dir: $ANDROID_NDK_DIR"
|
||||||
log "CMake dir: $ANDROID_CMAKE_DIR"
|
log "CMake dir: $ANDROID_CMAKE_DIR"
|
||||||
log "To compile Git for host and Android ABIs: bash ./AndroidProjectTooling.sh --compile-git"
|
log "To compile Git for host and Android ABIs: bash ./AndroidProjectTooling.sh --compile-git"
|
||||||
|
log "To compile Git only for Android ABIs: bash ./AndroidProjectTooling.sh --compile-android-git"
|
||||||
log "To build without a background Gradle daemon: ./gradlew --no-daemon assembleDebug"
|
log "To build without a background Gradle daemon: ./gradlew --no-daemon assembleDebug"
|
||||||
log "To set up and build in one step: bash ./AndroidProjectTooling.sh --build"
|
log "To set up and build in one step: bash ./AndroidProjectTooling.sh --build"
|
||||||
log "To set up and build a release AAB in one step: bash ./AndroidProjectTooling.sh --build-release-aab"
|
log "To set up and build a release AAB in one step: bash ./AndroidProjectTooling.sh --build-release-aab"
|
||||||
|
|||||||
Reference in New Issue
Block a user