[gradle] New way to find apk (#1740)

This commit is contained in:
LoveSy 2022-03-04 17:30:49 +08:00 committed by GitHub
parent 4b9a4f8316
commit 51c82ac0c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 6 deletions

View File

@ -205,7 +205,7 @@ dependencies {
implementation("androidx.recyclerview:recyclerview:1.2.1") implementation("androidx.recyclerview:recyclerview:1.2.1")
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.2.0-alpha01") implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.2.0-alpha01")
implementation("com.github.bumptech.glide:glide:$glideVersion") implementation("com.github.bumptech.glide:glide:$glideVersion")
implementation("com.google.android.material:material:1.6.0-alpha02") implementation("com.google.android.material:material:1.6.0-alpha03")
implementation("com.google.code.gson:gson:2.9.0") implementation("com.google.code.gson:gson:2.9.0")
implementation(platform("com.squareup.okhttp3:okhttp-bom:4.9.3")) implementation(platform("com.squareup.okhttp3:okhttp-bom:4.9.3"))
implementation("com.squareup.okhttp3:okhttp") implementation("com.squareup.okhttp3:okhttp")

View File

@ -193,8 +193,8 @@ fun afterEval() = android.applicationVariants.forEach { variant ->
val prepareMagiskFilesTask = task<Sync>("prepareMagiskFiles$variantCapped") { val prepareMagiskFilesTask = task<Sync>("prepareMagiskFiles$variantCapped") {
dependsOn( dependsOn(
"assemble$variantCapped", "assemble$variantCapped",
":app:assemble$buildTypeCapped", ":app:package$buildTypeCapped",
":daemon:assemble$buildTypeCapped" ":daemon:package$buildTypeCapped"
) )
into(magiskDir) into(magiskDir)
from("${rootProject.projectDir}/README.md") from("${rootProject.projectDir}/README.md")
@ -238,11 +238,11 @@ fun afterEval() = android.applicationVariants.forEach { variant ->
filter<FixCrLfFilter>("eol" to FixCrLfFilter.CrLf.newInstance("lf")) filter<FixCrLfFilter>("eol" to FixCrLfFilter.CrLf.newInstance("lf"))
} }
} }
from("${project(":app").buildDir}/$apkDir/apk/${buildTypeLowered}") { from(project(":app").tasks.getByName("package$buildTypeCapped").outputs) {
include("*.apk") include("*.apk")
rename(".*\\.apk", "manager.apk") rename(".*\\.apk", "manager.apk")
} }
from("${project(":daemon").buildDir}/$apkDir/apk/${buildTypeLowered}") { from(project(":daemon").tasks.getByName("package$buildTypeCapped").outputs) {
include("*.apk") include("*.apk")
rename(".*\\.apk", "daemon.apk") rename(".*\\.apk", "daemon.apk")
} }
@ -328,7 +328,14 @@ val pushDaemonNative = task<Exec>("pushDaemonNative") {
val reRunDaemon = task<Exec>("reRunDaemon") { val reRunDaemon = task<Exec>("reRunDaemon") {
dependsOn(pushDaemon, pushDaemonNative, killLspd) dependsOn(pushDaemon, pushDaemonNative, killLspd)
// tricky to pass a minus number to avoid the injection warning // tricky to pass a minus number to avoid the injection warning
commandLine(adb, "shell", "ASH_STANDALONE=1", "su", "-pc", "/data/adb/magisk/busybox sh /data/adb/modules/*_lsposed/service.sh --system-server-max-retry=-1&") commandLine(
adb,
"shell",
"ASH_STANDALONE=1",
"su",
"-pc",
"/data/adb/magisk/busybox sh /data/adb/modules/*_lsposed/service.sh --system-server-max-retry=-1&"
)
isIgnoreExitValue = true isIgnoreExitValue = true
} }
val tmpApk = "/data/local/tmp/lsp.apk" val tmpApk = "/data/local/tmp/lsp.apk"
@ -356,3 +363,6 @@ task<Exec>("reRunApp") {
isIgnoreExitValue = true isIgnoreExitValue = true
finalizedBy(reRunDaemon) finalizedBy(reRunDaemon)
} }
evaluationDependsOn(":app")
evaluationDependsOn(":daemon")