From 0242e1d4d5cc875e736a414a9b575010b1e379b1 Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Mon, 18 Jun 2018 16:03:30 -0300 Subject: [PATCH 01/18] Use environment variables BACKTRACE_URL and BACKTRACE_TOKEN --- android/app/build.gradle | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 92dece2414..1d51b1ea26 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -28,7 +28,7 @@ android { '-DSTABLE_BUILD=' + STABLE_BUILD, '-DDISABLE_QML=OFF', '-DDISABLE_KTX_CACHE=OFF', - '-DUSE_BREAKPAD=' + (project.hasProperty("BACKTRACE_URL") && project.hasProperty("BACKTRACE_TOKEN") ? 'ON' : 'OFF'); + '-DUSE_BREAKPAD=' + (System.getenv("BACKTRACE_URL") && System.getenv("BACKTRACE_TOKEN") ? 'ON' : 'OFF'); } } signingConfigs { @@ -48,8 +48,8 @@ android { buildTypes { debug { - buildConfigField "String", "BACKTRACE_URL", "\"" + (project.hasProperty("BACKTRACE_URL") ? BACKTRACE_URL : '') + "\"" - buildConfigField "String", "BACKTRACE_TOKEN", "\"" + (project.hasProperty("BACKTRACE_TOKEN") ? BACKTRACE_TOKEN : '') + "\"" + buildConfigField "String", "BACKTRACE_URL", "\"" + (System.getenv("BACKTRACE_URL") ? System.getenv("BACKTRACE_URL") : '') + "\"" + buildConfigField "String", "BACKTRACE_TOKEN", "\"" + (System.getenv("BACKTRACE_TOKEN") ? System.getenv("BACKTRACE_TOKEN") : '') + "\"" } release { minifyEnabled false @@ -58,8 +58,8 @@ android { project.hasProperty("HIFI_ANDROID_KEYSTORE_PASSWORD") && project.hasProperty("HIFI_ANDROID_KEY_ALIAS") && project.hasProperty("HIFI_ANDROID_KEY_PASSWORD")? signingConfigs.release : null - buildConfigField "String", "BACKTRACE_URL", "\"" + (project.hasProperty("BACKTRACE_URL") ? BACKTRACE_URL : '') + "\"" - buildConfigField "String", "BACKTRACE_TOKEN", "\"" + (project.hasProperty("BACKTRACE_TOKEN") ? BACKTRACE_TOKEN : '') + "\"" + buildConfigField "String", "BACKTRACE_URL", "\"" + (System.getenv("BACKTRACE_URL") ? System.getenv("BACKTRACE_URL") : '') + "\"" + buildConfigField "String", "BACKTRACE_TOKEN", "\"" + (System.getenv("BACKTRACE_TOKEN") ? System.getenv("BACKTRACE_TOKEN") : '') + "\"" } } From e1b5564c7bdb37d3a9c24e9c845ed50d818940e1 Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Mon, 18 Jun 2018 16:18:15 -0300 Subject: [PATCH 02/18] Use environment variables BACKTRACE_URL and BACKTRACE_TOKEN (fix) --- android/app/build.gradle | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 1d51b1ea26..ce39cdabf3 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -28,7 +28,7 @@ android { '-DSTABLE_BUILD=' + STABLE_BUILD, '-DDISABLE_QML=OFF', '-DDISABLE_KTX_CACHE=OFF', - '-DUSE_BREAKPAD=' + (System.getenv("BACKTRACE_URL") && System.getenv("BACKTRACE_TOKEN") ? 'ON' : 'OFF'); + '-DUSE_BREAKPAD=' + (System.getenv("CMAKE_BACKTRACE_URL") && System.getenv("CMAKE_BACKTRACE_TOKEN") ? 'ON' : 'OFF'); } } signingConfigs { @@ -48,8 +48,8 @@ android { buildTypes { debug { - buildConfigField "String", "BACKTRACE_URL", "\"" + (System.getenv("BACKTRACE_URL") ? System.getenv("BACKTRACE_URL") : '') + "\"" - buildConfigField "String", "BACKTRACE_TOKEN", "\"" + (System.getenv("BACKTRACE_TOKEN") ? System.getenv("BACKTRACE_TOKEN") : '') + "\"" + buildConfigField "String", "BACKTRACE_URL", "\"" + (System.getenv("CMAKE_BACKTRACE_URL") ? System.getenv("CMAKE_BACKTRACE_URL") : '') + "\"" + buildConfigField "String", "BACKTRACE_TOKEN", "\"" + (System.getenv("CMAKE_BACKTRACE_TOKEN") ? System.getenv("CMAKE_BACKTRACE_TOKEN") : '') + "\"" } release { minifyEnabled false @@ -58,8 +58,8 @@ android { project.hasProperty("HIFI_ANDROID_KEYSTORE_PASSWORD") && project.hasProperty("HIFI_ANDROID_KEY_ALIAS") && project.hasProperty("HIFI_ANDROID_KEY_PASSWORD")? signingConfigs.release : null - buildConfigField "String", "BACKTRACE_URL", "\"" + (System.getenv("BACKTRACE_URL") ? System.getenv("BACKTRACE_URL") : '') + "\"" - buildConfigField "String", "BACKTRACE_TOKEN", "\"" + (System.getenv("BACKTRACE_TOKEN") ? System.getenv("BACKTRACE_TOKEN") : '') + "\"" + buildConfigField "String", "BACKTRACE_URL", "\"" + (System.getenv("CMAKE_BACKTRACE_URL") ? System.getenv("CMAKE_BACKTRACE_URL") : '') + "\"" + buildConfigField "String", "BACKTRACE_TOKEN", "\"" + (System.getenv("CMAKE_BACKTRACE_TOKEN") ? System.getenv("CMAKE_BACKTRACE_TOKEN") : '') + "\"" } } From e2ddaeac029057cd7ad569be9804703a64f052a6 Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Tue, 19 Jun 2018 14:31:44 -0300 Subject: [PATCH 03/18] 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. From 3a473eaa0ebaa5e4d1cc3ab46814c552ceb3488f Mon Sep 17 00:00:00 2001 From: Gabriel Date: Tue, 19 Jun 2018 15:46:07 -0300 Subject: [PATCH 04/18] Update breakpad_dump_syms.zip --- android/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index a232f31634..b98da8bf7e 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -152,8 +152,8 @@ def packages = [ ], breakpad: [ file: 'breakpad_dump_syms.zip', - versionId: 'udimLCwfB7tMbfGdE1CcLRt5p0.ehtoM', - checksum: '92b6ace2edb95ea82dca257cf0fe522b', + versionId: 'yIIByczdMWGm.1f9DztIUoa6Sn3NM3IN', + checksum: '6440dbb25d0e86c8d32ad8b9fa74991c', sharedLibFolder: 'lib', includeLibs: ['libbreakpad_client.a'] ] From 77d53441c052f8a65d958985da943a8a92300b76 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Tue, 19 Jun 2018 16:23:23 -0300 Subject: [PATCH 05/18] Add debug logging --- android/build.gradle | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/android/build.gradle b/android/build.gradle index b98da8bf7e..71a36bc532 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -569,8 +569,11 @@ def runBreakpadDumpSyms = { buildType -> commandLine './dump_syms' args cmdArgs standardOutput = new BufferedOutputStream(new FileOutputStream(new File(outputDir, output))) + errorOutput = new ByteArrayOutputStream() + doLast { + println ("Exec error output: " + errorOutput.toString()) + } } - } } } From af29e10fe9715a23b40e53e28a231a5fa395deec Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Tue, 19 Jun 2018 16:51:22 -0300 Subject: [PATCH 06/18] Adding debug info --- android/app/build.gradle | 2 +- android/build.gradle | 52 +++++++++++++++++++++++++++++++++++----- 2 files changed, 47 insertions(+), 7 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 85bc4ea68e..af7cd9a890 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -74,7 +74,7 @@ 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 dumpSymsTaskName = "uploadBreakpadDumpSyms${variant.name.capitalize()}"; def dumpSymsTask = rootProject.getTasksByName(dumpSymsTaskName, false).first() dumpSymsTask.dependsOn(task) variant.assemble.dependsOn(dumpSymsTask) diff --git a/android/build.gradle b/android/build.gradle index 71a36bc532..b0fd32bc6d 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -21,6 +21,8 @@ buildscript { plugins { id 'de.undercouch.download' version '3.3.0' id "cz.malohlava" version "1.0.3" + id "io.github.http-builder-ng.http-plugin" version "0.1.1" + } allprojects { @@ -550,9 +552,11 @@ task cleanDependencies(type: Delete) { } def runBreakpadDumpSyms = { buildType -> + gradle.startParameter.showStacktrace = ShowStacktrace.ALWAYS + 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") + def outputDir = new File("${appDir}/build/tmp/breakpadDumpSyms/${buildType}") if (!outputDir.exists()) { outputDir.mkdirs() } @@ -564,18 +568,44 @@ def runBreakpadDumpSyms = { buildType -> file.toString(), stripDebugSymbol ] - exec { + println ("Executing " + HIFI_ANDROID_PRECOMPILED + '/breakpad/bin' + "/dump_syms") + println ("Arguments " + cmdArgs) + def result = exec { workingDir HIFI_ANDROID_PRECOMPILED + '/breakpad/bin' commandLine './dump_syms' args cmdArgs standardOutput = new BufferedOutputStream(new FileOutputStream(new File(outputDir, output))) - errorOutput = new ByteArrayOutputStream() - doLast { - println ("Exec error output: " + errorOutput.toString()) - } + } + println ("Done " + result) + println ("E:[" + new File(outputDir, output+".err").text+ "]") + } + } +} + +def uploadDumpSyms = { buildType -> + def tmpDir = "${appDir}/build/tmp/breakpadDumpSyms/${buildType}/" + def zipFilename = "symbols-${RELEASE_NUMBER}.zip" + def zipDir = "${appDir}/build/tmp/breakpadDumpSyms/" + zip { + from tmpDir + include '*/*' + archiveName zipFilename + destinationDir(file(zipDir)) + } + + httpTask { + config { + request.uri = 'https://gcalero998.sp.backtrace.io:6098/post?format=symbols&token=d65d0d184789ac40c121952001fd91dfba7e149899b1eeccd68ccffe91dd2fd0' + } + post { + request.uri.path = '/notify' + request.body = new File(zipDir, zipFilename).bytes + response.success { + println 'Symbols upload successful' } } } + } task runBreakpadDumpSymsRelease() { @@ -590,7 +620,17 @@ task runBreakpadDumpSymsDebug() { } } +task uploadBreakpadDumpSymsRelease(dependsOn: runBreakpadDumpSymsRelease) { + doLast { + uploadDumpSyms("release") + } +} +task uploadBreakpadDumpSymsDebug(dependsOn: runBreakpadDumpSymsDebug) { + doLast { + uploadDumpSyms("debug") + } +} // FIXME this code is prototyping the desired functionality for doing build time binary dependency resolution. // See the comment on the qtBundle task above From f184e9fae827b6fd9e3a89993f3f7305d8b57879 Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Tue, 19 Jun 2018 17:28:50 -0300 Subject: [PATCH 07/18] Debug dump_sym run --- android/app/build.gradle | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index af7cd9a890..3537df033d 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -74,10 +74,10 @@ android { // so our merge has to depend on the external native build variant.externalNativeBuildTasks.each { task -> variant.mergeResources.dependsOn(task) - def dumpSymsTaskName = "uploadBreakpadDumpSyms${variant.name.capitalize()}"; - def dumpSymsTask = rootProject.getTasksByName(dumpSymsTaskName, false).first() - dumpSymsTask.dependsOn(task) - variant.assemble.dependsOn(dumpSymsTask) + def uploadDumpSymsTask = rootProject.getTasksByName("uploadBreakpadDumpSyms${variant.name.capitalize()}", false).first() + def runDumpSymsTask = rootProject.getTasksByName("runBreakpadDumpSyms${variant.name.capitalize()}", false).first() + runDumpSymsTask.dependsOn(task) + variant.assemble.dependsOn(uploadDumpSymsTask) } variant.mergeAssets.doLast { From a7c969f9df702bc41f9253a84fe793ddf2af31ff Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Tue, 19 Jun 2018 17:46:30 -0300 Subject: [PATCH 08/18] Adding debug info --- android/app/build.gradle | 2 ++ 1 file changed, 2 insertions(+) diff --git a/android/app/build.gradle b/android/app/build.gradle index 3537df033d..e67c5c89d7 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -76,7 +76,9 @@ android { variant.mergeResources.dependsOn(task) def uploadDumpSymsTask = rootProject.getTasksByName("uploadBreakpadDumpSyms${variant.name.capitalize()}", false).first() def runDumpSymsTask = rootProject.getTasksByName("runBreakpadDumpSyms${variant.name.capitalize()}", false).first() + println (runDumpSymsTask.name + " dependsOn " + task.name) runDumpSymsTask.dependsOn(task) + println (variant.assemble.name + " dependsOn " + uploadDumpSymsTask.name) variant.assemble.dependsOn(uploadDumpSymsTask) } From 830dfd323358730c8826416b849cb1bb1813ef1a Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Tue, 19 Jun 2018 18:28:19 -0300 Subject: [PATCH 09/18] Debugging gradle script --- android/build.gradle | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index b0fd32bc6d..b312fb8f2c 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -153,9 +153,9 @@ def packages = [ checksum: '14b02795d774457a33bbc60e00a786bc' ], breakpad: [ - file: 'breakpad_dump_syms.zip', - versionId: 'yIIByczdMWGm.1f9DztIUoa6Sn3NM3IN', - checksum: '6440dbb25d0e86c8d32ad8b9fa74991c', + file: 'breakpad.tgz', + versionId: '8VrYXz7oyc.QBxNia0BVJOUBvrFO61jI', + checksum: 'ddcb23df336b08017042ba4786db1d9e', sharedLibFolder: 'lib', includeLibs: ['libbreakpad_client.a'] ] @@ -568,16 +568,12 @@ def runBreakpadDumpSyms = { buildType -> file.toString(), stripDebugSymbol ] - println ("Executing " + HIFI_ANDROID_PRECOMPILED + '/breakpad/bin' + "/dump_syms") - println ("Arguments " + cmdArgs) def result = exec { workingDir HIFI_ANDROID_PRECOMPILED + '/breakpad/bin' commandLine './dump_syms' args cmdArgs standardOutput = new BufferedOutputStream(new FileOutputStream(new File(outputDir, output))) } - println ("Done " + result) - println ("E:[" + new File(outputDir, output+".err").text+ "]") } } } @@ -586,7 +582,7 @@ def uploadDumpSyms = { buildType -> def tmpDir = "${appDir}/build/tmp/breakpadDumpSyms/${buildType}/" def zipFilename = "symbols-${RELEASE_NUMBER}.zip" def zipDir = "${appDir}/build/tmp/breakpadDumpSyms/" - zip { + Zip { from tmpDir include '*/*' archiveName zipFilename From 2a36b85ece38ab6c9458619434b9401cab6400f2 Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Tue, 19 Jun 2018 19:44:15 -0300 Subject: [PATCH 10/18] Debugging gradle script --- android/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/android/build.gradle b/android/build.gradle index b312fb8f2c..72193aaf88 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -572,6 +572,7 @@ def runBreakpadDumpSyms = { buildType -> workingDir HIFI_ANDROID_PRECOMPILED + '/breakpad/bin' commandLine './dump_syms' args cmdArgs + ignoreExitValue true standardOutput = new BufferedOutputStream(new FileOutputStream(new File(outputDir, output))) } } From b42f546b2ad9d98563749b910abb2e8a810bf284 Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Tue, 19 Jun 2018 21:14:44 -0300 Subject: [PATCH 11/18] Debugging gradle script --- android/build.gradle | 58 +++++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 36 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 72193aaf88..80439b1e5b 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -21,8 +21,6 @@ buildscript { plugins { id 'de.undercouch.download' version '3.3.0' id "cz.malohlava" version "1.0.3" - id "io.github.http-builder-ng.http-plugin" version "0.1.1" - } allprojects { @@ -69,6 +67,7 @@ def baseFolder = new File(HIFI_ANDROID_PRECOMPILED) def appDir = new File(projectDir, 'app') def jniFolder = new File(appDir, 'src/main/jniLibs/arm64-v8a') def baseUrl = 'https://hifi-public.s3.amazonaws.com/dependencies/android/' +def breakpadDumpSymsDir = new File("${appDir}/build/tmp/breakpadDumpSyms") def qtFile='qt-5.9.3_linux_armv8-libcpp_openssl.tgz' def qtChecksum='04599670ccca84bd2b15f6915568eb2d' @@ -556,9 +555,8 @@ 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/${buildType}") - if (!outputDir.exists()) { - outputDir.mkdirs() + if (!breakpadDumpSymsDir.exists()) { + breakpadDumpSymsDir.mkdirs() } objDir.eachFileRecurse (FileType.FILES) { file -> @@ -568,43 +566,18 @@ def runBreakpadDumpSyms = { buildType -> file.toString(), stripDebugSymbol ] + println ("Running dump_syms with arguments " + cmdArgs) def result = exec { workingDir HIFI_ANDROID_PRECOMPILED + '/breakpad/bin' commandLine './dump_syms' args cmdArgs ignoreExitValue true - standardOutput = new BufferedOutputStream(new FileOutputStream(new File(outputDir, output))) + standardOutput = new BufferedOutputStream(new FileOutputStream(new File(breakpadDumpSymsDir, output))) } } } } -def uploadDumpSyms = { buildType -> - def tmpDir = "${appDir}/build/tmp/breakpadDumpSyms/${buildType}/" - def zipFilename = "symbols-${RELEASE_NUMBER}.zip" - def zipDir = "${appDir}/build/tmp/breakpadDumpSyms/" - Zip { - from tmpDir - include '*/*' - archiveName zipFilename - destinationDir(file(zipDir)) - } - - httpTask { - config { - request.uri = 'https://gcalero998.sp.backtrace.io:6098/post?format=symbols&token=d65d0d184789ac40c121952001fd91dfba7e149899b1eeccd68ccffe91dd2fd0' - } - post { - request.uri.path = '/notify' - request.body = new File(zipDir, zipFilename).bytes - response.success { - println 'Symbols upload successful' - } - } - } - -} - task runBreakpadDumpSymsRelease() { doLast { runBreakpadDumpSyms("release"); @@ -617,18 +590,31 @@ task runBreakpadDumpSymsDebug() { } } -task uploadBreakpadDumpSymsRelease(dependsOn: runBreakpadDumpSymsRelease) { +task zipDumpSymsDebug(type: Zip, dependsOn: runBreakpadDumpSymsDebug) { + doFirst { + println ("Zipping " + breakpadDumpSymsDir.absolutePath + " into " + breakpadDumpSymsDir) + } + from (breakpadDumpSymsDir.absolutePath) + archiveName "symbols-${RELEASE_NUMBER}.zip" + destinationDir(breakpadDumpSymsDir) doLast { - uploadDumpSyms("release") + println ("Zipped " + breakpadDumpSymsDir.absolutePath + " into " + breakpadDumpSymsDir) } } -task uploadBreakpadDumpSymsDebug(dependsOn: runBreakpadDumpSymsDebug) { +task uploadBreakpadDumpSymsRelease(dependsOn: runBreakpadDumpSymsRelease) { doLast { - uploadDumpSyms("debug") + //uploadDumpSyms("release") } } + +task uploadBreakpadDumpSymsDebug(dependsOn: zipDumpSymsDebug) { + def p = ['curl', '--data-binary', "@"+new File(breakpadDumpSymsDir, "symbols-${RELEASE_NUMBER}.zip").absolutePath, "\"https://gcalero998.sp.backtrace.io:6098/post?format=symbols&token=d65d0d184789ac40c121952001fd91dfba7e149899b1eeccd68ccffe91dd2fd0\""].execute() +} + + + // FIXME this code is prototyping the desired functionality for doing build time binary dependency resolution. // See the comment on the qtBundle task above /* From f8511c52331be6893eeb581cbc01d48f88774466 Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Tue, 19 Jun 2018 21:38:17 -0300 Subject: [PATCH 12/18] Debugging gradle script --- android/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 80439b1e5b..2b5fe2a384 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -596,7 +596,7 @@ task zipDumpSymsDebug(type: Zip, dependsOn: runBreakpadDumpSymsDebug) { } from (breakpadDumpSymsDir.absolutePath) archiveName "symbols-${RELEASE_NUMBER}.zip" - destinationDir(breakpadDumpSymsDir) + destinationDir(new File("${appDir}/build/tmp/")) doLast { println ("Zipped " + breakpadDumpSymsDir.absolutePath + " into " + breakpadDumpSymsDir) } @@ -610,7 +610,7 @@ task uploadBreakpadDumpSymsRelease(dependsOn: runBreakpadDumpSymsRelease) { task uploadBreakpadDumpSymsDebug(dependsOn: zipDumpSymsDebug) { - def p = ['curl', '--data-binary', "@"+new File(breakpadDumpSymsDir, "symbols-${RELEASE_NUMBER}.zip").absolutePath, "\"https://gcalero998.sp.backtrace.io:6098/post?format=symbols&token=d65d0d184789ac40c121952001fd91dfba7e149899b1eeccd68ccffe91dd2fd0\""].execute() + def p = ['curl', '--data-binary', "@"+new File("${appDir}/build/tmp/", "symbols-${RELEASE_NUMBER}.zip").absolutePath, "\"https://gcalero998.sp.backtrace.io:6098/post?format=symbols&token=d65d0d184789ac40c121952001fd91dfba7e149899b1eeccd68ccffe91dd2fd0\""].execute() } From 464f8e128ae38cbe5ef5421738079fb35a2db26e Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Tue, 19 Jun 2018 22:08:27 -0300 Subject: [PATCH 13/18] Debugging gradle script --- android/build.gradle | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/android/build.gradle b/android/build.gradle index 2b5fe2a384..2cd49d6a78 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -610,7 +610,15 @@ task uploadBreakpadDumpSymsRelease(dependsOn: runBreakpadDumpSymsRelease) { task uploadBreakpadDumpSymsDebug(dependsOn: zipDumpSymsDebug) { - def p = ['curl', '--data-binary', "@"+new File("${appDir}/build/tmp/", "symbols-${RELEASE_NUMBER}.zip").absolutePath, "\"https://gcalero998.sp.backtrace.io:6098/post?format=symbols&token=d65d0d184789ac40c121952001fd91dfba7e149899b1eeccd68ccffe91dd2fd0\""].execute() + doLast { + def p = ['curl', '--data-binary', "@"+new File("${appDir}/build/tmp/", "symbols-${RELEASE_NUMBER}.zip").absolutePath, "\"https://gcalero998.sp.backtrace.io:6098/post?format=symbols&token=d65d0d184789ac40c121952001fd91dfba7e149899b1eeccd68ccffe91dd2fd0\""].execute() + p.waitFor() + if (p.exitValue() != 0) { + println "Upload breakpad symbols: curl exited with status " + p.exitValue() + println p.getErrorStream().text + } + + } } From ac533a391346554d9a47c9ecc5012c0512711de4 Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Tue, 19 Jun 2018 23:13:09 -0300 Subject: [PATCH 14/18] Debugging gradle script --- android/build.gradle | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 2cd49d6a78..358335de89 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -21,6 +21,7 @@ buildscript { plugins { id 'de.undercouch.download' version '3.3.0' id "cz.malohlava" version "1.0.3" + id "io.github.http-builder-ng.http-plugin" version "0.1.1" } allprojects { @@ -608,14 +609,17 @@ task uploadBreakpadDumpSymsRelease(dependsOn: runBreakpadDumpSymsRelease) { } } - -task uploadBreakpadDumpSymsDebug(dependsOn: zipDumpSymsDebug) { - doLast { - def p = ['curl', '--data-binary', "@"+new File("${appDir}/build/tmp/", "symbols-${RELEASE_NUMBER}.zip").absolutePath, "\"https://gcalero998.sp.backtrace.io:6098/post?format=symbols&token=d65d0d184789ac40c121952001fd91dfba7e149899b1eeccd68ccffe91dd2fd0\""].execute() - p.waitFor() - if (p.exitValue() != 0) { - println "Upload breakpad symbols: curl exited with status " + p.exitValue() - println p.getErrorStream().text +task uploadBreakpadDumpSymsDebug(type:io.github.httpbuilderng.http.HttpTask, dependsOn: zipDumpSymsDebug) { + config { + request.uri = 'https://gcalero998.sp.backtrace.io:6098' + } + post { + request.uri.path = '/post' + request.uri.query = [format: 'symbols', token: 'd65d0d184789ac40c121952001fd91dfba7e149899b1eeccd68ccffe91dd2fd0'] + request.body = new File("${appDir}/build/tmp/", "symbols-${RELEASE_NUMBER}.zip").bytes + request.contentType = 'application/octet-stream' + response.success { + println ("${appDir}/build/tmp/symbols-${RELEASE_NUMBER}.zip uploaded") } } From 730e14c9d9e41f5118999b825f1a5d9e099f9c65 Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Wed, 20 Jun 2018 10:35:16 -0300 Subject: [PATCH 15/18] Debugging gradle script --- android/app/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index e67c5c89d7..42d8a9680f 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -48,8 +48,8 @@ android { buildTypes { debug { - buildConfigField "String", "BACKTRACE_URL", "\"" + (System.getenv("CMAKE_BACKTRACE_URL") ? System.getenv("CMAKE_BACKTRACE_URL") : '') + "\"" - buildConfigField "String", "BACKTRACE_TOKEN", "\"" + (System.getenv("CMAKE_BACKTRACE_TOKEN") ? System.getenv("CMAKE_BACKTRACE_TOKEN") : '') + "\"" + buildConfigField "String", "BACKTRACE_URL", "\"https://gcalero999.sp.backtrace.io:6098\"" + buildConfigField "String", "BACKTRACE_TOKEN", "\"4ff1f957cd6c357e6e5d5b2fe076f9ca46379a19b7d6baea1707cefb70e7ed15\"" } release { minifyEnabled false From d5e2362ee260bd095435935df8f1c4a384f472e1 Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Wed, 20 Jun 2018 11:32:03 -0300 Subject: [PATCH 16/18] Clean up and complete gradle script --- android/app/build.gradle | 6 ++-- android/build.gradle | 68 +++++++++++++++++++++++----------------- 2 files changed, 42 insertions(+), 32 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 42d8a9680f..3537df033d 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -48,8 +48,8 @@ android { buildTypes { debug { - buildConfigField "String", "BACKTRACE_URL", "\"https://gcalero999.sp.backtrace.io:6098\"" - buildConfigField "String", "BACKTRACE_TOKEN", "\"4ff1f957cd6c357e6e5d5b2fe076f9ca46379a19b7d6baea1707cefb70e7ed15\"" + buildConfigField "String", "BACKTRACE_URL", "\"" + (System.getenv("CMAKE_BACKTRACE_URL") ? System.getenv("CMAKE_BACKTRACE_URL") : '') + "\"" + buildConfigField "String", "BACKTRACE_TOKEN", "\"" + (System.getenv("CMAKE_BACKTRACE_TOKEN") ? System.getenv("CMAKE_BACKTRACE_TOKEN") : '') + "\"" } release { minifyEnabled false @@ -76,9 +76,7 @@ android { variant.mergeResources.dependsOn(task) def uploadDumpSymsTask = rootProject.getTasksByName("uploadBreakpadDumpSyms${variant.name.capitalize()}", false).first() def runDumpSymsTask = rootProject.getTasksByName("runBreakpadDumpSyms${variant.name.capitalize()}", false).first() - println (runDumpSymsTask.name + " dependsOn " + task.name) runDumpSymsTask.dependsOn(task) - println (variant.assemble.name + " dependsOn " + uploadDumpSymsTask.name) variant.assemble.dependsOn(uploadDumpSymsTask) } diff --git a/android/build.gradle b/android/build.gradle index 358335de89..373569ca77 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -556,8 +556,9 @@ 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/" - if (!breakpadDumpSymsDir.exists()) { - breakpadDumpSymsDir.mkdirs() + def outputDir = new File(breakpadDumpSymsDir, buildType) + if (!outputDir.exists()) { + outputDir.mkdirs() } objDir.eachFileRecurse (FileType.FILES) { file -> @@ -567,65 +568,76 @@ def runBreakpadDumpSyms = { buildType -> file.toString(), stripDebugSymbol ] - println ("Running dump_syms with arguments " + cmdArgs) def result = exec { workingDir HIFI_ANDROID_PRECOMPILED + '/breakpad/bin' commandLine './dump_syms' args cmdArgs ignoreExitValue true - standardOutput = new BufferedOutputStream(new FileOutputStream(new File(breakpadDumpSymsDir, output))) + standardOutput = new BufferedOutputStream(new FileOutputStream(new File(outputDir, output))) } } } } -task runBreakpadDumpSymsRelease() { - doLast { - runBreakpadDumpSyms("release"); - } -} - task runBreakpadDumpSymsDebug() { doLast { runBreakpadDumpSyms("debug"); } } -task zipDumpSymsDebug(type: Zip, dependsOn: runBreakpadDumpSymsDebug) { - doFirst { - println ("Zipping " + breakpadDumpSymsDir.absolutePath + " into " + breakpadDumpSymsDir) - } - from (breakpadDumpSymsDir.absolutePath) - archiveName "symbols-${RELEASE_NUMBER}.zip" - destinationDir(new File("${appDir}/build/tmp/")) +task runBreakpadDumpSymsRelease() { doLast { - println ("Zipped " + breakpadDumpSymsDir.absolutePath + " into " + breakpadDumpSymsDir) + runBreakpadDumpSyms("release"); } } -task uploadBreakpadDumpSymsRelease(dependsOn: runBreakpadDumpSymsRelease) { - doLast { - //uploadDumpSyms("release") - } +task zipDumpSymsDebug(type: Zip, dependsOn: runBreakpadDumpSymsDebug) { + from (new File(breakpadDumpSymsDir, "debug").absolutePath) + archiveName "symbols-${RELEASE_NUMBER}-debug.zip" + destinationDir(new File("${appDir}/build/tmp/")) +} + +task zipDumpSymsRelease(type: Zip, dependsOn: runBreakpadDumpSymsRelease) { + from (new File(breakpadDumpSymsDir, "release").absolutePath) + archiveName "symbols-${RELEASE_NUMBER}-release.zip" + destinationDir(new File("${appDir}/build/tmp/")) } task uploadBreakpadDumpSymsDebug(type:io.github.httpbuilderng.http.HttpTask, dependsOn: zipDumpSymsDebug) { + onlyIf { + System.getenv("CMAKE_BACKTRACE_URL") && System.getenv("CMAKE_BACKTRACE_SYMBOLS_TOKEN") + } config { - request.uri = 'https://gcalero998.sp.backtrace.io:6098' + request.uri = System.getenv("CMAKE_BACKTRACE_URL") } post { request.uri.path = '/post' - request.uri.query = [format: 'symbols', token: 'd65d0d184789ac40c121952001fd91dfba7e149899b1eeccd68ccffe91dd2fd0'] - request.body = new File("${appDir}/build/tmp/", "symbols-${RELEASE_NUMBER}.zip").bytes + request.uri.query = [format: 'symbols', token: System.getenv("CMAKE_BACKTRACE_SYMBOLS_TOKEN")] + request.body = new File("${appDir}/build/tmp/", "symbols-${RELEASE_NUMBER}-debug.zip").bytes request.contentType = 'application/octet-stream' response.success { - println ("${appDir}/build/tmp/symbols-${RELEASE_NUMBER}.zip uploaded") + println ("${appDir}/build/tmp/symbols-${RELEASE_NUMBER}-debug.zip uploaded") } - } } - +task uploadBreakpadDumpSymsRelease(type:io.github.httpbuilderng.http.HttpTask, dependsOn: zipDumpSymsRelease) { + onlyIf { + System.getenv("CMAKE_BACKTRACE_URL") && System.getenv("CMAKE_BACKTRACE_SYMBOLS_TOKEN") + } + config { + request.uri = System.getenv("CMAKE_BACKTRACE_URL") + } + post { + request.uri.path = '/post' + request.uri.query = [format: 'symbols', token: System.getenv("CMAKE_BACKTRACE_SYMBOLS_TOKEN")] + request.body = new File("${appDir}/build/tmp/", "symbols-${RELEASE_NUMBER}-release.zip").bytes + request.contentType = 'application/octet-stream' + response.success { + println ("${appDir}/build/tmp/symbols-${RELEASE_NUMBER}-release.zip uploaded") + } + } +} // FIXME this code is prototyping the desired functionality for doing build time binary dependency resolution. // See the comment on the qtBundle task above From 4af0815561f68e482c16f10bfdab6796df070fd0 Mon Sep 17 00:00:00 2001 From: Gabriel Calero Date: Wed, 20 Jun 2018 18:14:06 -0300 Subject: [PATCH 17/18] Add missing annotations to breakpad (version, build_number, build_type) --- interface/src/CrashHandler_Breakpad.cpp | 27 ++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/interface/src/CrashHandler_Breakpad.cpp b/interface/src/CrashHandler_Breakpad.cpp index fe4979853e..f2a174b6ea 100644 --- a/interface/src/CrashHandler_Breakpad.cpp +++ b/interface/src/CrashHandler_Breakpad.cpp @@ -24,6 +24,7 @@ #include #include +#include google_breakpad::ExceptionHandler* gBreakpadHandler; @@ -43,7 +44,23 @@ QString obbDir() { return dataAbsPath; } +void flushAnnotations() { + QSettings settings(obbDir() + "/annotations.json", JSON_FORMAT); + settings.clear(); + settings.beginGroup("Annotations"); + for (auto k : annotations.keys()) { + settings.setValue(k, annotations.value(k)); + } + settings.endGroup(); + settings.sync(); +} + bool startCrashHandler() { + annotations["version"] = BuildInfo::VERSION; + annotations["build_number"] = BuildInfo::BUILD_NUMBER; + annotations["build_type"] = BuildInfo::BUILD_TYPE_STRING; + + flushAnnotations(); gBreakpadHandler = new google_breakpad::ExceptionHandler( google_breakpad::MinidumpDescriptor(obbDir().toStdString()), @@ -56,15 +73,7 @@ void setCrashAnnotation(std::string name, std::string value) { QString qName = QString::fromStdString(name); QString qValue = QString::fromStdString(value); annotations[qName] = qValue; - - QSettings settings(obbDir() + "/annotations.json", JSON_FORMAT); - settings.clear(); - settings.beginGroup("Annotations"); - for (auto k : annotations.keys()) { - settings.setValue(k, annotations.value(k)); - } - settings.endGroup(); - settings.sync(); + flushAnnotations(); } #endif From ea2c1298e5b228641cbb1e24fb2a18919d04c27e Mon Sep 17 00:00:00 2001 From: Gabriel Date: Mon, 25 Jun 2018 19:13:47 -0300 Subject: [PATCH 18/18] Remove crash added with testing purposes only --- scripts/system/+android/audio.js | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/system/+android/audio.js b/scripts/system/+android/audio.js index 50919ed5d1..34dd52604a 100644 --- a/scripts/system/+android/audio.js +++ b/scripts/system/+android/audio.js @@ -46,7 +46,6 @@ function init() { function onMuteClicked() { Audio.muted = !Audio.muted; - Menu.triggerOption("Out of Bounds Vector Access"); } function onMutePressed() {