enable configuration cache
This commit is contained in:
parent
3b8dadc526
commit
d671dc535e
|
|
@ -24,6 +24,7 @@ plugins {
|
|||
id("androidx.navigation.safeargs")
|
||||
id("dev.rikka.tools.autoresconfig")
|
||||
id("dev.rikka.tools.materialthemebuilder")
|
||||
id("org.lsposed.lsplugin.resopt")
|
||||
}
|
||||
|
||||
val defaultManagerPackageName: String by rootProject.extra
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
|
||||
import com.android.build.api.dsl.ApplicationExtension
|
||||
import com.android.build.api.variant.ApplicationAndroidComponentsExtension
|
||||
import com.android.build.gradle.BaseExtension
|
||||
import org.eclipse.jgit.api.Git
|
||||
import org.eclipse.jgit.storage.file.FileRepositoryBuilder
|
||||
|
|
@ -189,43 +188,6 @@ fun Project.configureBaseExtension() {
|
|||
abortOnError = true
|
||||
checkReleaseBuilds = false
|
||||
}
|
||||
|
||||
extensions.findByType(ApplicationAndroidComponentsExtension::class)?.let { androidComponents ->
|
||||
val optimizeReleaseRes = task("optimizeReleaseRes").doLast {
|
||||
val aapt2 = File(
|
||||
androidComponents.sdkComponents.sdkDirectory.get().asFile,
|
||||
"build-tools/${androidBuildToolsVersion}/aapt2"
|
||||
)
|
||||
val zip = Paths.get(
|
||||
project.buildDir.path,
|
||||
"intermediates",
|
||||
"optimized_processed_res",
|
||||
"release",
|
||||
"resources-release-optimize.ap_"
|
||||
)
|
||||
val optimized = File("${zip}.opt")
|
||||
val cmd = exec {
|
||||
commandLine(
|
||||
aapt2, "optimize",
|
||||
"--collapse-resource-names",
|
||||
"--enable-sparse-encoding",
|
||||
"-o", optimized,
|
||||
zip
|
||||
)
|
||||
isIgnoreExitValue = false
|
||||
}
|
||||
if (cmd.exitValue == 0) {
|
||||
delete(zip)
|
||||
optimized.renameTo(zip.toFile())
|
||||
}
|
||||
}
|
||||
|
||||
tasks.whenTaskAdded {
|
||||
if (name == "optimizeReleaseResources") {
|
||||
finalizedBy(optimizeReleaseRes)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.configureJavaExtension() {
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import java.util.*
|
|||
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("org.lsposed.lsplugin.resopt")
|
||||
}
|
||||
|
||||
val daemonName = "LSPosed"
|
||||
|
|
@ -87,14 +88,14 @@ fun afterEval() = android.applicationVariants.forEach { variant ->
|
|||
val variantCapped = variant.name.capitalize(Locale.ROOT)
|
||||
val variantLowered = variant.name.toLowerCase(Locale.ROOT)
|
||||
|
||||
val app = rootProject.project(":app").extensions.getByName<BaseExtension>("android")
|
||||
val outSrcDir = file("$buildDir/generated/source/signInfo/${variantLowered}")
|
||||
val outSrc = file("$outSrcDir/org/lsposed/lspd/util/SignInfo.java")
|
||||
val signInfoTask = tasks.register("generate${variantCapped}SignInfo") {
|
||||
dependsOn(":app:validateSigning${variantCapped}")
|
||||
val app = rootProject.project(":app").extensions.getByName<BaseExtension>("android")
|
||||
val sign = app.buildTypes.named(variantLowered).get().signingConfig
|
||||
val outSrc = file("$outSrcDir/org/lsposed/lspd/util/SignInfo.java")
|
||||
outputs.file(outSrc)
|
||||
doLast {
|
||||
val sign = app.buildTypes.named(variantLowered).get().signingConfig
|
||||
outSrc.parentFile.mkdirs()
|
||||
val certificateInfo = KeystoreHelper.getCertificateInfo(
|
||||
sign?.storeType,
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ android.nonTransitiveRClass=true
|
|||
android.enableR8.fullMode=true
|
||||
android.useAndroidX=true
|
||||
|
||||
org.gradle.unsafe.configuration-cache=true
|
||||
|
||||
agpVersion=7.4.1
|
||||
navVersion=2.5.3
|
||||
kotlinVersion=1.8.10
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import org.objectweb.asm.Opcodes
|
|||
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("org.lsposed.lsplugin.resopt")
|
||||
}
|
||||
|
||||
val moduleName = "LSPosed"
|
||||
|
|
@ -116,6 +117,10 @@ android {
|
|||
}
|
||||
namespace = "org.lsposed.lspd"
|
||||
}
|
||||
abstract class Injected @Inject constructor(val magiskDir: String) {
|
||||
@get:Inject
|
||||
abstract val factory: ObjectFactory
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("androidx.annotation:annotation:1.5.0")
|
||||
|
|
@ -220,14 +225,16 @@ fun afterEval() = android.applicationVariants.forEach { variant ->
|
|||
from(dexOutPath)
|
||||
rename("classes.dex", "lspd.dex")
|
||||
}
|
||||
|
||||
val injected = objects.newInstance<Injected>(magiskDir)
|
||||
doLast {
|
||||
fileTree(magiskDir).visit {
|
||||
injected.factory.fileTree().from(injected.magiskDir).visit {
|
||||
if (isDirectory) return@visit
|
||||
val md = MessageDigest.getInstance("SHA-256")
|
||||
file.forEachBlock(4096) { bytes, size ->
|
||||
md.update(bytes, 0, size)
|
||||
}
|
||||
file(file.path + ".sha256").writeText(Hex.encodeHexString(md.digest()))
|
||||
File(file.path + ".sha256").writeText(Hex.encodeHexString(md.digest()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ pluginManagement {
|
|||
id("androidx.navigation.safeargs") version navVersion
|
||||
id("dev.rikka.tools.autoresconfig") version "1.2.2"
|
||||
id("dev.rikka.tools.materialthemebuilder") version "1.3.3"
|
||||
id("org.lsposed.lsplugin.resopt") version "1.2"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue