Support split apks
This commit is contained in:
parent
3b5fa88d17
commit
030686639f
|
|
@ -14,7 +14,7 @@ import kotlin.io.path.absolutePathString
|
||||||
|
|
||||||
object Patcher {
|
object Patcher {
|
||||||
class Options(
|
class Options(
|
||||||
private val apkPaths: Array<String>,
|
private val apkPaths: List<String>,
|
||||||
private val debuggable: Boolean,
|
private val debuggable: Boolean,
|
||||||
private val sigbypassLevel: Int,
|
private val sigbypassLevel: Int,
|
||||||
private val v1: Boolean,
|
private val v1: Boolean,
|
||||||
|
|
@ -23,12 +23,13 @@ object Patcher {
|
||||||
private val useManager: Boolean,
|
private val useManager: Boolean,
|
||||||
private val overrideVersionCode: Boolean,
|
private val overrideVersionCode: Boolean,
|
||||||
private val verbose: Boolean,
|
private val verbose: Boolean,
|
||||||
private val embeddedModules: List<String>
|
private val embeddedModules: List<String>?
|
||||||
) {
|
) {
|
||||||
lateinit var outputPath: String
|
lateinit var outputPath: String
|
||||||
|
|
||||||
fun toStringArray(): Array<String> {
|
fun toStringArray(): Array<String> {
|
||||||
return buildList {
|
return buildList {
|
||||||
|
add("-f")
|
||||||
addAll(apkPaths)
|
addAll(apkPaths)
|
||||||
add("-o"); add(outputPath)
|
add("-o"); add(outputPath)
|
||||||
if (debuggable) add("-d")
|
if (debuggable) add("-d")
|
||||||
|
|
@ -39,8 +40,8 @@ object Patcher {
|
||||||
if (useManager) add("--manager")
|
if (useManager) add("--manager")
|
||||||
if (overrideVersionCode) add("-r")
|
if (overrideVersionCode) add("-r")
|
||||||
if (verbose) add("-v")
|
if (verbose) add("-v")
|
||||||
if (embeddedModules.isNotEmpty()) {
|
embeddedModules?.forEach {
|
||||||
add("-m"); addAll(embeddedModules)
|
add("-m"); add(it)
|
||||||
}
|
}
|
||||||
if (!MyKeyStore.useDefault) {
|
if (!MyKeyStore.useDefault) {
|
||||||
addAll(arrayOf("-k", MyKeyStore.file.path, MyKeyStore.password, MyKeyStore.alias, MyKeyStore.aliasPassword))
|
addAll(arrayOf("-k", MyKeyStore.file.path, MyKeyStore.password, MyKeyStore.alias, MyKeyStore.aliasPassword))
|
||||||
|
|
|
||||||
|
|
@ -158,14 +158,14 @@ private fun PatchOptionsBody(
|
||||||
if (patchState == PatchState.SUBMITTING) LaunchedEffect(patchApp) {
|
if (patchState == PatchState.SUBMITTING) LaunchedEffect(patchApp) {
|
||||||
if (viewModel.useManager) embeddedModules.value?.clear()
|
if (viewModel.useManager) embeddedModules.value?.clear()
|
||||||
val options = Patcher.Options(
|
val options = Patcher.Options(
|
||||||
apkPaths = arrayOf(patchApp.app.sourceDir), // TODO: Split Apk
|
apkPaths = listOf(patchApp.app.sourceDir) + (patchApp.app.splitSourceDirs ?: emptyArray()),
|
||||||
debuggable = viewModel.debuggable,
|
debuggable = viewModel.debuggable,
|
||||||
sigbypassLevel = viewModel.sigBypassLevel,
|
sigbypassLevel = viewModel.sigBypassLevel,
|
||||||
v1 = viewModel.sign[0], v2 = viewModel.sign[1], v3 = viewModel.sign[2],
|
v1 = viewModel.sign[0], v2 = viewModel.sign[1], v3 = viewModel.sign[2],
|
||||||
useManager = viewModel.useManager,
|
useManager = viewModel.useManager,
|
||||||
overrideVersionCode = viewModel.overrideVersionCode,
|
overrideVersionCode = viewModel.overrideVersionCode,
|
||||||
verbose = true,
|
verbose = true,
|
||||||
embeddedModules = embeddedModules.value?.map { it.app.sourceDir } ?: emptyList() // TODO: Split Apk
|
embeddedModules = embeddedModules.value?.flatMap { listOf(it.app.sourceDir) + (it.app.splitSourceDirs ?: emptyArray()) }
|
||||||
)
|
)
|
||||||
onSubmit(options)
|
onSubmit(options)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue