Java Code Examples for org.gradle.api.artifacts.ModuleVersionSelector#getVersion()

The following examples show how to use org.gradle.api.artifacts.ModuleVersionSelector#getVersion() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RepositoryChainDependencyResolver.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void resolve(DependencyMetaData dependency, BuildableComponentResolveResult result) {
    ModuleVersionSelector requested = dependency.getRequested();
    LOGGER.debug("Attempting to resolve {} using repositories {}", requested, repositoryNames);
    ModuleComponentIdentifier moduleComponentIdentifier = new DefaultModuleComponentIdentifier(requested.getGroup(), requested.getName(), requested.getVersion());
    ModuleVersionIdentifier moduleVersionIdentifier = new DefaultModuleVersionIdentifier(requested.getGroup(), requested.getName(), requested.getVersion());

    List<Throwable> errors = new ArrayList<Throwable>();

    List<ComponentMetaDataResolveState> resolveStates = new ArrayList<ComponentMetaDataResolveState>();
    for (ModuleComponentRepository repository : repositories) {
        resolveStates.add(new ComponentMetaDataResolveState(dependency, moduleComponentIdentifier, repository, componentChooser));
    }

    final RepositoryChainModuleResolution latestResolved = findBestMatch(resolveStates, errors);
    if (latestResolved != null) {
        LOGGER.debug("Using {} from {}", latestResolved.module.getId(), latestResolved.repository);
        for (Throwable error : errors) {
            LOGGER.debug("Discarding resolve failure.", error);
        }

        result.resolved(metaDataFactory.transform(latestResolved));
        return;
    }
    if (!errors.isEmpty()) {
        result.failed(new ModuleVersionResolveException(moduleComponentIdentifier, errors));
    } else {
        for (ComponentMetaDataResolveState resolveState : resolveStates) {
            resolveState.applyTo(result);
        }
        result.notFound(moduleVersionIdentifier);
    }
}
 
Example 2
Source File: RepositoryChainAdapter.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void resolve(DependencyMetaData dependency, BuildableComponentIdResolveResult result) {
    ModuleVersionSelector requested = dependency.getRequested();
    if (versionMatcher.isDynamic(requested.getVersion())) {
        dynamicRevisionResolver.resolve(dependency, result);
    } else {
        DefaultModuleComponentIdentifier id = new DefaultModuleComponentIdentifier(requested.getGroup(), requested.getName(), requested.getVersion());
        DefaultModuleVersionIdentifier mvId = new DefaultModuleVersionIdentifier(requested.getGroup(), requested.getName(), requested.getVersion());
        result.resolved(id, mvId);
    }
}
 
Example 3
Source File: RepositoryChainDependencyResolver.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void resolve(DependencyMetaData dependency, BuildableComponentResolveResult result) {
    ModuleVersionSelector requested = dependency.getRequested();
    LOGGER.debug("Attempting to resolve {} using repositories {}", requested, repositoryNames);
    ModuleComponentIdentifier moduleComponentIdentifier = new DefaultModuleComponentIdentifier(requested.getGroup(), requested.getName(), requested.getVersion());
    ModuleVersionIdentifier moduleVersionIdentifier = new DefaultModuleVersionIdentifier(requested.getGroup(), requested.getName(), requested.getVersion());

    List<Throwable> errors = new ArrayList<Throwable>();

    List<ComponentMetaDataResolveState> resolveStates = new ArrayList<ComponentMetaDataResolveState>();
    for (ModuleComponentRepository repository : repositories) {
        resolveStates.add(new ComponentMetaDataResolveState(dependency, moduleComponentIdentifier, repository, componentChooser));
    }

    final RepositoryChainModuleResolution latestResolved = findBestMatch(resolveStates, errors);
    if (latestResolved != null) {
        LOGGER.debug("Using {} from {}", latestResolved.module.getId(), latestResolved.repository);
        for (Throwable error : errors) {
            LOGGER.debug("Discarding resolve failure.", error);
        }

        result.resolved(metaDataFactory.transform(latestResolved));
        return;
    }
    if (!errors.isEmpty()) {
        result.failed(new ModuleVersionResolveException(moduleComponentIdentifier, errors));
    } else {
        for (ComponentMetaDataResolveState resolveState : resolveStates) {
            resolveState.applyTo(result);
        }
        result.notFound(moduleVersionIdentifier);
    }
}
 
Example 4
Source File: RepositoryChainAdapter.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void resolve(DependencyMetaData dependency, BuildableComponentIdResolveResult result) {
    ModuleVersionSelector requested = dependency.getRequested();
    if (versionMatcher.isDynamic(requested.getVersion())) {
        dynamicRevisionResolver.resolve(dependency, result);
    } else {
        DefaultModuleComponentIdentifier id = new DefaultModuleComponentIdentifier(requested.getGroup(), requested.getName(), requested.getVersion());
        DefaultModuleVersionIdentifier mvId = new DefaultModuleVersionIdentifier(requested.getGroup(), requested.getName(), requested.getVersion());
        result.resolved(id, mvId);
    }
}
 
Example 5
Source File: DefaultModuleComponentSelector.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public static ModuleComponentSelector newSelector(ModuleVersionSelector selector) {
    return new DefaultModuleComponentSelector(selector.getGroup(), selector.getName(), selector.getVersion());
}
 
Example 6
Source File: LazyDependencyToModuleResolver.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public StaticVersionResolveResult(DependencyMetaData dependency) {
    super(dependency);
    ModuleVersionSelector requested = dependency.getRequested();
    id = new DefaultModuleVersionIdentifier(requested.getGroup(), requested.getName(), requested.getVersion());
}
 
Example 7
Source File: ResolveIvyFactory.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ModuleIdentifier transform(ModuleVersionSelector original) {
    return new DefaultModuleIdentifier(original.getGroup(), original.getName() + ":" + original.getVersion());
}
 
Example 8
Source File: DefaultModuleComponentSelector.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public static ModuleComponentSelector newSelector(ModuleVersionSelector selector) {
    return new DefaultModuleComponentSelector(selector.getGroup(), selector.getName(), selector.getVersion());
}
 
Example 9
Source File: LazyDependencyToModuleResolver.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public StaticVersionResolveResult(DependencyMetaData dependency) {
    super(dependency);
    ModuleVersionSelector requested = dependency.getRequested();
    id = new DefaultModuleVersionIdentifier(requested.getGroup(), requested.getName(), requested.getVersion());
}
 
Example 10
Source File: ResolveIvyFactory.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ModuleIdentifier transform(ModuleVersionSelector original) {
    return new DefaultModuleIdentifier(original.getGroup(), original.getName() + ":" + original.getVersion());
}