diff --git a/CHANGELOG.md b/CHANGELOG.md index 6992511886..60c0d734c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - [diff](https://github.com/getsentry/sentry-wizard/compare/v1.2.17...v1.4.0) - Android builds without ext config, auto create assets dir for modules ([#2652](https://github.com/getsentry/sentry-react-native/pull/2652)) - Exit gracefully if source map file for collecting modules doesn't exist ([#2655](https://github.com/getsentry/sentry-react-native/pull/2655)) +- Create only one clean-up tasks for modules collection ([#2657](https://github.com/getsentry/sentry-react-native/pull/2657)) ### Dependencies diff --git a/sentry.gradle b/sentry.gradle index 03eb8db65b..a023126317 100644 --- a/sentry.gradle +++ b/sentry.gradle @@ -194,19 +194,24 @@ gradle.projectsEvaluated { } previousCliTask = cliTask cliTask.finalizedBy modulesTask + } - def modulesCleanUpTask = tasks.create(name: nameModulesCleanup, type: Delete) { - description = "clean up collected modules generated file" - group = 'sentry.io' + def modulesCleanUpTask = tasks.create(name: nameModulesCleanup, type: Delete) { + description = "clean up collected modules generated file" + group = 'sentry.io' - delete modulesOutput - } + delete modulesOutput + } - def packageTasks = tasks.findAll { task -> "package${variant}".equalsIgnoreCase(task.name) && task.enabled } - packageTasks.each { packageTask -> - packageTask.dependsOn modulesTask - packageTask.finalizedBy modulesCleanUpTask - } + 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) && task.enabled + } + packageTasks.each { packageTask -> + packageTask.dependsOn modulesTask + packageTask.finalizedBy modulesCleanUpTask } /** Delete sourcemap files */