build(Needs bump): Bump dependencies
This commit is contained in:
parent
b6f63c7d9d
commit
c335850cc5
|
@ -0,0 +1,3 @@
|
|||
[*.{kt,kts}]
|
||||
ktlint_code_style = intellij_idea
|
||||
ktlint_standard_no-wildcard-imports = disabled
|
|
@ -1,13 +1,13 @@
|
|||
[versions]
|
||||
shadow = "8.1.1"
|
||||
kotlin-test = "1.9.20"
|
||||
kotlin = "1.9.22"
|
||||
kotlinx-coroutines-core = "1.7.3"
|
||||
picocli = "4.7.3"
|
||||
revanced-patcher = "19.2.0"
|
||||
revanced-library = "1.4.0"
|
||||
revanced-patcher = "19.3.0"
|
||||
revanced-library = "2.0.0"
|
||||
|
||||
[libraries]
|
||||
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin-test" }
|
||||
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
|
||||
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines-core" }
|
||||
picocli = { module = "info.picocli:picocli", version.ref = "picocli" }
|
||||
revanced-patcher = { module = "app.revanced:revanced-patcher", version.ref = "revanced-patcher" }
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
package app.revanced.cli.command
|
||||
|
||||
import app.revanced.library.ApkUtils
|
||||
import app.revanced.library.ApkUtils.applyTo
|
||||
import app.revanced.library.ApkUtils.sign
|
||||
import app.revanced.library.Options
|
||||
import app.revanced.library.Options.setOptions
|
||||
import app.revanced.library.adb.AdbManager
|
||||
import app.revanced.patcher.PatchBundleLoader
|
||||
import app.revanced.patcher.PatchSet
|
||||
import app.revanced.patcher.Patcher
|
||||
import app.revanced.patcher.PatcherOptions
|
||||
import app.revanced.patcher.PatcherConfig
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import picocli.CommandLine
|
||||
import picocli.CommandLine.Help.Visibility.ALWAYS
|
||||
|
@ -30,9 +32,9 @@ internal object PatchCommand : Runnable {
|
|||
|
||||
private lateinit var apk: File
|
||||
|
||||
private var integrations = listOf<File>()
|
||||
private var integrations = setOf<File>()
|
||||
|
||||
private var patchBundles = emptyList<File>()
|
||||
private var patchBundles = emptySet<File>()
|
||||
|
||||
@CommandLine.Option(
|
||||
names = ["-i", "--include"],
|
||||
|
@ -91,7 +93,8 @@ internal object PatchCommand : Runnable {
|
|||
@CommandLine.Option(
|
||||
names = ["-d", "--device-serial"],
|
||||
description = ["ADB device serial to install to. If not supplied, the first connected device will be used."],
|
||||
fallbackValue = "", // Empty string to indicate that the first connected device should be used.
|
||||
// Empty string to indicate that the first connected device should be used.
|
||||
fallbackValue = "",
|
||||
arity = "0..1",
|
||||
)
|
||||
private var deviceSerial: String? = null
|
||||
|
@ -144,6 +147,17 @@ internal object PatchCommand : Runnable {
|
|||
description = ["Path to temporary resource cache directory."],
|
||||
)
|
||||
private var resourceCachePath: File? = null
|
||||
set(value) {
|
||||
logger.warning("The --resource-cache option is deprecated. Use --temporary-files-patch instead.")
|
||||
field = value
|
||||
temporaryFilesPath = value
|
||||
}
|
||||
|
||||
@CommandLine.Option(
|
||||
names = ["-t", "--temporary-files-path"],
|
||||
description = ["Path to temporary files directory."],
|
||||
)
|
||||
private var temporaryFilesPath: File? = null
|
||||
|
||||
private var aaptBinaryPath: File? = null
|
||||
|
||||
|
@ -194,11 +208,11 @@ internal object PatchCommand : Runnable {
|
|||
required = true,
|
||||
)
|
||||
@Suppress("unused")
|
||||
private fun setPatchBundles(patchBundles: Array<File>) {
|
||||
private fun setPatchBundles(patchBundles: Set<File>) {
|
||||
patchBundles.firstOrNull { !it.exists() }?.let {
|
||||
throw CommandLine.ParameterException(spec.commandLine(), "Patch bundle ${it.name} does not exist")
|
||||
}
|
||||
this.patchBundles = patchBundles.toList()
|
||||
this.patchBundles = patchBundles
|
||||
}
|
||||
|
||||
@CommandLine.Option(
|
||||
|
@ -224,9 +238,9 @@ internal object PatchCommand : Runnable {
|
|||
"${apk.nameWithoutExtension}-patched.${apk.extension}",
|
||||
)
|
||||
|
||||
val resourceCachePath =
|
||||
resourceCachePath ?: outputFilePath.parentFile.resolve(
|
||||
"${outputFilePath.nameWithoutExtension}-resource-cache",
|
||||
val temporaryFilesPath =
|
||||
temporaryFilesPath ?: outputFilePath.parentFile.resolve(
|
||||
"${outputFilePath.nameWithoutExtension}-temporary-files",
|
||||
)
|
||||
|
||||
val optionsFile =
|
||||
|
@ -261,11 +275,11 @@ internal object PatchCommand : Runnable {
|
|||
// endregion
|
||||
|
||||
Patcher(
|
||||
PatcherOptions(
|
||||
PatcherConfig(
|
||||
apk,
|
||||
resourceCachePath,
|
||||
temporaryFilesPath,
|
||||
aaptBinaryPath?.path,
|
||||
resourceCachePath.absolutePath,
|
||||
temporaryFilesPath.absolutePath,
|
||||
true,
|
||||
),
|
||||
).use { patcher ->
|
||||
|
@ -304,15 +318,12 @@ internal object PatchCommand : Runnable {
|
|||
|
||||
// region Save
|
||||
|
||||
val alignedFile =
|
||||
resourceCachePath.resolve(apk.name).apply {
|
||||
ApkUtils.copyAligned(apk, this, patcherResult)
|
||||
}
|
||||
apk.copyTo(outputFilePath, overwrite = true)
|
||||
|
||||
patcherResult.applyTo(outputFilePath)
|
||||
|
||||
if (!mount) {
|
||||
ApkUtils.sign(
|
||||
alignedFile,
|
||||
outputFilePath,
|
||||
outputFilePath.sign(
|
||||
ApkUtils.SigningOptions(
|
||||
keystoreFilePath,
|
||||
keyStorePassword,
|
||||
|
@ -321,8 +332,6 @@ internal object PatchCommand : Runnable {
|
|||
signer,
|
||||
),
|
||||
)
|
||||
} else {
|
||||
alignedFile.renameTo(outputFilePath)
|
||||
}
|
||||
|
||||
logger.info("Saved to $outputFilePath")
|
||||
|
@ -340,7 +349,7 @@ internal object PatchCommand : Runnable {
|
|||
|
||||
if (purge) {
|
||||
logger.info("Purging temporary files")
|
||||
purge(resourceCachePath)
|
||||
purge(temporaryFilesPath)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue