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:
@@ -152,7 +152,7 @@ class GitSandboxEngineTest {
|
||||
|
||||
@Test
|
||||
fun nativeCompletionUsesCurrentDirectoryIncludingGitMetadata() {
|
||||
val git = File("/usr/bin/git")
|
||||
val git = testGitBinary()
|
||||
assumeTrue(git.exists() && git.canExecute())
|
||||
val root = Files.createTempDirectory("githug-completion").toFile()
|
||||
try {
|
||||
@@ -177,7 +177,7 @@ class GitSandboxEngineTest {
|
||||
|
||||
@Test
|
||||
fun nativePushLevelHasDivergedStatusAndRebasesCleanly() {
|
||||
val git = File("/usr/bin/git")
|
||||
val git = testGitBinary()
|
||||
assumeTrue(git.exists() && git.canExecute())
|
||||
val root = Files.createTempDirectory("githug-push-level").toFile()
|
||||
try {
|
||||
@@ -221,4 +221,22 @@ class GitSandboxEngineTest {
|
||||
assertTrue(output.isEmpty())
|
||||
assertFalse(updatedRepo.files.any { it.name == "deleteme.txt" })
|
||||
}
|
||||
|
||||
private fun testGitBinary(): File {
|
||||
System.getenv("GITHUG_TEST_GIT_BINARY")
|
||||
?.takeIf { it.isNotBlank() }
|
||||
?.let { File(it) }
|
||||
?.takeIf { it.exists() && it.canExecute() }
|
||||
?.let { return it }
|
||||
|
||||
val repoHostGit = File(repoRoot(), "build/host-git/libgit.so")
|
||||
if (repoHostGit.exists() && repoHostGit.canExecute()) return repoHostGit
|
||||
|
||||
return File("/usr/bin/git")
|
||||
}
|
||||
|
||||
private fun repoRoot(): File {
|
||||
val userDir = File(System.getProperty("user.dir") ?: ".")
|
||||
return if (File(userDir, "app/build.gradle.kts").exists()) userDir else userDir.parentFile ?: userDir
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user