mirror of
https://github.com/revanced/revanced-cli.git
synced 2024-11-12 06:39:24 +01:00
fix: align every file
This commit is contained in:
parent
1cd0976415
commit
96ec6a0384
19
src/main/kotlin/app/revanced/cli/aligning/Aligning.kt
Normal file
19
src/main/kotlin/app/revanced/cli/aligning/Aligning.kt
Normal file
@ -0,0 +1,19 @@
|
||||
package app.revanced.cli.aligning
|
||||
|
||||
import app.revanced.cli.command.MainCommand
|
||||
import app.revanced.cli.command.MainCommand.logger
|
||||
import app.revanced.utils.signing.align.ZipAligner
|
||||
import java.io.File
|
||||
|
||||
object Aligning {
|
||||
fun align(inputFile: File, outputFile: File) {
|
||||
val cacheDirectory = File(MainCommand.args.sArgs?.pArgs?.cacheDirectory)
|
||||
val alignedOutput = cacheDirectory.resolve("${outputFile.nameWithoutExtension}_aligned.apk")
|
||||
|
||||
logger.info("Aligning ${inputFile.name}")
|
||||
ZipAligner.align(inputFile, alignedOutput)
|
||||
|
||||
logger.info("Copying ${alignedOutput.name} to ${outputFile.name}")
|
||||
alignedOutput.copyTo(outputFile, true)
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package app.revanced.cli.command
|
||||
|
||||
import app.revanced.cli.aligning.Aligning
|
||||
import app.revanced.cli.logging.impl.DefaultCliLogger
|
||||
import app.revanced.cli.patcher.Patcher
|
||||
import app.revanced.cli.patcher.logging.impl.PatcherLogger
|
||||
@ -162,8 +163,7 @@ internal object MainCommand : Runnable {
|
||||
val adb: Adb? = _args.deploy?.let {
|
||||
Adb(outputFile, patcher.data.packageMetadata.packageName, _args.deploy!!, !args.mount)
|
||||
}
|
||||
val patchedFile = if (args.mount) outputFile
|
||||
else File(args.cacheDirectory).resolve("${outputFile.nameWithoutExtension}_raw.apk")
|
||||
val patchedFile = File(args.cacheDirectory).resolve("${outputFile.nameWithoutExtension}_raw.apk")
|
||||
|
||||
Patcher.start(patcher, patchedFile)
|
||||
|
||||
@ -180,6 +180,9 @@ internal object MainCommand : Runnable {
|
||||
)
|
||||
)
|
||||
}
|
||||
else {
|
||||
Aligning.align(patchedFile, outputFile)
|
||||
}
|
||||
|
||||
if (args.clean) File(args.cacheDirectory).deleteRecursively()
|
||||
|
||||
|
@ -7,14 +7,14 @@ import app.revanced.utils.signing.align.ZipAligner
|
||||
import java.io.File
|
||||
|
||||
object Signing {
|
||||
fun start(inputFile: File, outputFile: File, signingOptions: SigningOptions) {
|
||||
fun start(patchedFile: File, outputFile: File, signingOptions: SigningOptions) {
|
||||
val cacheDirectory = File(args.sArgs?.pArgs?.cacheDirectory)
|
||||
val alignedOutput = cacheDirectory.resolve("${outputFile.nameWithoutExtension}_aligned.apk")
|
||||
val signedOutput = cacheDirectory.resolve("${outputFile.nameWithoutExtension}_signed.apk")
|
||||
val alignedOutput = cacheDirectory.resolve("${outputFile.nameWithoutExtension}_aligned.apk")
|
||||
|
||||
// align the patchedFile and write to alignedFile
|
||||
ZipAligner.align(patchedFile, alignedOutput)
|
||||
|
||||
// align the inputFile and write to alignedOutput
|
||||
logger.info("Aligning ${inputFile.name}")
|
||||
ZipAligner.align(inputFile, alignedOutput)
|
||||
// sign the alignedOutput and write to signedOutput
|
||||
// the reason is, in case the signer fails
|
||||
// it does not damage the output file
|
||||
|
Loading…
Reference in New Issue
Block a user