Skip to content
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

Declared styleable attributes not accounted for #664

Closed
ZacSweers opened this issue May 7, 2022 · 1 comment · Fixed by #665
Closed

Declared styleable attributes not accounted for #664

ZacSweers opened this issue May 7, 2022 · 1 comment · Fixed by #665
Labels
bug Something isn't working toolchain:android

Comments

@ZacSweers
Copy link
Contributor

Build scan link

Plugin version

1.1.0

Gradle version

7.4.2

(Optional) Android Gradle Plugin (AGP) version

7.1.3

Describe the bug

Consider this styleable declaration from androidx.swiperefreshlayout

https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:swiperefreshlayout/swiperefreshlayout/src/main/res-public/values/attrs.xml;l=19

I found a case where a library depends on this library and defines a value for this attribute like so

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="Theme.SlackKit.NoActionBar" parent="@style/Theme.MaterialComponents.DayNight.NoActionBar.Bridge">
        ...
        <item name="swipeRefreshLayoutProgressSpinnerBackgroundColor">?android:attr/colorBackground</item>
    </style>
</resources>

DAGP misses this usage and removes the library as unused

To Reproduce
Steps to reproduce the behavior:
See above

Expected behavior

I'd expect it to properly detect this

Additional context

@autonomousapps autonomousapps added bug Something isn't working toolchain:android labels May 7, 2022
@autonomousapps
Copy link
Owner

autonomousapps commented May 9, 2022

@ZacSweers is the only connection between this consumer and the swipe refresh layout library that the library has a public attr type named "swipeRefreshLayoutProgressSpinnerBackgroundColor" and the consumer defines a value for an item with that same name? In other words, is this just a matter of string matching?

I should note that the plugin already understands that the library defines this attr. In other contexts, it can already detect that this attr is used by a consumer. It's a peculariaty of the custom matching algorithm that it currently misses this usage. So what I'm after is a deeper understanding of how to do this matching to accurately detect more usages. (see link for kdoc explaining current algo.)

Screen Shot 2022-05-08 at 9 58 33 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working toolchain:android
Projects
None yet
2 participants