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

Add support for "ProviderConvertible" #1281

Open
mr-thierry opened this issue Oct 8, 2024 · 0 comments
Open

Add support for "ProviderConvertible" #1281

mr-thierry opened this issue Oct 8, 2024 · 0 comments
Labels
enhancement New feature or request toolchain:android
Milestone

Comments

@mr-thierry
Copy link

Is your feature request related to a problem? Please describe.
The plugin doesn't support "ProviderConvertible". To be honest, my Gradle understanding is very limited and I'm not sure what are "ProviderConvertible" and how they differ from other dependency. If I put this in my Gradle file:

dependencyAnalysis {
  issues {
    all {
      onUnusedDependencies {     
        exclude(libs.compose.material.icons)
      }
    }
  }
}

It fails with the error:

> Could not find method exclude() for arguments [org.gradle.accessors.dm.LibrariesForLibs$ComposeMaterialIconsLibraryAccessors@5c86a80d] on object of type com.autonomousapps.extension.Issue.

This fixes the issue:

dependencyAnalysis {
  issues {
    all {
      onUnusedDependencies {     
        exclude(libs.compose.material.icons.asProvider())
      }
    }
  }
}

By the way, this is what ComposeMaterialIconsLibraryAccessors looks like:

    public static class ComposeMaterialIconsLibraryAccessors extends SubDependencyFactory implements DependencyNotationSupplier {

        public ComposeMaterialIconsLibraryAccessors(AbstractExternalDependencyFactory owner) { super(owner); }

        /**
         * Dependency provider for <b>icons</b> with <b>androidx.compose.material:material-icons-core</b> coordinates and
         * with <b>no version specified</b>
         * <p>
         * This dependency was declared in catalog libs.versions.toml
         */
        public Provider<MinimalExternalModuleDependency> asProvider() {
            return create("compose.material.icons");
        }

        /**
         * Dependency provider for <b>extended</b> with <b>androidx.compose.material:material-icons-extended</b> coordinates and
         * with <b>no version specified</b>
         * <p>
         * This dependency was declared in catalog libs.versions.toml
         */
        public Provider<MinimalExternalModuleDependency> getExtended() {
            return create("compose.material.icons.extended");
        }

    }

ComposeMaterialIconsLibraryAccessors extends DependencyNotationSupplier, which in turn extends ProviderConvertible

I'm raising this feature request because it would be great if we could put directly exclude(libs.compose.material.icons). Should be easy to just modify Issue.kt to also support ProviderConvertible, which has function asProvider().

@autonomousapps autonomousapps added this to the next milestone Oct 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request toolchain:android
Projects
None yet
Development

No branches or pull requests

2 participants