# componentFilter

abstract fun componentFilter(componentFilter: Spec<in ComponentIdentifier>): ArtifactView.ViewConfiguration(source)

Specify a filter for the components that should be included in this view. Only artifacts from components matching the supplied filter will be returned by getFiles or getArtifacts. This method cannot be called multiple times for a view.

A component filter can be used to select artifacts from components of a certain type:

         configuration.incoming.artifactView {
             componentFilter { it instanceof ProjectComponentIdentifier }
             // or
             componentFilter { it instanceof ModuleComponentIdentifier }
         }

Content copied to clipboard

Alternatively, a component filter can be used to select artifacts from specific components:

         configuration.incoming.artifactView {
             componentFilter {
                 it instanceof ProjectComponentIdentifier &&
                 it.projectPath == ":myProject"
             }
             // or
             componentFilter {
                 it instanceof ModuleComponentIdentifier &&
                     it.group == "com.example" &&
                     it.module == "foo"
             }
         }

Content copied to clipboard