Compile Git for host and Android target platforms
- Rename CrossCompileGitForAndroid.sh to CompileGitForAllTargetPlatforms.sh and support host, Android-only, and all-target modes. - Compile a development-host Git binary at build/host-git/libgit.so for JVM tests. - Route level and sandbox tests through GITHUG_TEST_GIT_BINARY so they exercise the compiled host Git rather than the system Git fallback. - Cross-compile packaged Git binaries for arm64-v8a, armeabi-v7a, x86, and x86_64 Android targets. - Remove the temporary device-bound Pull rebase instrumentation path from the previous debugging attempt.
This commit is contained in:
@@ -15,6 +15,7 @@ CMDLINE_TOOLS_DIR="$SDK_DIR/cmdline-tools"
|
||||
CMDLINE_TOOLS_LATEST_DIR="$CMDLINE_TOOLS_DIR/latest"
|
||||
WRAPPER_JAR_PATH="$PROJECT_DIR/gradle/wrapper/gradle-wrapper.jar"
|
||||
LOCAL_PROPERTIES_PATH="$PROJECT_DIR/local.properties"
|
||||
HOST_GIT_BINARY="$PROJECT_DIR/build/host-git/libgit.so"
|
||||
|
||||
ANDROID_CMDLINE_TOOLS_URL="https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip"
|
||||
GRADLE_DIST_URL="https://services.gradle.org/distributions/gradle-8.7-bin.zip"
|
||||
@@ -300,6 +301,7 @@ maybe_run_operation() {
|
||||
local artifact_target=""
|
||||
local should_bump_version="false"
|
||||
local should_auto_commit="false"
|
||||
local should_compile_host_git="false"
|
||||
|
||||
case "$mode" in
|
||||
--build)
|
||||
@@ -329,6 +331,11 @@ maybe_run_operation() {
|
||||
--test)
|
||||
gradle_task="testDebugUnitTest"
|
||||
artifact_label="debug unit tests"
|
||||
should_compile_host_git="true"
|
||||
;;
|
||||
--compile-git)
|
||||
"$PROJECT_DIR/CompileGitForAllTargetPlatforms.sh" --all
|
||||
return
|
||||
;;
|
||||
*)
|
||||
return
|
||||
@@ -339,6 +346,10 @@ maybe_run_operation() {
|
||||
if [ "$should_bump_version" = "true" ]; then
|
||||
bump_android_version
|
||||
fi
|
||||
if [ "$should_compile_host_git" = "true" ]; then
|
||||
"$PROJECT_DIR/CompileGitForAllTargetPlatforms.sh" --host
|
||||
export GITHUG_TEST_GIT_BINARY="$HOST_GIT_BINARY"
|
||||
fi
|
||||
|
||||
log "Running $artifact_label with --no-daemon"
|
||||
"$PROJECT_DIR/gradlew" --no-daemon "$gradle_task"
|
||||
@@ -360,18 +371,19 @@ maybe_run_operation() {
|
||||
|
||||
print_usage() {
|
||||
cat <<EOF_USAGE
|
||||
Usage: bash ./AndroidProjectTooling.sh [--build | --build-aab | --build-release-aab | --test]
|
||||
Usage: bash ./AndroidProjectTooling.sh [--build | --build-aab | --build-release-aab | --test | --compile-git]
|
||||
|
||||
--build Set up the environment and build the debug APK
|
||||
--build-aab Set up the environment and build the debug Android App Bundle (AAB)
|
||||
--build-release-aab Set up the environment and build a release Android App Bundle (AAB)
|
||||
--test Set up the environment and run the debug JVM unit tests
|
||||
--test Set up the environment, compile host Git, and run the debug JVM unit tests with it
|
||||
--compile-git Compile Git for the development host and all Android target ABIs
|
||||
EOF_USAGE
|
||||
}
|
||||
|
||||
validate_args() {
|
||||
case "${1:-}" in
|
||||
""|--build|--build-aab|--build-release-aab|--test)
|
||||
""|--build|--build-aab|--build-release-aab|--test|--compile-git)
|
||||
;;
|
||||
*)
|
||||
echo "Unknown argument: $1" >&2
|
||||
@@ -411,12 +423,12 @@ main() {
|
||||
log "SDK dir: $SDK_DIR"
|
||||
log "NDK dir: $ANDROID_NDK_DIR"
|
||||
log "CMake dir: $ANDROID_CMAKE_DIR"
|
||||
log "To cross-compile Git for Android arm64-v8a: bash ./CrossCompileGitForAndroid.sh"
|
||||
log "To compile Git for host and Android ABIs: bash ./AndroidProjectTooling.sh --compile-git"
|
||||
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 a debug AAB in one step: bash ./AndroidProjectTooling.sh --build-aab"
|
||||
log "To set up and build a release AAB in one step: bash ./AndroidProjectTooling.sh --build-release-aab"
|
||||
log "To set up and run unit tests in one step: bash ./AndroidProjectTooling.sh --test"
|
||||
log "To set up and run unit tests with compiled host Git: bash ./AndroidProjectTooling.sh --test"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
||||
Reference in New Issue
Block a user