upload zygiskd debug symbols

This commit is contained in:
5ec1cff
2023-12-08 20:32:40 +08:00
parent 4f81f09a67
commit d66dba265c
2 changed files with 19 additions and 3 deletions

View File

@@ -87,3 +87,15 @@ jobs:
with: with:
name: ${{ steps.prepareArtifact.outputs.debugName }} name: ${{ steps.prepareArtifact.outputs.debugName }}
path: "./zksu-debug/*" path: "./zksu-debug/*"
- name: Upload release symbols
uses: actions/upload-artifact@v3
with:
name: ${{ steps.prepareArtifact.outputs.releaseName }}-symbols
path: "zygiskd/build/symbols/release"
- name: Upload debug symbols
uses: actions/upload-artifact@v3
with:
name: ${{ steps.prepareArtifact.outputs.debugName }}-symbols
path: "zygiskd/build/symbols/release"

View File

@@ -31,19 +31,23 @@ cargo {
afterEvaluate { afterEvaluate {
task<Task>("buildAndStrip") { task<Task>("buildAndStrip") {
dependsOn(":zygiskd:cargoBuild") dependsOn(":zygiskd:cargoBuild")
val isDebug = gradle.startParameter.taskNames.any { it.toLowerCase().contains("debug") }
doLast { doLast {
val dir = File(buildDir, "rustJniLibs/android") val dir = File(buildDir, "rustJniLibs/android")
val prebuilt = File(android.ndkDirectory, "toolchains/llvm/prebuilt").listFiles()!!.first() val prebuilt = File(android.ndkDirectory, "toolchains/llvm/prebuilt").listFiles()!!.first()
val binDir = File(prebuilt, "bin") val binDir = File(prebuilt, "bin")
println("binDir $binDir") val symbolDir = File(buildDir, "symbols/${if (isDebug) "debug" else "release"}")
symbolDir.mkdirs()
val suffix = if (prebuilt.name.contains("windows")) ".exe" else "" val suffix = if (prebuilt.name.contains("windows")) ".exe" else ""
val strip = File(binDir, "llvm-strip$suffix") val strip = File(binDir, "llvm-strip$suffix")
val objcopy = File(binDir, "llvm-objcopy$suffix") val objcopy = File(binDir, "llvm-objcopy$suffix")
dir.listFiles()!!.forEach { dir.listFiles()!!.forEach {
if (!it.isDirectory) return@forEach if (!it.isDirectory) return@forEach
val symbolPath = File(symbolDir, "${it.name}/zygiskd.debug")
symbolPath.parentFile.mkdirs()
exec { exec {
workingDir = it workingDir = it
commandLine(objcopy, "--only-keep-debug", "zygiskd", "zygiskd.debug") commandLine(objcopy, "--only-keep-debug", "zygiskd", symbolPath)
} }
exec { exec {
workingDir = it workingDir = it
@@ -51,7 +55,7 @@ afterEvaluate {
} }
exec { exec {
workingDir = it workingDir = it
commandLine(objcopy, "--add-gnu-debuglink", "zygiskd.debug", "zygiskd") commandLine(objcopy, "--add-gnu-debuglink", symbolPath, "zygiskd")
} }
} }
} }