[gradle] Add task to rerun lspd (#818)
This commit is contained in:
parent
1023e0e6ab
commit
dbce1ff67d
|
|
@ -33,7 +33,6 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
val moduleName = "LSPosed"
|
val moduleName = "LSPosed"
|
||||||
val isWindows = OperatingSystem.current().isWindows
|
|
||||||
val moduleId = "riru_lsposed"
|
val moduleId = "riru_lsposed"
|
||||||
val authors = "LSPosed Developers"
|
val authors = "LSPosed Developers"
|
||||||
|
|
||||||
|
|
@ -227,7 +226,7 @@ androidComponents.onVariants { v ->
|
||||||
from(magiskDir)
|
from(magiskDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
val adb = androidComponents.sdkComponents.adb.get().asFile.absolutePath
|
val adb: String = androidComponents.sdkComponents.adb.get().asFile.absolutePath
|
||||||
val pushTask = task("push${variantCapped}", Exec::class) {
|
val pushTask = task("push${variantCapped}", Exec::class) {
|
||||||
dependsOn(zipTask)
|
dependsOn(zipTask)
|
||||||
workingDir("${projectDir}/release")
|
workingDir("${projectDir}/release")
|
||||||
|
|
@ -235,7 +234,6 @@ androidComponents.onVariants { v ->
|
||||||
}
|
}
|
||||||
val flashTask = task("flash${variantCapped}", Exec::class) {
|
val flashTask = task("flash${variantCapped}", Exec::class) {
|
||||||
dependsOn(pushTask)
|
dependsOn(pushTask)
|
||||||
workingDir("${projectDir}/release")
|
|
||||||
commandLine(
|
commandLine(
|
||||||
adb, "shell", "su", "-c",
|
adb, "shell", "su", "-c",
|
||||||
"magisk --install-module /data/local/tmp/${zipFileName}"
|
"magisk --install-module /data/local/tmp/${zipFileName}"
|
||||||
|
|
@ -243,11 +241,26 @@ androidComponents.onVariants { v ->
|
||||||
}
|
}
|
||||||
task("flashAndReboot${variantCapped}", Exec::class) {
|
task("flashAndReboot${variantCapped}", Exec::class) {
|
||||||
dependsOn(flashTask)
|
dependsOn(flashTask)
|
||||||
workingDir("${projectDir}/release")
|
|
||||||
commandLine(adb, "shell", "reboot")
|
commandLine(adb, "shell", "reboot")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val adb: String = androidComponents.sdkComponents.adb.get().asFile.absolutePath
|
||||||
|
val killLspd = task("killLspd", Exec::class) {
|
||||||
|
commandLine(adb, "shell", "su", "-c", "killall -w lspd")
|
||||||
|
}
|
||||||
|
val pushLspd = task("pushLspd", Exec::class) {
|
||||||
|
dependsOn("mergeDexDebug")
|
||||||
|
workingDir("$buildDir/intermediates/dex/debug/mergeDexDebug")
|
||||||
|
commandLine(adb, "push", "classes.dex", "/data/local/tmp/lspd.dex")
|
||||||
|
}
|
||||||
|
task("reRunLspd", Exec::class) {
|
||||||
|
dependsOn(pushLspd)
|
||||||
|
dependsOn(killLspd)
|
||||||
|
commandLine(adb, "shell", "su", "-c", "sh /data/adb/modules/riru_lsposed/service.sh&")
|
||||||
|
isIgnoreExitValue = true
|
||||||
|
}
|
||||||
|
|
||||||
val generateVersion = task("generateVersion", Copy::class) {
|
val generateVersion = task("generateVersion", Copy::class) {
|
||||||
inputs.property("VERSION_CODE", verCode)
|
inputs.property("VERSION_CODE", verCode)
|
||||||
inputs.property("VERSION_NAME", verName)
|
inputs.property("VERSION_NAME", verName)
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,20 @@
|
||||||
#!/system/bin/sh
|
#!/system/bin/sh
|
||||||
|
|
||||||
dir=${0%/*}
|
dir=${0%/*}
|
||||||
if [ -d "$dir/system" ]; then
|
tmpLspdDex="/data/local/tmp/lspd.dex"
|
||||||
|
debug="false"
|
||||||
|
|
||||||
|
if [ -r $tmpLspdDex ]; then
|
||||||
|
java_options="-Djava.class.path=$tmpLspdDex"
|
||||||
|
debug="true"
|
||||||
|
elif [ -d "$dir/system" ]; then
|
||||||
java_options="-Djava.class.path=$dir/system/framework/lspd.dex"
|
java_options="-Djava.class.path=$dir/system/framework/lspd.dex"
|
||||||
|
debug="true"
|
||||||
|
else
|
||||||
|
java_options="-Djava.class.path=$dir/framework/lspd.dex"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $debug = "true" ]; then
|
||||||
os_version=$(getprop ro.build.version.sdk)
|
os_version=$(getprop ro.build.version.sdk)
|
||||||
if [ "$os_version" -eq "27" ]; then
|
if [ "$os_version" -eq "27" ]; then
|
||||||
java_options="$java_options -Xrunjdwp:transport=dt_android_adb,suspend=n,server=y -Xcompiler-option --debuggable"
|
java_options="$java_options -Xrunjdwp:transport=dt_android_adb,suspend=n,server=y -Xcompiler-option --debuggable"
|
||||||
|
|
@ -11,8 +23,6 @@ if [ -d "$dir/system" ]; then
|
||||||
else
|
else
|
||||||
java_options="$java_options -XjdwpProvider:adbconnection -XjdwpOptions:suspend=n,server=y"
|
java_options="$java_options -XjdwpProvider:adbconnection -XjdwpOptions:suspend=n,server=y"
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
java_options="-Djava.class.path=$dir/framework/lspd.dex"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
|
|
|
||||||
|
|
@ -135,4 +135,5 @@ if [ ! -z "${MISC_PATH}" ]; then
|
||||||
start_log_catcher all "LSPosed:V XSharedPreferences:V LSPosed-Bridge:V LSPosedManager:V LSPosedService:V *:F" true ${LOG_VERBOSE}
|
start_log_catcher all "LSPosed:V XSharedPreferences:V LSPosed-Bridge:V LSPosedManager:V LSPosedService:V *:F" true ${LOG_VERBOSE}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
rm -f "/data/local/tmp/lspd.dex"
|
||||||
"$MODDIR/lspd"
|
"$MODDIR/lspd"
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,6 @@ android {
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
isMinifyEnabled = false
|
isMinifyEnabled = false
|
||||||
proguardFiles("proguard-rules.pro")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue