From 2392a6d54a9309509f42cf6c1988b602eb132408 Mon Sep 17 00:00:00 2001 From: Dr Date: Fri, 12 Jan 2018 19:45:15 +0800 Subject: [PATCH] fix: Clean up sentry requested sourcemap (#327) Sentry requested sourcemap (like for release bundle) should be auto deleted after upload is complete. --- sentry.gradle | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sentry.gradle b/sentry.gradle index 5b7aaed85b..4df9e53068 100644 --- a/sentry.gradle +++ b/sentry.gradle @@ -27,6 +27,7 @@ gradle.projectsEvaluated { def bundleOutput = null; def sourcemapOutput = null; def reactRoot = props.get("workingDir"); + def shouldCleanUp = false; cmdArgs.eachWithIndex{ String arg, int i -> if (arg == "--bundle-output") { @@ -42,6 +43,8 @@ gradle.projectsEvaluated { cmd.push(sourcemapOutput); cmdArgs.push("--sourcemap-output"); cmdArgs.push(sourcemapOutput); + + shouldCleanUp = true } bundleTask.setProperty("commandLine", cmd); @@ -150,8 +153,19 @@ gradle.projectsEvaluated { enabled true } + def cliCleanUpTask = tasks.create( + name: bundleTask.getName() + variant + "SentryUploadCleanUp", + type: Delete) { + description = "clean up extra sourcemap" + + delete sourcemapOutput + }; + bundleTask.doLast { cliTask.execute(); + if (shouldCleanUp) { + cliCleanUpTask.execute(); + } } cliTask.dependsOn(bundleTask)