org.gradle.api.artifacts.ModuleDependency Java Examples
The following examples show how to use
org.gradle.api.artifacts.ModuleDependency.
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: ClientModuleResolver.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
public void resolve(DependencyMetaData dependency, ComponentIdentifier identifier, BuildableComponentResolveResult result) { resolver.resolve(dependency, identifier, result); if (result.getFailure() != null) { return; } if (dependency instanceof DslOriginDependencyMetaData) { ModuleDependency maybeClientModule = ((DslOriginDependencyMetaData) dependency).getSource(); if (maybeClientModule instanceof ClientModule) { ClientModule clientModule = (ClientModule) maybeClientModule; MutableModuleComponentResolveMetaData clientModuleMetaData = ((MutableModuleComponentResolveMetaData)result.getMetaData()).copy(); addClientModuleDependencies(clientModule, clientModuleMetaData); setClientModuleArtifact(clientModuleMetaData); result.setMetaData(clientModuleMetaData); } } }
Example #2
Source File: DefaultMavenPublication.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
public void from(SoftwareComponent component) { if (this.component != null) { throw new InvalidUserDataException(String.format("Maven publication '%s' cannot include multiple components", name)); } this.component = (SoftwareComponentInternal) component; for (Usage usage : this.component.getUsages()) { // TODO Need a smarter way to map usage to artifact classifier for (PublishArtifact publishArtifact : usage.getArtifacts()) { artifact(publishArtifact); } // TODO Need a smarter way to map usage to scope for (ModuleDependency dependency : usage.getDependencies()) { if (dependency instanceof ProjectDependency) { addProjectDependency((ProjectDependency) dependency); } else { addModuleDependency(dependency); } } } }
Example #3
Source File: ClientModuleIvyDependencyDescriptorFactory.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
public EnhancedDependencyDescriptor createDependencyDescriptor(String configuration, ModuleDependency dependency, ModuleDescriptor parent) { ModuleRevisionId moduleRevisionId = createModuleRevisionId(dependency); ClientModule clientModule = getClientModule(dependency); MutableModuleVersionMetaData moduleVersionMetaData = clientModuleMetaDataFactory.createModuleDescriptor( moduleRevisionId, clientModule.getDependencies()); EnhancedDependencyDescriptor dependencyDescriptor = new ClientModuleDependencyDescriptor( clientModule, parent, moduleVersionMetaData, moduleRevisionId, clientModule.isForce(), false, clientModule.isTransitive()); addExcludesArtifactsAndDependencies(configuration, clientModule, dependencyDescriptor); return dependencyDescriptor; }
Example #4
Source File: DefaultMavenPublication.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
public void from(SoftwareComponent component) { if (this.component != null) { throw new InvalidUserDataException(String.format("Maven publication '%s' cannot include multiple components", name)); } this.component = (SoftwareComponentInternal) component; for (Usage usage : this.component.getUsages()) { // TODO Need a smarter way to map usage to artifact classifier for (PublishArtifact publishArtifact : usage.getArtifacts()) { artifact(publishArtifact); } // TODO Need a smarter way to map usage to scope for (ModuleDependency dependency : usage.getDependencies()) { if (dependency instanceof ProjectDependency) { addProjectDependency((ProjectDependency) dependency); } else { addModuleDependency(dependency); } } } }
Example #5
Source File: DefaultClientModuleMetaDataFactory.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private void addDependencyDescriptors(DefaultModuleDescriptor moduleDescriptor, Set<ModuleDependency> dependencies, DependencyDescriptorFactory dependencyDescriptorFactory) { for (ModuleDependency dependency : dependencies) { dependencyDescriptorFactory.addDependencyDescriptor(Dependency.DEFAULT_CONFIGURATION, moduleDescriptor, dependency); } }
Example #6
Source File: ProjectIvyDependencyDescriptorFactory.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public ProjectDependencyMetaData createDependencyDescriptor(String configuration, ModuleDependency dependency, ModuleDescriptor parent) { ProjectDependencyInternal projectDependency = (ProjectDependencyInternal) dependency; projectDependency.beforeResolved(); ModuleRevisionId moduleRevisionId = createModuleRevisionId(dependency); DefaultDependencyDescriptor dependencyDescriptor = new DefaultDependencyDescriptor(parent, moduleRevisionId, false, false, dependency.isTransitive()); addExcludesArtifactsAndDependencies(configuration, dependency, dependencyDescriptor); return new DefaultProjectDependencyMetaData(dependencyDescriptor, projectDependency); }
Example #7
Source File: ProjectIvyDependencyDescriptorFactory.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public ProjectDependencyMetaData createDependencyDescriptor(String configuration, ModuleDependency dependency, ModuleDescriptor parent) { ProjectDependencyInternal projectDependency = (ProjectDependencyInternal) dependency; projectDependency.beforeResolved(); ModuleRevisionId moduleRevisionId = createModuleRevisionId(dependency); DefaultDependencyDescriptor dependencyDescriptor = new DefaultDependencyDescriptor(parent, moduleRevisionId, false, false, dependency.isTransitive()); addExcludesArtifactsAndDependencies(configuration, dependency, dependencyDescriptor); return new DefaultProjectDependencyMetaData(dependencyDescriptor, projectDependency); }
Example #8
Source File: CreateDependencyInfoFile.java From shipkit with MIT License | 5 votes |
private String getDependency(CreateDependencyInfoFileTask task, ModuleDependency dependency) { String result = dependency.getGroup() + SEPARATOR + dependency.getName(); if (!isSubmodule(task, dependency)) { result += SEPARATOR + dependency.getVersion(); } return result; }
Example #9
Source File: CreateDependencyInfoFile.java From shipkit with MIT License | 5 votes |
private String getDependencyWithArtifacts(CreateDependencyInfoFileTask task, ModuleDependency dependency) { String result = getDependency(task, dependency); if (!dependency.getArtifacts().isEmpty()) { //sorting artifacts to assure that they are always in the same order //without depending on Gradle implementation SortedSet<String> artifacts = new TreeSet<>(); for (DependencyArtifact artifact : dependency.getArtifacts()) { artifacts.add(getArtifact(artifact)); } return result + ARTIFACT_INDENT + StringUtil.join(artifacts, ARTIFACT_INDENT); } return result; }
Example #10
Source File: ResolvedConfigurationDependencyGraphVisitor.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private void attachToParents(DependencyGraphBuilder.DependencyEdge dependency, DependencyGraphBuilder.ConfigurationNode childConfiguration, ResolvedConfigurationBuilder oldModelBuilder) { ResolvedConfigurationIdentifier parent = dependency.from.id; ResolvedConfigurationIdentifier child = childConfiguration.id; oldModelBuilder.addChild(parent, child); oldModelBuilder.addParentSpecificArtifacts(child, parent, getArtifacts(dependency, childConfiguration, oldModelBuilder)); if (parent == root.id) { ModuleDependency moduleDependency = dependency.getModuleDependency(); oldModelBuilder.addFirstLevelDependency(moduleDependency, child); } }
Example #11
Source File: DefaultClientModule.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public ClientModule copy() { DefaultClientModule copiedClientModule = new DefaultClientModule(getGroup(), getName(), getVersion(), getConfiguration()); copyTo(copiedClientModule); for (ModuleDependency dependency : dependencies) { copiedClientModule.addDependency(dependency.copy()); } return copiedClientModule; }
Example #12
Source File: DefaultIvyPublication.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public void from(SoftwareComponent component) { if (this.component != null) { throw new InvalidUserDataException(String.format("Ivy publication '%s' cannot include multiple components", name)); } this.component = (SoftwareComponentInternal) component; configurations.maybeCreate("default"); for (Usage usage : this.component.getUsages()) { String conf = usage.getName(); configurations.maybeCreate(conf); configurations.getByName("default").extend(conf); for (PublishArtifact publishArtifact : usage.getArtifacts()) { artifact(publishArtifact).setConf(conf); } for (ModuleDependency dependency : usage.getDependencies()) { // TODO: When we support multiple components or configurable dependencies, we'll need to merge the confs of multiple dependencies with same id. String confMapping = String.format("%s->%s", conf, dependency.getConfiguration()); if (dependency instanceof ProjectDependency) { addProjectDependency((ProjectDependency) dependency, confMapping); } else { addModuleDependency(dependency, confMapping); } } } }
Example #13
Source File: DefaultDependencyDescriptorFactory.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private IvyDependencyDescriptorFactory findFactoryForDependency(ModuleDependency dependency) { for (IvyDependencyDescriptorFactory ivyDependencyDescriptorFactory : dependencyDescriptorFactories) { if (ivyDependencyDescriptorFactory.canConvert(dependency)) { return ivyDependencyDescriptorFactory; } } throw new InvalidUserDataException("Can't map dependency of type: " + dependency.getClass()); }
Example #14
Source File: DefaultClientModuleMetaDataFactory.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public MutableModuleVersionMetaData createModuleDescriptor(ModuleRevisionId moduleRevisionId, Set<ModuleDependency> dependencies) { DefaultModuleDescriptor moduleDescriptor = new DefaultModuleDescriptor(moduleRevisionId, "release", null); moduleDescriptor.addConfiguration(new Configuration(Dependency.DEFAULT_CONFIGURATION)); addDependencyDescriptors(moduleDescriptor, dependencies, dependencyDescriptorFactory); moduleDescriptor.addArtifact(Dependency.DEFAULT_CONFIGURATION, new DefaultArtifact(moduleRevisionId, null, moduleRevisionId.getName(), "jar", "jar")); return new ModuleDescriptorAdapter(moduleDescriptor); }
Example #15
Source File: DefaultClientModuleMetaDataFactory.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private void addDependencyDescriptors(DefaultModuleDescriptor moduleDescriptor, Set<ModuleDependency> dependencies, DependencyDescriptorFactory dependencyDescriptorFactory) { for (ModuleDependency dependency : dependencies) { dependencyDescriptorFactory.addDependencyDescriptor(Dependency.DEFAULT_CONFIGURATION, moduleDescriptor, dependency); } }
Example #16
Source File: DefaultIvyPublication.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public void from(SoftwareComponent component) { if (this.component != null) { throw new InvalidUserDataException(String.format("Ivy publication '%s' cannot include multiple components", name)); } this.component = (SoftwareComponentInternal) component; configurations.maybeCreate("default"); for (Usage usage : this.component.getUsages()) { String conf = usage.getName(); configurations.maybeCreate(conf); configurations.getByName("default").extend(conf); for (PublishArtifact publishArtifact : usage.getArtifacts()) { artifact(publishArtifact).setConf(conf); } for (ModuleDependency dependency : usage.getDependencies()) { // TODO: When we support multiple components or configurable dependencies, we'll need to merge the confs of multiple dependencies with same id. String confMapping = String.format("%s->%s", conf, dependency.getConfiguration()); if (dependency instanceof ProjectDependency) { addProjectDependency((ProjectDependency) dependency, confMapping); } else { addModuleDependency(dependency, confMapping); } } } }
Example #17
Source File: DefaultClientModule.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public ClientModule copy() { DefaultClientModule copiedClientModule = new DefaultClientModule(getGroup(), getName(), getVersion(), getConfiguration()); copyTo(copiedClientModule); for (ModuleDependency dependency : dependencies) { copiedClientModule.addDependency(dependency.copy()); } return copiedClientModule; }
Example #18
Source File: ProjectIvyDependencyDescriptorFactory.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public EnhancedDependencyDescriptor createDependencyDescriptor(String configuration, ModuleDependency dependency, ModuleDescriptor parent) { ProjectDependencyInternal projectDependency = (ProjectDependencyInternal) dependency; projectDependency.beforeResolved(); ModuleRevisionId moduleRevisionId = createModuleRevisionId(dependency); ProjectDependencyDescriptor dependencyDescriptor = new ProjectDependencyDescriptor(projectDependency, parent, moduleRevisionId, false, false, dependency.isTransitive()); addExcludesArtifactsAndDependencies(configuration, dependency, dependencyDescriptor); return dependencyDescriptor; }
Example #19
Source File: ExternalModuleIvyDependencyDescriptorFactory.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public EnhancedDependencyDescriptor createDependencyDescriptor(String configuration, ModuleDependency dependency, ModuleDescriptor parent) { ModuleRevisionId moduleRevisionId = createModuleRevisionId(dependency); EnhancedDependencyDescriptor dependencyDescriptor = new EnhancedDependencyDescriptor( dependency, parent, moduleRevisionId, getExternalModuleDependency(dependency).isForce(), getExternalModuleDependency(dependency).isChanging(), getExternalModuleDependency(dependency).isTransitive()); addExcludesArtifactsAndDependencies(configuration, getExternalModuleDependency(dependency), dependencyDescriptor); return dependencyDescriptor; }
Example #20
Source File: DefaultIvyPublication.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public void from(SoftwareComponent component) { if (this.component != null) { throw new InvalidUserDataException(String.format("Ivy publication '%s' cannot include multiple components", name)); } this.component = (SoftwareComponentInternal) component; configurations.maybeCreate("default"); for (Usage usage : this.component.getUsages()) { String conf = usage.getName(); configurations.maybeCreate(conf); configurations.getByName("default").extend(conf); for (PublishArtifact publishArtifact : usage.getArtifacts()) { artifact(publishArtifact).setConf(conf); } for (ModuleDependency dependency : usage.getDependencies()) { // TODO: When we support multiple components or configurable dependencies, we'll need to merge the confs of multiple dependencies with same id. String confMapping = String.format("%s->%s", conf, dependency.getConfiguration()); if (dependency instanceof ProjectDependency) { addProjectDependency((ProjectDependency) dependency, confMapping); } else { addModuleDependency(dependency, confMapping); } } } }
Example #21
Source File: DefaultDependencyDescriptorFactory.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private IvyDependencyDescriptorFactory findFactoryForDependency(ModuleDependency dependency) { for (IvyDependencyDescriptorFactory ivyDependencyDescriptorFactory : dependencyDescriptorFactories) { if (ivyDependencyDescriptorFactory.canConvert(dependency)) { return ivyDependencyDescriptorFactory; } } throw new InvalidUserDataException("Can't map dependency of type: " + dependency.getClass()); }
Example #22
Source File: QuarkusPlatformTask.java From quarkus with Apache License 2.0 | 5 votes |
protected QuarkusPlatformDescriptor platformDescriptor() { final QuarkusJsonPlatformDescriptorResolver platformResolver = QuarkusJsonPlatformDescriptorResolver.newInstance() .setArtifactResolver(extension().getAppModelResolver()) .setMessageWriter(new GradleMessageWriter(getProject().getLogger())); List<QuarkusPlatformDescriptor> platforms = new ArrayList<>(2); final Configuration impl = getProject().getConfigurations().getByName(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME); impl.getIncoming().getDependencies() .forEach(d -> { if (!(d instanceof ModuleDependency)) { return; } final ModuleDependency module = (ModuleDependency) d; final Category category = module.getAttributes().getAttribute(Category.CATEGORY_ATTRIBUTE); if (category == null || !Category.ENFORCED_PLATFORM.equals(category.getName())) { return; } try { platforms .add(platformResolver.resolveFromBom(module.getGroup(), module.getName(), module.getVersion())); } catch (Exception e) { // not a platform } }); if (platforms.isEmpty()) { throw new GradleException("Failed to determine Quarkus platform for the project"); } if (platforms.size() == 1) { return platforms.get(0); } final CombinedQuarkusPlatformDescriptor.Builder builder = CombinedQuarkusPlatformDescriptor.builder(); for (QuarkusPlatformDescriptor platform : platforms) { builder.addPlatform(platform); } return builder.build(); }
Example #23
Source File: ExternalModuleIvyDependencyDescriptorFactory.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
private ExternalModuleDependency getExternalModuleDependency(ModuleDependency dependency) { return (ExternalModuleDependency) dependency; }
Example #24
Source File: AbstractIvyDependencyDescriptorFactory.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
protected void addExcludesArtifactsAndDependencies(String configuration, ModuleDependency dependency, EnhancedDependencyDescriptor dependencyDescriptor) { addArtifacts(configuration, dependency.getArtifacts(), dependencyDescriptor); addExcludes(configuration, dependency.getExcludeRules(), dependencyDescriptor); addDependencyConfiguration(configuration, dependency, dependencyDescriptor); }
Example #25
Source File: DefaultDependencyDescriptorFactory.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public DependencyMetaData createDependencyDescriptor(String configuration, ModuleDescriptor moduleDescriptor, ModuleDependency dependency) { IvyDependencyDescriptorFactory factoryInternal = findFactoryForDependency(dependency); return factoryInternal.createDependencyDescriptor(configuration, dependency, moduleDescriptor); }
Example #26
Source File: ClientModuleIvyDependencyDescriptorFactory.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
private ClientModule getClientModule(ModuleDependency dependency) { return (ClientModule) dependency; }
Example #27
Source File: ClientModuleIvyDependencyDescriptorFactory.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public boolean canConvert(ModuleDependency dependency) { return dependency instanceof ClientModule; }
Example #28
Source File: EnhancedDependencyDescriptor.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public EnhancedDependencyDescriptor(ModuleDependency moduleDependency, ModuleDescriptor md, ModuleRevisionId mrid, boolean force, boolean changing, boolean transitive) { super(md, mrid, force, changing, transitive); this.moduleDependency = moduleDependency; }
Example #29
Source File: ProjectIvyDependencyDescriptorFactory.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
private ModuleRevisionId createModuleRevisionId(ModuleDependency dependency) { ProjectDependency projectDependency = (ProjectDependency) dependency; Module module = ((ProjectInternal) projectDependency.getDependencyProject()).getModule(); return IvyUtil.createModuleRevisionId(module); }
Example #30
Source File: EnhancedDependencyDescriptor.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public ModuleDependency getModuleDependency() { return moduleDependency; }