Use striped so for debug build (#2047)

This commit is contained in:
LoveSy 2022-07-25 00:33:00 +08:00 committed by GitHub
parent d985cf4c63
commit 02f09247ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 14 deletions

View File

@ -89,9 +89,6 @@ fun afterEval() = android.applicationVariants.forEach { variant ->
val variantCapped = variant.name.capitalize(Locale.ROOT) val variantCapped = variant.name.capitalize(Locale.ROOT)
val variantLowered = variant.name.toLowerCase(Locale.ROOT) val variantLowered = variant.name.toLowerCase(Locale.ROOT)
tasks["merge${variantCapped}JniLibFolders"].enabled = false
tasks["merge${variantCapped}NativeLibs"].enabled = false
val app = rootProject.project(":app").extensions.getByName<BaseExtension>("android") val app = rootProject.project(":app").extensions.getByName<BaseExtension>("android")
val outSrcDir = file("$buildDir/generated/source/signInfo/${variantLowered}") val outSrcDir = file("$buildDir/generated/source/signInfo/${variantLowered}")
val outSrc = file("$outSrcDir/org/lsposed/lspd/util/SignInfo.java") val outSrc = file("$outSrcDir/org/lsposed/lspd/util/SignInfo.java")

View File

@ -1,7 +1,9 @@
package org.lsposed.lspd.service; package org.lsposed.lspd.service;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.os.Build;
import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor;
import android.os.Process;
import android.os.SELinux; import android.os.SELinux;
import android.os.SystemProperties; import android.os.SystemProperties;
import android.system.Os; import android.system.Os;
@ -50,8 +52,9 @@ public class LogcatService implements Runnable {
@SuppressLint("UnsafeDynamicallyLoadedCode") @SuppressLint("UnsafeDynamicallyLoadedCode")
public LogcatService() { public LogcatService() {
String libraryPath = System.getProperty("lsp.library.path"); String classPath = System.getProperty("java.class.path");
System.load(libraryPath + "/" + System.mapLibraryName("daemon")); var abi = Process.is64Bit() ? Build.SUPPORTED_64_BIT_ABIS[0] : Build.SUPPORTED_32_BIT_ABIS[0];
System.load(classPath + "!/lib/" + abi + "/" + System.mapLibraryName("daemon"));
ConfigFileManager.moveLogDir(); ConfigFileManager.moveLogDir();
// Meizu devices set this prop and prevent debug logs from being recorded // Meizu devices set this prop and prevent debug logs from being recorded

View File

@ -1,7 +1,9 @@
project(dex2oat) project(dex2oat)
cmake_minimum_required(VERSION 3.4.1) cmake_minimum_required(VERSION 3.4.1)
add_executable(dex2oat dex2oat.c) add_library(dex2oat SHARED dex2oat.c)
target_link_options(dex2oat PRIVATE "-fPIE")
target_link_libraries(dex2oat log) target_link_libraries(dex2oat log)

View File

@ -144,7 +144,7 @@ fun afterEval() = android.applicationVariants.forEach { variant ->
"assemble$variantCapped", "assemble$variantCapped",
":app:package$buildTypeCapped", ":app:package$buildTypeCapped",
":daemon:package$buildTypeCapped", ":daemon:package$buildTypeCapped",
":dex2oat:merge${buildTypeCapped}NativeLibs" ":dex2oat:strip${buildTypeCapped}DebugSymbols"
) )
into(magiskDir) into(magiskDir)
from("${rootProject.projectDir}/README.md") from("${rootProject.projectDir}/README.md")
@ -199,16 +199,14 @@ fun afterEval() = android.applicationVariants.forEach { variant ->
rename(".*\\.apk", "daemon.apk") rename(".*\\.apk", "daemon.apk")
} }
into("lib") { into("lib") {
from("${buildDir}/intermediates/cmake/$variantCapped/obj") { from("${buildDir}/intermediates/stripped_native_libs/$variantCapped/out/lib") {
include("**/liblspd.so") include("**/liblspd.so")
} }
from("${project(":daemon").buildDir}/intermediates/cmake/$buildTypeLowered/obj") {
include("**/libdaemon.so")
}
} }
into("bin") { into("bin") {
from("${project(":dex2oat").buildDir}/intermediates/cmake/$buildTypeLowered/obj") { from("${project(":dex2oat").buildDir}/intermediates/stripped_native_libs/$buildTypeLowered/out/lib") {
include("**/dex2oat") include("**/libdex2oat.so")
rename { n -> n.replace("libdex2oat.so", "dex2oat") }
} }
} }
val dexOutPath = if (buildTypeLowered == "release") val dexOutPath = if (buildTypeLowered == "release")
@ -289,7 +287,7 @@ val pushDaemonNative = task<Exec>("pushDaemonNative") {
} }
outputStream.toString().trim() outputStream.toString().trim()
} }
workingDir("${project(":daemon").buildDir}/intermediates/cmake/debug/obj/$abi") workingDir("${project(":daemon").buildDir}/intermediates/stripped_native_libs/debug/out/lib/$abi")
} }
commandLine(adb, "push", "libdaemon.so", "/data/local/tmp/libdaemon.so") commandLine(adb, "push", "libdaemon.so", "/data/local/tmp/libdaemon.so")
} }