Search in sources :

Example 1 with MetadataFetchingCost

use of org.gradle.api.internal.artifacts.repositories.resolver.MetadataFetchingCost in project gradle by gradle.

the class RepositoryChainComponentMetaDataResolver method isFetchingMetadataCheap.

@Override
public boolean isFetchingMetadataCheap(ComponentIdentifier identifier) {
    if (identifier instanceof ModuleComponentIdentifier) {
        for (ModuleComponentRepository repository : repositories) {
            ModuleComponentRepositoryAccess localAccess = repository.getLocalAccess();
            MetadataFetchingCost fetchingCost = localAccess.estimateMetadataFetchingCost((ModuleComponentIdentifier) identifier);
            if (fetchingCost.isFast()) {
                return true;
            } else if (fetchingCost.isExpensive()) {
                return false;
            }
        }
    }
    return true;
}
Also used : MetadataFetchingCost(org.gradle.api.internal.artifacts.repositories.resolver.MetadataFetchingCost) ModuleComponentIdentifier(org.gradle.api.artifacts.component.ModuleComponentIdentifier)

Aggregations

ModuleComponentIdentifier (org.gradle.api.artifacts.component.ModuleComponentIdentifier)1 MetadataFetchingCost (org.gradle.api.internal.artifacts.repositories.resolver.MetadataFetchingCost)1