Skip to content

Add variant exclusion per-project in DSL #1461

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

joshfriend
Copy link
Contributor

We have a lot of fake/demo/testing style projects that are only intended for consumption by debug variant apps. Some of these have only debug/ sourcesets. In a perfect world, we would use single-variant android libraries and rely on other tooling to ensure these projects never end up in release builds. Our current state leaves us with a lot of complications if we try to run analysis on both debug and release variants because these debug-only projects often fail to compile in the release configuration, or we are just wasting time by analyzing releaseUnitTest stuff.

I'd propose this as an intermediate solution until a v3.0 where we might have a more advanced DSL for exclusions. What I'd really like to do is be able to exclude release variants for test source sets everywhere.

Copy link
Owner

@autonomousapps autonomousapps left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this on the AbiHandler? The way it's used, it looks like it's causing the variant to be ignored for all use-cases, not just ABI analysis. And given that, why isn't the existing functionality to ignore specific source sets sufficient?

@joshfriend
Copy link
Contributor Author

Why is this on the AbiHandler?

I got it mixed up with the ProjectIssueHandler handler, what I was going for was a project specific version of the global property dependency.analysis.android.ignored.variants that exists currently.

why isn't the existing functionality to ignore specific source sets sufficient?

If I have an Android project with only a debug/ source set, and I use ignoreSourceSet('release') DAGP still compiles and analyzes the variant (or it tries to and fails because the release configuration of some of these debug-only projects is often broken).

@joshfriend joshfriend marked this pull request as draft May 29, 2025 01:13
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.

2 participants