Interface ArtifactView.ViewConfiguration

All Superinterfaces:
HasAttributes, HasConfigurableAttributes<ArtifactView.ViewConfiguration>
Enclosing interface:
ArtifactView

public static interface ArtifactView.ViewConfiguration extends HasConfigurableAttributes<ArtifactView.ViewConfiguration>
Configuration for a defined artifact view.
Since:
4.0
  • Method Details

    • componentFilter

      ArtifactView.ViewConfiguration componentFilter(Spec<? super ComponentIdentifier> componentFilter)
      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 ArtifactView.getFiles() or ArtifactView.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 }
           }
      

      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"
               }
           }
      
    • isLenient

      boolean isLenient()
      Determines whether the view should be resolved in a 'lenient' fashion. When set to true, this view will resolve as many artifacts and/or files as possible collecting any failures. When set to false, any failures will be propagated as exceptions when the view is resolved.
    • setLenient

      void setLenient(boolean lenient)
      Specify if the view should be resolved in a 'lenient' fashion. When set to true, this view will resolve as many artifacts and/or files as possible collecting any failures. When set to false, any failures will be propagated as exceptions when the view is resolved.
    • lenient

      ArtifactView.ViewConfiguration lenient(boolean lenient)
      Specify if the view should be resolved in a 'lenient' fashion. When set to true, this view will resolve as many artifacts and/or files as possible collecting any failures. When set to false, any failures will be propagated as exceptions when the view is resolved.
    • withVariantReselection

      When invoked, this view will disregard existing attributes of its parent configuration and re-resolve the artifacts using only the attributes in the view's attribute container.

      This behavior cannot be unset on a particular view once this method is invoked.

      Since:
      7.5
      API Note:
      Reselection operates on the components already present in the resolved graph: it picks a different variant of each component selected by the original graph resolution. It does not re-run graph resolution. As a consequence, variants that delegate to a different component via an available-at pointer in Gradle Module Metadata are not followed, and the artifacts of the pointed-at component do not appear in the view. To resolve such variants, declare a separate Configuration whose request attributes already select them.