Skip to content

Commit 0055a15

Browse files
Allow dry runs for sourcemaps upload on Android for testing
1 parent 247bfd6 commit 0055a15

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

packages/core/datadog-sourcemaps.gradle

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ interface InjectedExecOps {
1111
ExecOperations getExecOps()
1212
}
1313

14+
def isDryRun = (
15+
System.getenv("DATADOG_SOURCEMAPS_DRY_RUN")?.toBoolean() ?:
16+
(project.hasProperty("datadogSourcemapsDryRun") && project.property("datadogSourcemapsDryRun") == "true")
17+
)
18+
1419
afterEvaluate {
1520
def androidExtension = extensions.findByName("android")
1621

@@ -97,7 +102,13 @@ afterEvaluate {
97102
copyDebugId(packagerOutputSourceMapFile.absolutePath, jsOutputSourceMapFile.absolutePath, reactRoot)
98103
}
99104

100-
runShellCommand(uploadSourcemap(jsBundleFile), reactRoot)
105+
def uploadCommand = uploadSourcemap(jsBundleFile);
106+
if (isDryRun) {
107+
logger.lifecycle("Dry run mode enabled, not uploading sourcemaps to Datadog.")
108+
uploadCommand += ["--dry-run"]
109+
}
110+
111+
runShellCommand(uploadCommand, reactRoot)
101112
}
102113
}
103114

0 commit comments

Comments
 (0)