org.gradle.internal.component.external.model.DefaultModuleComponentIdentifier Java Examples
The following examples show how to use
org.gradle.internal.component.external.model.DefaultModuleComponentIdentifier.
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: NewestVersionComponentChooser.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
public ModuleComponentIdentifier choose(ModuleVersionListing versions, DependencyMetaData dependency, ModuleComponentRepositoryAccess moduleAccess) { ModuleVersionSelector requested = dependency.getRequested(); Collection<SpecRuleAction<? super ComponentSelection>> rules = componentSelectionRules.getRules(); for (Versioned candidate : sortLatestFirst(versions)) { ModuleComponentIdentifier candidateIdentifier = DefaultModuleComponentIdentifier.newId(requested.getGroup(), requested.getName(), candidate.getVersion()); MetaDataSupplier metaDataSupplier = new MetaDataSupplier(dependency, candidateIdentifier, moduleAccess); if (versionMatches(requested, candidateIdentifier, metaDataSupplier)) { if (!isRejectedByRules(candidateIdentifier, rules, metaDataSupplier)) { return candidateIdentifier; } if (versionMatcher.matchesUniqueVersion(requested.getVersion())) { break; } } } return null; }
Example #2
Source File: ComponentIdentifierSerializer.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
public void write(Encoder encoder, ComponentIdentifier value) throws IOException { if(value == null) { throw new IllegalArgumentException("Provided component identifier may not be null"); } if(value instanceof DefaultModuleComponentIdentifier) { ModuleComponentIdentifier moduleComponentIdentifier = (ModuleComponentIdentifier)value; encoder.writeByte(Implementation.MODULE.getId()); encoder.writeString(moduleComponentIdentifier.getGroup()); encoder.writeString(moduleComponentIdentifier.getModule()); encoder.writeString(moduleComponentIdentifier.getVersion()); } else if(value instanceof DefaultProjectComponentIdentifier) { ProjectComponentIdentifier projectComponentIdentifier = (ProjectComponentIdentifier)value; encoder.writeByte(Implementation.BUILD.getId()); encoder.writeString(projectComponentIdentifier.getProjectPath()); } else { throw new IllegalArgumentException("Unsupported component identifier class: " + value.getClass()); } }
Example #3
Source File: NewestVersionComponentChooser.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
public ModuleComponentIdentifier choose(ModuleVersionListing versions, DependencyMetaData dependency, ModuleComponentRepositoryAccess moduleAccess) { ModuleVersionSelector requested = dependency.getRequested(); Collection<SpecRuleAction<? super ComponentSelection>> rules = componentSelectionRules.getRules(); for (Versioned candidate : sortLatestFirst(versions)) { ModuleComponentIdentifier candidateIdentifier = DefaultModuleComponentIdentifier.newId(requested.getGroup(), requested.getName(), candidate.getVersion()); MetaDataSupplier metaDataSupplier = new MetaDataSupplier(dependency, candidateIdentifier, moduleAccess); if (versionMatches(requested, candidateIdentifier, metaDataSupplier)) { if (!isRejectedByRules(candidateIdentifier, rules, metaDataSupplier)) { return candidateIdentifier; } if (versionMatcher.matchesUniqueVersion(requested.getVersion())) { break; } } } return null; }
Example #4
Source File: ComponentIdentifierSerializer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
public void write(Encoder encoder, ComponentIdentifier value) throws IOException { if(value == null) { throw new IllegalArgumentException("Provided component identifier may not be null"); } if(value instanceof DefaultModuleComponentIdentifier) { ModuleComponentIdentifier moduleComponentIdentifier = (ModuleComponentIdentifier)value; encoder.writeByte(Implementation.MODULE.getId()); encoder.writeString(moduleComponentIdentifier.getGroup()); encoder.writeString(moduleComponentIdentifier.getModule()); encoder.writeString(moduleComponentIdentifier.getVersion()); } else if(value instanceof DefaultProjectComponentIdentifier) { ProjectComponentIdentifier projectComponentIdentifier = (ProjectComponentIdentifier)value; encoder.writeByte(Implementation.BUILD.getId()); encoder.writeString(projectComponentIdentifier.getProjectPath()); } else { throw new IllegalArgumentException("Unsupported component identifier class: " + value.getClass()); } }
Example #5
Source File: RepositoryChainDependencyResolver.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
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 #6
Source File: RepositoryChainAdapter.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
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 #7
Source File: ComponentIdentifierSerializer.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public ComponentIdentifier read(Decoder decoder) throws IOException { byte id = decoder.readByte(); if(Implementation.BUILD.getId() == id) { return new DefaultProjectComponentIdentifier(decoder.readString()); } else if(Implementation.MODULE.getId() == id) { return new DefaultModuleComponentIdentifier(decoder.readString(), decoder.readString(), decoder.readString()); } throw new IllegalArgumentException("Unable to find component identifier with id: " + id); }
Example #8
Source File: DefaultComponentIdentifierFactory.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public ComponentIdentifier createComponentIdentifier(ModuleInternal module) { String projectPath = module.getProjectPath(); if(projectPath != null) { return new DefaultProjectComponentIdentifier(projectPath); } return new DefaultModuleComponentIdentifier(module.getGroup(), module.getName(), module.getVersion()); }
Example #9
Source File: RepositoryChainDependencyResolver.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
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 #10
Source File: RepositoryChainAdapter.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
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 #11
Source File: ComponentIdentifierSerializer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public ComponentIdentifier read(Decoder decoder) throws IOException { byte id = decoder.readByte(); if(Implementation.BUILD.getId() == id) { return new DefaultProjectComponentIdentifier(decoder.readString()); } else if(Implementation.MODULE.getId() == id) { return new DefaultModuleComponentIdentifier(decoder.readString(), decoder.readString(), decoder.readString()); } throw new IllegalArgumentException("Unable to find component identifier with id: " + id); }
Example #12
Source File: DefaultComponentIdentifierFactory.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public ComponentIdentifier createComponentIdentifier(ModuleInternal module) { String projectPath = module.getProjectPath(); if(projectPath != null) { return new DefaultProjectComponentIdentifier(projectPath); } return new DefaultModuleComponentIdentifier(module.getGroup(), module.getName(), module.getVersion()); }
Example #13
Source File: UnresolvedDependencyEdge.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public UnresolvedDependencyEdge(UnresolvedDependencyResult dependency) { this.dependency = dependency; ModuleComponentSelector attempted = (ModuleComponentSelector)dependency.getAttempted(); actual = DefaultModuleComponentIdentifier.newId(attempted.getGroup(), attempted.getModule(), attempted.getVersion()); }
Example #14
Source File: IdeDependenciesExtractor.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
private ModuleComponentIdentifier toComponentIdentifier(ModuleVersionIdentifier id) { return new DefaultModuleComponentIdentifier(id.getGroup(), id.getName(), id.getVersion()); }
Example #15
Source File: UnresolvedDependencyEdge.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public UnresolvedDependencyEdge(UnresolvedDependencyResult dependency) { this.dependency = dependency; ModuleComponentSelector attempted = (ModuleComponentSelector)dependency.getAttempted(); actual = DefaultModuleComponentIdentifier.newId(attempted.getGroup(), attempted.getModule(), attempted.getVersion()); }
Example #16
Source File: IdeDependenciesExtractor.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
private ModuleComponentIdentifier toComponentIdentifier(ModuleVersionIdentifier id) { return new DefaultModuleComponentIdentifier(id.getGroup(), id.getName(), id.getVersion()); }