From e2ddaeac029057cd7ad569be9804703a64f052a6 Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Tue, 19 Jun 2018 14:31:44 -0300 Subject: [PATCH] Add gradle task runBreakpadDumpSyms --- android/app/build.gradle | 4 ++++ android/build.gradle | 46 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index ce39cdabf3..85bc4ea68e 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -74,6 +74,10 @@ android { // so our merge has to depend on the external native build variant.externalNativeBuildTasks.each { task -> variant.mergeResources.dependsOn(task) + def dumpSymsTaskName = "runBreakpadDumpSyms${variant.name.capitalize()}"; + def dumpSymsTask = rootProject.getTasksByName(dumpSymsTaskName, false).first() + dumpSymsTask.dependsOn(task) + variant.assemble.dependsOn(dumpSymsTask) } variant.mergeAssets.doLast { diff --git a/android/build.gradle b/android/build.gradle index e2d92fe2f6..a232f31634 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -151,11 +151,11 @@ def packages = [ checksum: '14b02795d774457a33bbc60e00a786bc' ], breakpad: [ - file: 'breakpad.zip', - versionId: '2OwvCCZrF171wnte5T44AnjTYFhhJsGJ', - checksum: 'a46062a3167dfedd4fb4916136e204d2', + file: 'breakpad_dump_syms.zip', + versionId: 'udimLCwfB7tMbfGdE1CcLRt5p0.ehtoM', + checksum: '92b6ace2edb95ea82dca257cf0fe522b', sharedLibFolder: 'lib', - includeLibs: ['libbreakpad_client.a','libbreakpad.a'] + includeLibs: ['libbreakpad_client.a'] ] ] @@ -549,6 +549,44 @@ task cleanDependencies(type: Delete) { delete 'app/src/main/res/values/libs.xml' } +def runBreakpadDumpSyms = { buildType -> + def objDir = new File("${appDir}/build/intermediates/cmake/${buildType}/obj/arm64-v8a") + def stripDebugSymbol = "${appDir}/build/intermediates/transforms/stripDebugSymbol/${buildType}/0/lib/arm64-v8a/" + def outputDir = new File("${appDir}/build/tmp/breakpadDumpSyms") + if (!outputDir.exists()) { + outputDir.mkdirs() + } + + objDir.eachFileRecurse (FileType.FILES) { file -> + if (file.name.endsWith('.so')) { + def output = file.name + ".sym" + def cmdArgs = [ + file.toString(), + stripDebugSymbol + ] + exec { + workingDir HIFI_ANDROID_PRECOMPILED + '/breakpad/bin' + commandLine './dump_syms' + args cmdArgs + standardOutput = new BufferedOutputStream(new FileOutputStream(new File(outputDir, output))) + } + + } + } +} + +task runBreakpadDumpSymsRelease() { + doLast { + runBreakpadDumpSyms("release"); + } +} + +task runBreakpadDumpSymsDebug() { + doLast { + runBreakpadDumpSyms("debug"); + } +} + // FIXME this code is prototyping the desired functionality for doing build time binary dependency resolution.