1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Merge pull request #105605 from m4gr3d/setup_debug_symbols

Android: Enable native debug symbols generation
This commit is contained in:
Thaddeus Crews
2025-04-22 18:25:49 -05:00
5 changed files with 35 additions and 22 deletions

View File

@@ -86,7 +86,7 @@ if lib_arch_dir != "":
) )
env_android.CommandNoCache(out_dir + "/libc++_shared.so", stl_lib_path, Copy("$TARGET", "$SOURCE")) env_android.CommandNoCache(out_dir + "/libc++_shared.so", stl_lib_path, Copy("$TARGET", "$SOURCE"))
def generate_apk(target, source, env): def generate_android_binaries(target, source, env):
gradle_process = [] gradle_process = []
if sys.platform.startswith("win"): if sys.platform.startswith("win"):
@@ -103,7 +103,7 @@ if lib_arch_dir != "":
"--quiet", "--quiet",
] ]
if env["debug_symbols"]: if env["gradle_do_not_strip"]:
gradle_process += ["-PdoNotStrip=true"] gradle_process += ["-PdoNotStrip=true"]
subprocess.run( subprocess.run(
@@ -111,5 +111,7 @@ if lib_arch_dir != "":
cwd="platform/android/java", cwd="platform/android/java",
) )
if env["generate_apk"]: if env["generate_android_binaries"]:
env_android.AlwaysBuild(env_android.CommandNoCache("generate_apk", lib, env.Run(generate_apk))) env_android.AlwaysBuild(
env_android.CommandNoCache("generate_android_binaries", lib, env.Run(generate_android_binaries))
)

View File

@@ -34,8 +34,13 @@ def get_opts():
"android-" + str(get_min_target_api()), "android-" + str(get_min_target_api()),
), ),
BoolVariable("store_release", "Editor build for Google Play Store (for official builds only)", False), BoolVariable("store_release", "Editor build for Google Play Store (for official builds only)", False),
BoolVariable("generate_apk", "Generate an APK/AAB after building Android library by calling Gradle", False), BoolVariable(
"generate_android_binaries",
"Generate APK, AAB & AAR binaries after building Android library by calling Gradle",
False,
),
BoolVariable("swappy", "Use Swappy Frame Pacing library", False), BoolVariable("swappy", "Use Swappy Frame Pacing library", False),
BoolVariable("gradle_do_not_strip", "Whether Gradle should strip the Android *.so libraries or not", False),
] ]

View File

@@ -101,6 +101,7 @@ android {
} }
ndk { ndk {
debugSymbolLevel 'FULL'
String[] export_abi_list = getExportEnabledABIs() String[] export_abi_list = getExportEnabledABIs()
abiFilters export_abi_list abiFilters export_abi_list
} }

View File

@@ -173,10 +173,15 @@ def generateBuildTasks(String flavor = "template", String edition = "standard",
buildTasks += tasks.create(name: copyBinaryTaskName, type: Copy) { buildTasks += tasks.create(name: copyBinaryTaskName, type: Copy) {
String filenameSuffix = edition == "mono" ? "${edition}${capitalizedTarget}" : target String filenameSuffix = edition == "mono" ? "${edition}${capitalizedTarget}" : target
dependsOn ":app:assemble${capitalizedEdition}${capitalizedTarget}" dependsOn ":app:assemble${capitalizedEdition}${capitalizedTarget}"
from("app/build/outputs/apk/${edition}/${target}") from("app/build/outputs/apk/${edition}/${target}") {
into(binDir)
include("android_${filenameSuffix}.apk") include("android_${filenameSuffix}.apk")
} }
from("app/build/outputs/native-debug-symbols/${edition}${capitalizedTarget}") {
include("native-debug-symbols.zip")
rename ("native-debug-symbols.zip", "android-template-${edition}-${target}-native-debug-symbols.zip")
}
into(binDir)
}
} }
} else { } else {
// Copy the generated editor apk to the bin directory. // Copy the generated editor apk to the bin directory.
@@ -186,10 +191,15 @@ def generateBuildTasks(String flavor = "template", String edition = "standard",
} else { } else {
buildTasks += tasks.create(name: copyEditorApkTaskName, type: Copy) { buildTasks += tasks.create(name: copyEditorApkTaskName, type: Copy) {
dependsOn ":editor:assemble${capitalizedAndroidDistro}${capitalizedTarget}" dependsOn ":editor:assemble${capitalizedAndroidDistro}${capitalizedTarget}"
from("editor/build/outputs/apk/${androidDistro}/${target}") from("editor/build/outputs/apk/${androidDistro}/${target}") {
into(androidEditorBuildsDir)
include("android_editor-${androidDistro}-${target}*.apk") include("android_editor-${androidDistro}-${target}*.apk")
} }
from("editor/build/outputs/native-debug-symbols/${androidDistro}${capitalizedTarget}") {
include("native-debug-symbols.zip")
rename ("native-debug-symbols.zip", "android-editor-${androidDistro}-${target}-native-debug-symbols.zip")
}
into(androidEditorBuildsDir)
}
} }
// Copy the generated editor aab to the bin directory. // Copy the generated editor aab to the bin directory.
@@ -270,19 +280,6 @@ task generateGodotMonoTemplates {
finalizedBy 'zipGradleBuild' finalizedBy 'zipGradleBuild'
} }
/**
* Generates the same output as generateGodotTemplates but with dev symbols
*/
task generateDevTemplate {
// add parameter to set symbols to true
project.ext.doNotStrip = "true"
gradle.startParameter.excludedTaskNames += templateExcludedBuildTask()
dependsOn = generateBuildTasks("template")
finalizedBy 'zipGradleBuild'
}
task clean(type: Delete) { task clean(type: Delete) {
dependsOn 'cleanGodotEditor' dependsOn 'cleanGodotEditor'
dependsOn 'cleanGodotTemplates' dependsOn 'cleanGodotTemplates'
@@ -326,11 +323,17 @@ task cleanGodotTemplates(type: Delete) {
// Delete the Godot templates in the Godot bin directory // Delete the Godot templates in the Godot bin directory
delete("$binDir/android_debug.apk") delete("$binDir/android_debug.apk")
delete("$binDir/android-template-standard-debug-native-debug-symbols.zip")
delete("$binDir/android_dev.apk") delete("$binDir/android_dev.apk")
delete("$binDir/android-template-standard-dev-native-debug-symbols.zip")
delete("$binDir/android_release.apk") delete("$binDir/android_release.apk")
delete("$binDir/android-template-standard-release-native-debug-symbols.zip")
delete("$binDir/android_monoDebug.apk") delete("$binDir/android_monoDebug.apk")
delete("$binDir/android-template-mono-debug-native-debug-symbols.zip")
delete("$binDir/android_monoDev.apk") delete("$binDir/android_monoDev.apk")
delete("$binDir/android-template-mono-dev-native-debug-symbols.zip")
delete("$binDir/android_monoRelease.apk") delete("$binDir/android_monoRelease.apk")
delete("$binDir/android-template-mono-release-native-debug-symbols.zip")
delete("$binDir/android_source.zip") delete("$binDir/android_source.zip")
delete("$binDir/godot-lib.template_debug.aar") delete("$binDir/godot-lib.template_debug.aar")
delete("$binDir/godot-lib.template_debug.dev.aar") delete("$binDir/godot-lib.template_debug.dev.aar")

View File

@@ -89,6 +89,8 @@ android {
editorAppName: "Godot Engine 4", editorAppName: "Godot Engine 4",
editorBuildSuffix: "" editorBuildSuffix: ""
] ]
ndk { debugSymbolLevel 'FULL' }
} }
base { base {