Skip to content

Auto-fix for android buildFeatures rules may add code to the wrong android { ... } block #460

@RBusarow

Description

@RBusarow

If the target module has a convention plugin, that convention plugin may have its own non-Google android { ... } configuration block.

example:

plugins {
  id `company-convention-plugin`
}

ourCompany {
  android {
    someSetting true
  }
}

...

In this case, the android block isn't a configuration for BaseExtension/LibraryExtension/etc. It's something else entirely.

But the existing Android parser will see this block and assume that it's Google's. It will add any auto-fixes there.

There's no perfect solution to this. A couple options:

  • Do nothing. In a case like this, the company should either disable the rule, or if they want auto-correct, add a property of the same name to their DSL.
  • Ignore any android blocks which aren't top-level. If it's top-level and an actual Android module, it'll work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions