Skip to content

feat(sizeAnalysis): Add enabledVariants property to bypass global ignore rules#1016

Closed
runningcode wants to merge 1 commit intomainfrom
no/size-analysis-enabled-variants
Closed

feat(sizeAnalysis): Add enabledVariants property to bypass global ignore rules#1016
runningcode wants to merge 1 commit intomainfrom
no/size-analysis-enabled-variants

Conversation

@runningcode
Copy link
Copy Markdown
Contributor

Summary

Adds a new enabledVariants property to SizeAnalysisExtension that allows size analysis to run on specific variants, bypassing the global ignore settings (ignoredVariants, ignoredBuildTypes, ignoredFlavors).

This provides fine-grained control over which variants have size analysis enabled, similar to how distribution.enabledVariants works.

Changes

  • Added enabledVariants property to SizeAnalysisExtension with detailed documentation about bypassing behavior
  • Added calculateSizeAnalysisEnabled() helper function that handles variant filtering independently from isVariantAllowed
  • Refactored AndroidComponentsConfig to handle size analysis and distribution filtering independently
  • Added unit tests for the new enabledVariants property
  • Added integration tests for the bypass behavior (some tests failing, need investigation)

Behavior

Empty enabledVariants (default)

sizeAnalysis {
  enabled = true
  // enabledVariants is empty - runs on all variants
}

Size analysis runs on all variants (backward compatible).

Specified variants

sizeAnalysis {
  enabled = true
  enabledVariants = ["release", "staging"]
}

Size analysis runs only on specified variants.

Bypassing global ignores

sentry {
  ignoredVariants = ["debug"]  // Most features ignore debug
  sizeAnalysis {
    enabled = true
    enabledVariants = ["debug", "release"]  // Size analysis runs on both
  }
}

Size analysis can run on variants that are globally ignored.

Master kill-switch

sizeAnalysis {
  enabled = false  // Master switch
  enabledVariants = ["release"]  // Ignored when enabled is false
}

The enabled flag still acts as a master kill-switch.

Known Issues

⚠️ Some integration tests are failing - need to investigate:

  • size analysis runs on all variants when enabledVariants is empty and enabled is true
  • size analysis only runs on specified variants when enabledVariants is not empty
  • size analysis bypasses ignoredVariants when enabledVariants is set

These will be fixed before marking the PR as ready for review.

🤖 Generated with Claude Code

…ore rules

This change adds a new `enabledVariants` property to `SizeAnalysisExtension` that allows size analysis to run on specific variants, bypassing the global ignore settings (`ignoredVariants`, `ignoredBuildTypes`, `ignoredFlavors`).

Key changes:
- Added `enabledVariants: SetProperty<String>` to SizeAnalysisExtension
- Added `calculateSizeAnalysisEnabled()` helper function that bypasses `isVariantAllowed`
- Refactored variant filtering in AndroidComponentsConfig to handle size analysis independently
- Size analysis and distribution features now use independent variant filtering
- When `enabledVariants` is empty (default), size analysis runs on all variants (backward compatible)
- The global `enabled` flag still acts as a master kill-switch

This provides consistency with the distribution feature's filtering approach while maintaining backward compatibility with existing configurations.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

Fails
🚫 Please consider adding a changelog entry for the next release.
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

### Features

- Add enabledVariants property to bypass global ignore rules ([#1016](https://github.com/getsentry/sentry-android-gradle-plugin/pull/1016))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description or adding a skip-changelog label.

Generated by 🚫 dangerJS against f672271

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant