Skip to content

Commit c7f00e5

Browse files
DavidMina96HeshamMegid
authored andcommitted
[MOB-12414] Disable Android Sourcemaps Upload with Env Var (#983)
Deprecate instabugUploadEnable gradle property to disable Android Sourcemaps auto upload in favor of INSTABUG_SOURCEMAPS_UPLOAD_DISABLE env variable.
1 parent a8f77b6 commit c7f00e5

File tree

5 files changed

+25
-12
lines changed

5 files changed

+25
-12
lines changed

.circleci/config.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,15 @@ jobs:
8080
name: android/android-machine
8181
tag: '2022.03.1'
8282
working_directory: ~/project/examples/default
83+
environment:
84+
INSTABUG_SOURCEMAPS_UPLOAD_DISABLE: true
8385
steps:
8486
- advanced-checkout/shallow-checkout
8587
- node/install-yarn
8688
- install_node_modules
8789
- android/run-tests:
8890
working-directory: android
89-
test-command: ./gradlew test -PinstabugUploadEnable=false
91+
test-command: ./gradlew test
9092
- persist_to_workspace:
9193
root: ~/project/android/build/reports/jacoco/jacocoTestReport
9294
paths:
@@ -190,6 +192,8 @@ jobs:
190192
name: android/android-machine
191193
tag: 2022.03.1
192194
resource-class: large
195+
environment:
196+
INSTABUG_SOURCEMAPS_UPLOAD_DISABLE: true
193197
steps:
194198
- advanced-checkout/shallow-checkout
195199
- node/install-yarn

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## [Unreleased](https://github.com/Instabug/Instabug-React-Native/compare/v11.10.0...dev)
44

5+
### Deprecated
6+
7+
- Deprecate `instabugUploadEnable` gradle property to disable Android sourcemaps auto upload in favor of `INSTABUG_SOURCEMAPS_UPLOAD_DISABLE` env variable ([#983](https://github.com/Instabug/Instabug-React-Native/pull/983)).
8+
59
### Fixed
610

711
- Fix an issue with unhandled JavaScript crashes being reported as native Android crashes ([#980](https://github.com/Instabug/Instabug-React-Native/pull/980)).

README.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,7 @@ For your app crashes to show up with a fully symbolicated stack trace, we will a
7272
If your app token is defined as a constant, you can set an environment variable `INSTABUG_APP_TOKEN` to be used instead.
7373
We also automatically read your `versionName` and `versionCode` to upload your sourcemap file. alternatively, can also set the environment variables `INSTABUG_APP_VERSION_NAME` and `INSTABUG_APP_VERSION_CODE` to be used instead.
7474

75-
To disable the automatic upload in android, you can set the following property your build.gradle:
76-
77-
```dart
78-
ext {
79-
instabugUploadEnable = false;
80-
}
81-
```
75+
To disable the automatic upload, you can set the environment variable `INSTABUG_SOURCEMAPS_UPLOAD_DISABLE` to TRUE.
8276

8377
## Network Logging
8478

android/sourcemaps.gradle

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ gradle.projectsEvaluated {
1414
task uploadSourcemaps() {
1515
group 'instabug'
1616
description 'Uploads sourcemaps file to Instabug server'
17-
enabled rootProject.hasProperty('instabugUploadEnable')
18-
? new Boolean(rootProject.property('instabugUploadEnable'))
19-
: true
17+
enabled = isUploadSourcemapsEnabled()
2018

2119
doLast {
2220
try {
@@ -59,6 +57,19 @@ task uploadSourcemaps() {
5957
}
6058
}
6159

60+
boolean isUploadSourcemapsEnabled() {
61+
def envValue = System.getenv('INSTABUG_SOURCEMAPS_UPLOAD_DISABLE')?.toBoolean()
62+
def defaultValue = true
63+
64+
if (rootProject.hasProperty('instabugUploadEnable')) {
65+
project.logger.warn "The property instabugUploadEnable is deprecated and will be removed in an upcoming version. \n" +
66+
"You can use INSTABUG_SOURCEMAPS_UPLOAD_DISABLE environment variable instead."
67+
defaultValue = rootProject.property('instabugUploadEnable')
68+
}
69+
70+
return (envValue != null) ? !envValue : defaultValue
71+
}
72+
6273
String resolveVar(String name, String envKey, String defaultValue) {
6374
def env = System.getenv()
6475
def envValue = env.get(envKey)

examples/default/.detoxrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
},
2323
"android.emu.release": {
2424
"binaryPath": "android/app/build/outputs/apk/release/app-release.apk",
25-
"build": "cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release -PinstabugUploadEnable=false && cd ..",
25+
"build": "cd android && ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release && cd ..",
2626
"type": "android.emulator",
2727
"name": "Nexus_6P_API_27"
2828
}

0 commit comments

Comments
 (0)