Skip to content

Commit

Permalink
fix(gradle): Use application variant instead of varian output to hook…
Browse files Browse the repository at this point in the history
… to correct package task for modules cleanup (#3161)
  • Loading branch information
krystofwoldrich authored Aug 7, 2023
1 parent ee696ea commit f43e5fc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## 5.8.1

### Fixed

- Use application variant instead of variant output to hook to correct package task for modules cleanup ([#3161](https://github.com/getsentry/sentry-react-native/pull/3161))

### Dependencies

- Bump JavaScript SDK from v7.60.1 to v7.61.0 ([#3222](https://github.com/getsentry/sentry-react-native/pull/3222))
Expand Down
11 changes: 5 additions & 6 deletions sentry.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ gradle.projectsEvaluated {
def releaseName = null
def versionCode = null
def previousCliTask = null
def applicationVariant = null

def nameCleanup = "${bundleTask.name}_SentryUploadCleanUp"
def nameModulesCleanup = "${bundleTask.name}_SentryCollectModulesCleanUp"
Expand All @@ -71,6 +72,7 @@ gradle.projectsEvaluated {
variant = currentVariant[0]
releaseName = currentVariant[1]
versionCode = currentVariant[2]
applicationVariant = currentVariant[3]

try {
if (versionCode instanceof String) {
Expand Down Expand Up @@ -217,13 +219,10 @@ gradle.projectsEvaluated {
delete modulesOutput
}

def variantTaskName = variant.replaceAll("[\\s\\-()]", "") // variant is dev-release beta-release etc.
// task.name could be packageDev-debugRelease but in that case currentVariants == null
// because of the regex in `extractCurrentVariants` and this code doesn't run
def packageTasks = tasks.findAll {
task -> (
"package${variantTaskName}".equalsIgnoreCase(task.name)
|| "package${variantTaskName}Bundle".equalsIgnoreCase(task.name)
"package${applicationVariant}".equalsIgnoreCase(task.name)
|| "package${applicationVariant}Bundle".equalsIgnoreCase(task.name)
) && task.enabled
}
packageTasks.each { packageTask ->
Expand Down Expand Up @@ -265,7 +264,7 @@ def extractReleasesInfo() {
if (releases[variantName] == null) {
releases[variantName] = [:]
}
releases[variantName][outputName] = [outputName, releaseName, versionCode]
releases[variantName][outputName] = [outputName, releaseName, versionCode, variantName]
}
}

Expand Down

0 comments on commit f43e5fc

Please sign in to comment.