Auto-commit after successful build: update app gameplay/UI, improve build setup
Changed files:\napp/build.gradle.kts app/src/main/AndroidManifest.xml app/src/main/java/com/kawomi/githugandroid/GitRuntime.kt
This commit is contained in:
@@ -11,8 +11,8 @@ android {
|
||||
applicationId = "com.kawomi.githugandroid"
|
||||
minSdk = 26
|
||||
targetSdk = 34
|
||||
versionCode = 11
|
||||
versionName = "0.1.10"
|
||||
versionCode = 12
|
||||
versionName = "0.1.11"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
@@ -46,6 +46,9 @@ android {
|
||||
}
|
||||
|
||||
packaging {
|
||||
jniLibs {
|
||||
useLegacyPackaging = true
|
||||
}
|
||||
resources {
|
||||
excludes += "/META-INF/{AL2.0,LGPL2.1}"
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:extractNativeLibs="true"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@android:drawable/sym_def_app_icon"
|
||||
android:label="@string/app_name"
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.kawomi.githugandroid
|
||||
|
||||
import android.os.Build
|
||||
import android.content.Context
|
||||
import android.content.pm.ApplicationInfo
|
||||
import java.io.File
|
||||
|
||||
class GitRepositoryRuntime(private val context: Context) {
|
||||
@@ -79,8 +78,7 @@ class GitRepositoryRuntime(private val context: Context) {
|
||||
return buildList {
|
||||
addAll(GitSandboxEngine.commandReferenceLines())
|
||||
add("Native Git prototype:")
|
||||
add(" preferred binary path: nativeLibraryDir/libgit.so")
|
||||
add(" fallback binary path: files/native-git/bin/git")
|
||||
add(" binary path: nativeLibraryDir/libgit.so")
|
||||
add(" selected ABI: ${Build.SUPPORTED_ABIS.firstOrNull() ?: "unknown"}")
|
||||
add(" helper commands: ls, pwd, cat, touch, mkdir, rm, echo")
|
||||
}
|
||||
@@ -183,12 +181,7 @@ class GitRepositoryRuntime(private val context: Context) {
|
||||
}
|
||||
|
||||
private fun nativeGitBinary(): File? {
|
||||
val packaged = packagedNativeGitBinary()
|
||||
if (packaged != null) {
|
||||
return packaged
|
||||
}
|
||||
|
||||
return ensureExtractedAssetGitBinary()
|
||||
return packagedNativeGitBinary()
|
||||
}
|
||||
|
||||
private fun packagedNativeGitBinary(): File? {
|
||||
@@ -197,29 +190,6 @@ class GitRepositoryRuntime(private val context: Context) {
|
||||
return candidate.takeIf { it.exists() && it.canExecute() }
|
||||
}
|
||||
|
||||
private fun ensureExtractedAssetGitBinary(): File? {
|
||||
val extracted = File(extractedGitDir, "git")
|
||||
if (extracted.exists() && extracted.canExecute()) {
|
||||
return extracted
|
||||
}
|
||||
|
||||
val abi = Build.SUPPORTED_ABIS.firstOrNull() ?: return null
|
||||
val assetPath = "native-git/$abi/git"
|
||||
|
||||
return try {
|
||||
extractedGitDir.mkdirs()
|
||||
context.assets.open(assetPath).use { input ->
|
||||
extracted.outputStream().use { output ->
|
||||
input.copyTo(output)
|
||||
}
|
||||
}
|
||||
extracted.setExecutable(true)
|
||||
extracted.takeIf { it.canExecute() }
|
||||
} catch (_: Exception) {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
private fun sandboxDir(level: Level): File = File(sandboxesRoot, level.id)
|
||||
|
||||
private fun runGit(binary: File, workingDir: File, arguments: List<String>): ProcessExecutionResult {
|
||||
|
||||
Reference in New Issue
Block a user