org.gradle.api.artifacts.component.ComponentSelector Java Examples
The following examples show how to use
org.gradle.api.artifacts.component.ComponentSelector.
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: AbstractRenderableDependencyResult.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
public String getName() { ComponentSelector requested = getRequested(); ComponentIdentifier selected = getActual(); if(requested.matchesStrictly(selected)) { return getSimpleName(); } if(requested instanceof ModuleComponentSelector && selected instanceof ModuleComponentIdentifier) { ModuleComponentSelector requestedModuleComponentSelector = (ModuleComponentSelector)requested; ModuleComponentIdentifier selectedModuleComponentedIdentifier = (ModuleComponentIdentifier)selected; if(isSameGroupAndModuleButDifferentVersion(requestedModuleComponentSelector, selectedModuleComponentedIdentifier)) { return getSimpleName() + " -> " + selectedModuleComponentedIdentifier.getVersion(); } } return getSimpleName() + " -> " + selected.getDisplayName(); }
Example #2
Source File: AbstractRenderableDependencyResult.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
public String getName() { ComponentSelector requested = getRequested(); ComponentIdentifier selected = getActual(); if(requested.matchesStrictly(selected)) { return getSimpleName(); } if(requested instanceof ModuleComponentSelector && selected instanceof ModuleComponentIdentifier) { ModuleComponentSelector requestedModuleComponentSelector = (ModuleComponentSelector)requested; ModuleComponentIdentifier selectedModuleComponentedIdentifier = (ModuleComponentIdentifier)selected; if(isSameGroupAndModuleButDifferentVersion(requestedModuleComponentSelector, selectedModuleComponentedIdentifier)) { return getSimpleName() + " -> " + selectedModuleComponentedIdentifier.getVersion(); } } return getSimpleName() + " -> " + selected.getDisplayName(); }
Example #3
Source File: ComponentSelectorSerializer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
public void write(Encoder encoder, ComponentSelector value) throws IOException { if(value == null) { throw new IllegalArgumentException("Provided component selector may not be null"); } if(value instanceof DefaultModuleComponentSelector) { ModuleComponentSelector moduleComponentSelector = (ModuleComponentSelector)value; encoder.writeByte(Implementation.MODULE.getId()); encoder.writeString(moduleComponentSelector.getGroup()); encoder.writeString(moduleComponentSelector.getModule()); encoder.writeString(moduleComponentSelector.getVersion()); } else if(value instanceof DefaultProjectComponentSelector) { ProjectComponentSelector projectComponentSelector = (ProjectComponentSelector)value; encoder.writeByte(Implementation.BUILD.getId()); encoder.writeString(projectComponentSelector.getProjectPath()); } else { throw new IllegalArgumentException("Unsupported component selector class: " + value.getClass()); } }
Example #4
Source File: RenderableUnresolvedDependencyResult.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
public String getName() { ComponentSelector requested = dependency.getRequested(); ComponentSelector attempted = dependency.getAttempted(); if(requested.equals(attempted)) { return requested.getDisplayName(); } if(requested instanceof ModuleComponentSelector && attempted instanceof ModuleComponentSelector) { ModuleComponentSelector requestedSelector = (ModuleComponentSelector)requested; ModuleComponentSelector attemptedSelector = (ModuleComponentSelector)attempted; if(requestedSelector.getGroup().equals(attemptedSelector.getGroup()) && requestedSelector.getModule().equals(attemptedSelector.getModule()) && !requestedSelector.getVersion().equals(attemptedSelector.getVersion())) { return requested.getDisplayName() + " -> " + ((ModuleComponentSelector) attempted).getVersion(); } } return requested.getDisplayName() + " -> " + attempted.getDisplayName(); }
Example #5
Source File: RenderableUnresolvedDependencyResult.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
public String getName() { ComponentSelector requested = dependency.getRequested(); ComponentSelector attempted = dependency.getAttempted(); if(requested.equals(attempted)) { return requested.getDisplayName(); } if(requested instanceof ModuleComponentSelector && attempted instanceof ModuleComponentSelector) { ModuleComponentSelector requestedSelector = (ModuleComponentSelector)requested; ModuleComponentSelector attemptedSelector = (ModuleComponentSelector)attempted; if(requestedSelector.getGroup().equals(attemptedSelector.getGroup()) && requestedSelector.getModule().equals(attemptedSelector.getModule()) && !requestedSelector.getVersion().equals(attemptedSelector.getVersion())) { return requested.getDisplayName() + " -> " + ((ModuleComponentSelector) attempted).getVersion(); } } return requested.getDisplayName() + " -> " + attempted.getDisplayName(); }
Example #6
Source File: ComponentSelectorSerializer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
public void write(Encoder encoder, ComponentSelector value) throws IOException { if(value == null) { throw new IllegalArgumentException("Provided component selector may not be null"); } if(value instanceof DefaultModuleComponentSelector) { ModuleComponentSelector moduleComponentSelector = (ModuleComponentSelector)value; encoder.writeByte(Implementation.MODULE.getId()); encoder.writeString(moduleComponentSelector.getGroup()); encoder.writeString(moduleComponentSelector.getModule()); encoder.writeString(moduleComponentSelector.getVersion()); } else if(value instanceof DefaultProjectComponentSelector) { ProjectComponentSelector projectComponentSelector = (ProjectComponentSelector)value; encoder.writeByte(Implementation.BUILD.getId()); encoder.writeString(projectComponentSelector.getProjectPath()); } else { throw new IllegalArgumentException("Unsupported component selector class: " + value.getClass()); } }
Example #7
Source File: AbstractRenderableDependencyResult.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
public String getName() { ComponentSelector requested = getRequested(); ComponentIdentifier selected = getActual(); if(requested.matchesStrictly(selected)) { return getSimpleName(); } if(requested instanceof ModuleComponentSelector && selected instanceof ModuleComponentIdentifier) { ModuleComponentSelector requestedModuleComponentSelector = (ModuleComponentSelector)requested; ModuleComponentIdentifier selectedModuleComponentedIdentifier = (ModuleComponentIdentifier)selected; if(isSameGroupAndModuleButDifferentVersion(requestedModuleComponentSelector, selectedModuleComponentedIdentifier)) { return getSimpleName() + " -> " + selectedModuleComponentedIdentifier.getVersion(); } } return getSimpleName() + " -> " + selected.getDisplayName(); }
Example #8
Source File: AbstractDependencyResult.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public AbstractDependencyResult(ComponentSelector requested, ResolvedComponentResult from) { assert requested != null; assert from != null; this.from = from; this.requested = requested; }
Example #9
Source File: CachingDependencyResultFactory.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public UnresolvedDependencyResult createUnresolvedDependency(ComponentSelector requested, ResolvedComponentResult from, ComponentSelectionReason reason, ModuleVersionResolveException failure) { List<Object> key = asList(requested, from); if (!unresolvedDependencies.containsKey(key)) { unresolvedDependencies.put(key, new DefaultUnresolvedDependencyResult(requested, reason, from, failure)); } return unresolvedDependencies.get(key); }
Example #10
Source File: CachingDependencyResultFactory.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public ResolvedDependencyResult createResolvedDependency(ComponentSelector requested, ResolvedComponentResult from, DefaultResolvedComponentResult selected) { List<Object> key = asList(requested, from, selected); if (!resolvedDependencies.containsKey(key)) { resolvedDependencies.put(key, new DefaultResolvedDependencyResult(requested, selected, from)); } return resolvedDependencies.get(key); }
Example #11
Source File: ComponentSelectorSerializer.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public ComponentSelector read(Decoder decoder) throws IOException { byte id = decoder.readByte(); if(Implementation.BUILD.getId() == id) { return new DefaultProjectComponentSelector(decoder.readString()); } else if(Implementation.MODULE.getId() == id) { return new DefaultModuleComponentSelector(decoder.readString(), decoder.readString(), decoder.readString()); } throw new IllegalArgumentException("Unable to find component selector with id: " + id); }
Example #12
Source File: StrictDependencyResultSpec.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private boolean matchesRequested(DependencyResult candidate) { ComponentSelector requested = candidate.getRequested(); if (moduleIdentifier != null && requested instanceof ModuleComponentSelector) { ModuleComponentSelector requestedSelector = (ModuleComponentSelector) requested; return requestedSelector.getGroup().equals(moduleIdentifier.getGroup()) && requestedSelector.getModule().equals(moduleIdentifier.getName()); } return false; }
Example #13
Source File: CachingDependencyResultFactory.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public UnresolvedDependencyResult createUnresolvedDependency(ComponentSelector requested, ResolvedComponentResult from, ComponentSelectionReason reason, ModuleVersionResolveException failure) { List<Object> key = asList(requested, from); if (!unresolvedDependencies.containsKey(key)) { unresolvedDependencies.put(key, new DefaultUnresolvedDependencyResult(requested, reason, from, failure)); } return unresolvedDependencies.get(key); }
Example #14
Source File: DefaultIdeDependencyResolver.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
/** * Gets unresolved component selectors for a given configuration. * * @param configuration Configuration * @return List of unresolved component selectors */ private List<ComponentSelector> getUnresolvedComponentSelectors(Configuration configuration) { ResolutionResult result = getIncomingResolutionResult(configuration); List<UnresolvedDependencyResult> unresolvedDependencies = findAllUnresolvedDependencyResults(result.getRoot().getDependencies()); List<ComponentSelector> componentSelectors = new ArrayList<ComponentSelector>(); for (UnresolvedDependencyResult unresolvedDependencyResult : unresolvedDependencies) { componentSelectors.add(unresolvedDependencyResult.getAttempted()); } return componentSelectors; }
Example #15
Source File: InternalDependencyResultSerializer.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public InternalDependencyResult read(Decoder decoder, Map<ComponentSelector, ModuleVersionResolveException> failures) throws IOException { ComponentSelector requested = componentSelectorSerializer.read(decoder); byte resultByte = decoder.readByte(); if (resultByte == SUCCESSFUL) { ModuleVersionIdentifier selected = moduleVersionIdentifierSerializer.read(decoder); return new DefaultInternalDependencyResult(requested, selected, null, null); } else if (resultByte == FAILED) { ComponentSelectionReason reason = componentSelectionReasonSerializer.read(decoder); ModuleVersionResolveException failure = failures.get(requested); return new DefaultInternalDependencyResult(requested, null, reason, failure); } else { throw new IllegalArgumentException("Unknown result byte: " + resultByte); } }
Example #16
Source File: DependencyResultSpec.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private boolean matchesRequested(DependencyResult candidate) { ComponentSelector requested = candidate.getRequested(); if(requested instanceof ModuleComponentSelector) { ModuleComponentSelector requestedModule = (ModuleComponentSelector)requested; String requestedCandidate = requestedModule.getGroup() + ":" + requestedModule.getModule() + ":" + requestedModule.getVersion(); return requestedCandidate.contains(stringNotation); } return false; }
Example #17
Source File: InternalDependencyResultSerializer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public InternalDependencyResult read(Decoder decoder, Map<ComponentSelector, ModuleVersionResolveException> failures) throws IOException { ComponentSelector requested = componentSelectorSerializer.read(decoder); byte resultByte = decoder.readByte(); if (resultByte == SUCCESSFUL) { ModuleVersionIdentifier selected = moduleVersionIdentifierSerializer.read(decoder); return new DefaultInternalDependencyResult(requested, selected, null, null); } else if (resultByte == FAILED) { ComponentSelectionReason reason = componentSelectionReasonSerializer.read(decoder); ModuleVersionResolveException failure = failures.get(requested); return new DefaultInternalDependencyResult(requested, null, reason, failure); } else { throw new IllegalArgumentException("Unknown result byte: " + resultByte); } }
Example #18
Source File: DependencyResultSpec.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private boolean matchesRequested(DependencyResult candidate) { ComponentSelector requested = candidate.getRequested(); if(requested instanceof ModuleComponentSelector) { ModuleComponentSelector requestedModule = (ModuleComponentSelector)requested; String requestedCandidate = requestedModule.getGroup() + ":" + requestedModule.getModule() + ":" + requestedModule.getVersion(); return requestedCandidate.contains(stringNotation); } return false; }
Example #19
Source File: ComponentSelectorSerializer.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public ComponentSelector read(Decoder decoder) throws IOException { byte id = decoder.readByte(); if(Implementation.BUILD.getId() == id) { return new DefaultProjectComponentSelector(decoder.readString()); } else if(Implementation.MODULE.getId() == id) { return new DefaultModuleComponentSelector(decoder.readString(), decoder.readString(), decoder.readString()); } throw new IllegalArgumentException("Unable to find component selector with id: " + id); }
Example #20
Source File: DefaultIdeDependencyResolver.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
/** * Gets unresolved IDE repository file dependencies. * * @param configuration Configuration * @return Unresolved IDE repositoru file dependencies */ public List<UnresolvedIdeRepoFileDependency> getUnresolvedIdeRepoFileDependencies(Configuration configuration) { List<ComponentSelector> componentSelectors = getUnresolvedComponentSelectors(configuration); List<UnresolvedIdeRepoFileDependency> unresolvedIdeRepoFileDependencies = new ArrayList<UnresolvedIdeRepoFileDependency>(); for (ComponentSelector componentSelector : componentSelectors) { UnresolvedIdeRepoFileDependency unresolvedIdeRepoFileDependency = new UnresolvedIdeRepoFileDependency(configuration, new File(unresolvedFileName(componentSelector))); unresolvedIdeRepoFileDependencies.add(unresolvedIdeRepoFileDependency); } return unresolvedIdeRepoFileDependencies; }
Example #21
Source File: DefaultInternalDependencyResult.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public DefaultInternalDependencyResult(ComponentSelector requested, ModuleVersionIdentifier selected, ComponentSelectionReason reason, ModuleVersionResolveException failure) { assert requested != null; assert failure != null || selected != null; this.requested = requested; this.reason = reason; this.selected = selected; this.failure = failure; }
Example #22
Source File: DefaultIdeDependencyResolver.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
/** * Gets unresolved IDE repository file dependencies. * * @param configuration Configuration * @return Unresolved IDE repositoru file dependencies */ public List<UnresolvedIdeRepoFileDependency> getUnresolvedIdeRepoFileDependencies(Configuration configuration) { List<ComponentSelector> componentSelectors = getUnresolvedComponentSelectors(configuration); List<UnresolvedIdeRepoFileDependency> unresolvedIdeRepoFileDependencies = new ArrayList<UnresolvedIdeRepoFileDependency>(); for (ComponentSelector componentSelector : componentSelectors) { UnresolvedIdeRepoFileDependency unresolvedIdeRepoFileDependency = new UnresolvedIdeRepoFileDependency(configuration, new File(unresolvedFileName(componentSelector))); unresolvedIdeRepoFileDependencies.add(unresolvedIdeRepoFileDependency); } return unresolvedIdeRepoFileDependencies; }
Example #23
Source File: DefaultIdeDependencyResolver.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
/** * Gets unresolved component selectors for a given configuration. * * @param configuration Configuration * @return List of unresolved component selectors */ private List<ComponentSelector> getUnresolvedComponentSelectors(Configuration configuration) { ResolutionResult result = getIncomingResolutionResult(configuration); List<UnresolvedDependencyResult> unresolvedDependencies = findAllUnresolvedDependencyResults(result.getRoot().getDependencies()); List<ComponentSelector> componentSelectors = new ArrayList<ComponentSelector>(); for (UnresolvedDependencyResult unresolvedDependencyResult : unresolvedDependencies) { componentSelectors.add(unresolvedDependencyResult.getAttempted()); } return componentSelectors; }
Example #24
Source File: AbstractDependencyResult.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public AbstractDependencyResult(ComponentSelector requested, ResolvedComponentResult from) { assert requested != null; assert from != null; this.from = from; this.requested = requested; }
Example #25
Source File: DependencyResultSpec.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private boolean matchesRequested(DependencyResult candidate) { ComponentSelector requested = candidate.getRequested(); if(requested instanceof ModuleComponentSelector) { ModuleComponentSelector requestedModule = (ModuleComponentSelector)requested; String requestedCandidate = requestedModule.getGroup() + ":" + requestedModule.getModule() + ":" + requestedModule.getVersion(); return requestedCandidate.contains(stringNotation); } return false; }
Example #26
Source File: DefaultDependencyMetaData.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public ComponentSelector getSelector() { if(dependencyDescriptor instanceof ProjectDependencyDescriptor) { return new DefaultProjectComponentSelector(((ProjectDependencyDescriptor)dependencyDescriptor).getTargetProject().getPath()); } return DefaultModuleComponentSelector.newSelector(requested.getGroup(), requested.getName(), requested.getVersion()); }
Example #27
Source File: ComponentSelectorSerializer.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public ComponentSelector read(Decoder decoder) throws IOException { byte id = decoder.readByte(); if(Implementation.BUILD.getId() == id) { return new DefaultProjectComponentSelector(decoder.readString()); } else if(Implementation.MODULE.getId() == id) { return new DefaultModuleComponentSelector(decoder.readString(), decoder.readString(), decoder.readString()); } throw new IllegalArgumentException("Unable to find component selector with id: " + id); }
Example #28
Source File: CachingDependencyResultFactory.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public ResolvedDependencyResult createResolvedDependency(ComponentSelector requested, ResolvedComponentResult from, DefaultResolvedComponentResult selected) { List<Object> key = asList(requested, from, selected); if (!resolvedDependencies.containsKey(key)) { resolvedDependencies.put(key, new DefaultResolvedDependencyResult(requested, selected, from)); } return resolvedDependencies.get(key); }
Example #29
Source File: InternalDependencyResultSerializer.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public InternalDependencyResult read(Decoder decoder, Map<ComponentSelector, ModuleVersionResolveException> failures) throws IOException { ComponentSelector requested = componentSelectorSerializer.read(decoder); byte resultByte = decoder.readByte(); if (resultByte == SUCCESSFUL) { ModuleVersionIdentifier selected = moduleVersionIdentifierSerializer.read(decoder); return new DefaultInternalDependencyResult(requested, selected, null, null); } else if (resultByte == FAILED) { ComponentSelectionReason reason = componentSelectionReasonSerializer.read(decoder); ModuleVersionResolveException failure = failures.get(requested); return new DefaultInternalDependencyResult(requested, null, reason, failure); } else { throw new IllegalArgumentException("Unknown result byte: " + resultByte); } }
Example #30
Source File: CachingDependencyResultFactory.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public ResolvedDependencyResult createResolvedDependency(ComponentSelector requested, ResolvedComponentResult from, DefaultResolvedComponentResult selected) { List<Object> key = asList(requested, from, selected); if (!resolvedDependencies.containsKey(key)) { resolvedDependencies.put(key, new DefaultResolvedDependencyResult(requested, selected, from)); } return resolvedDependencies.get(key); }