Skip to content

Commit f153cc2

Browse files
nesterov-nbretthoerner
authored andcommitted
Allow overriding Sentry Organization and Project per buildType. (thanks nesterov-n)
1 parent 07c2d65 commit f153cc2

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ Version 1.7.18
22
--------------
33

44
- Fix `--no-upload` option in Sentry Gradle Plugin under newer Groovy.
5+
- Allow overriding Sentry Organization and Project per buildType. (thanks nesterov-n)
56

67
Version 1.7.17
78
--------------

sentry-android-gradle-plugin/src/main/groovy/io/sentry/android/gradle/SentryPlugin.groovy

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import org.apache.tools.ant.taskdefs.condition.Os
1212

1313
class SentryPlugin implements Plugin<Project> {
1414
static final String GROUP_NAME = 'Sentry'
15+
private static final String SENTRY_ORG_PARAMETER = "sentryOrg"
16+
private static final String SENTRY_PROJECT_PARAMETER = "sentryProject"
1517

1618
/**
1719
* Return the correct sentry-cli executable path to use for the given project. This
@@ -247,6 +249,16 @@ class SentryPlugin implements Plugin<Project> {
247249
args << "--no-upload"
248250
}
249251

252+
def buildTypeProperties = variant.buildType.ext
253+
if (buildTypeProperties.has(SENTRY_ORG_PARAMETER)) {
254+
args.add("--org")
255+
args.add(buildTypeProperties.get(SENTRY_ORG_PARAMETER).toString())
256+
}
257+
if (buildTypeProperties.has(SENTRY_PROJECT_PARAMETER)) {
258+
args.add("--project")
259+
args.add(buildTypeProperties.get(SENTRY_PROJECT_PARAMETER).toString())
260+
}
261+
250262
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
251263
commandLine("cmd", "/c", *args)
252264
} else {

0 commit comments

Comments
 (0)