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"
|
applicationId = "com.kawomi.githugandroid"
|
||||||
minSdk = 26
|
minSdk = 26
|
||||||
targetSdk = 34
|
targetSdk = 34
|
||||||
versionCode = 11
|
versionCode = 12
|
||||||
versionName = "0.1.10"
|
versionName = "0.1.11"
|
||||||
|
|
||||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||||
vectorDrawables.useSupportLibrary = true
|
vectorDrawables.useSupportLibrary = true
|
||||||
@@ -46,6 +46,9 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
packaging {
|
packaging {
|
||||||
|
jniLibs {
|
||||||
|
useLegacyPackaging = true
|
||||||
|
}
|
||||||
resources {
|
resources {
|
||||||
excludes += "/META-INF/{AL2.0,LGPL2.1}"
|
excludes += "/META-INF/{AL2.0,LGPL2.1}"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
|
android:extractNativeLibs="true"
|
||||||
android:fullBackupContent="@xml/backup_rules"
|
android:fullBackupContent="@xml/backup_rules"
|
||||||
android:icon="@android:drawable/sym_def_app_icon"
|
android:icon="@android:drawable/sym_def_app_icon"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.kawomi.githugandroid
|
|||||||
|
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.pm.ApplicationInfo
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class GitRepositoryRuntime(private val context: Context) {
|
class GitRepositoryRuntime(private val context: Context) {
|
||||||
@@ -79,8 +78,7 @@ class GitRepositoryRuntime(private val context: Context) {
|
|||||||
return buildList {
|
return buildList {
|
||||||
addAll(GitSandboxEngine.commandReferenceLines())
|
addAll(GitSandboxEngine.commandReferenceLines())
|
||||||
add("Native Git prototype:")
|
add("Native Git prototype:")
|
||||||
add(" preferred binary path: nativeLibraryDir/libgit.so")
|
add(" binary path: nativeLibraryDir/libgit.so")
|
||||||
add(" fallback binary path: files/native-git/bin/git")
|
|
||||||
add(" selected ABI: ${Build.SUPPORTED_ABIS.firstOrNull() ?: "unknown"}")
|
add(" selected ABI: ${Build.SUPPORTED_ABIS.firstOrNull() ?: "unknown"}")
|
||||||
add(" helper commands: ls, pwd, cat, touch, mkdir, rm, echo")
|
add(" helper commands: ls, pwd, cat, touch, mkdir, rm, echo")
|
||||||
}
|
}
|
||||||
@@ -183,12 +181,7 @@ class GitRepositoryRuntime(private val context: Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun nativeGitBinary(): File? {
|
private fun nativeGitBinary(): File? {
|
||||||
val packaged = packagedNativeGitBinary()
|
return packagedNativeGitBinary()
|
||||||
if (packaged != null) {
|
|
||||||
return packaged
|
|
||||||
}
|
|
||||||
|
|
||||||
return ensureExtractedAssetGitBinary()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun packagedNativeGitBinary(): File? {
|
private fun packagedNativeGitBinary(): File? {
|
||||||
@@ -197,29 +190,6 @@ class GitRepositoryRuntime(private val context: Context) {
|
|||||||
return candidate.takeIf { it.exists() && it.canExecute() }
|
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 sandboxDir(level: Level): File = File(sandboxesRoot, level.id)
|
||||||
|
|
||||||
private fun runGit(binary: File, workingDir: File, arguments: List<String>): ProcessExecutionResult {
|
private fun runGit(binary: File, workingDir: File, arguments: List<String>): ProcessExecutionResult {
|
||||||
|
|||||||
Reference in New Issue
Block a user