本文整理汇总了Java中org.gradle.api.artifacts.ModuleDependency类的典型用法代码示例。如果您正苦于以下问题:Java ModuleDependency类的具体用法?Java ModuleDependency怎么用?Java ModuleDependency使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModuleDependency类属于org.gradle.api.artifacts包,在下文中一共展示了ModuleDependency类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createDependencyDescriptor
import org.gradle.api.artifacts.ModuleDependency; //导入依赖的package包/类
public DslOriginDependencyMetadata createDependencyDescriptor(String clientConfiguration, AttributeContainer clientAttributes, ModuleDependency dependency) {
ProjectDependencyInternal projectDependency = (ProjectDependencyInternal) dependency;
projectDependency.beforeResolved();
Module module = getProjectModule(dependency);
ModuleVersionSelector requested = new DefaultModuleVersionSelector(module.getGroup(), module.getName(), module.getVersion());
ComponentSelector selector = DefaultProjectComponentSelector.newSelector(projectDependency.getDependencyProject());
LocalComponentDependencyMetadata dependencyMetaData = new LocalComponentDependencyMetadata(
selector, requested, clientConfiguration,
clientAttributes,
projectDependency.getTargetConfiguration(),
convertArtifacts(dependency.getArtifacts()),
convertExcludeRules(clientConfiguration, dependency.getExcludeRules()),
false, false, dependency.isTransitive());
return new DslOriginDependencyMetadataWrapper(dependencyMetaData, dependency);
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:17,代码来源:ProjectIvyDependencyDescriptorFactory.java
示例2: createDependencyDescriptor
import org.gradle.api.artifacts.ModuleDependency; //导入依赖的package包/类
public DslOriginDependencyMetadata createDependencyDescriptor(String clientConfiguration, AttributeContainer clientAttributes, ModuleDependency dependency) {
ExternalModuleDependency externalModuleDependency = (ExternalModuleDependency) dependency;
boolean force = externalModuleDependency.isForce();
boolean changing = externalModuleDependency.isChanging();
boolean transitive = externalModuleDependency.isTransitive();
ModuleVersionSelector requested = new DefaultModuleVersionSelector(nullToEmpty(dependency.getGroup()), nullToEmpty(dependency.getName()), nullToEmpty(dependency.getVersion()));
ModuleComponentSelector selector = DefaultModuleComponentSelector.newSelector(requested);
LocalComponentDependencyMetadata dependencyMetaData = new LocalComponentDependencyMetadata(
selector, requested, clientConfiguration, clientAttributes, dependency.getTargetConfiguration(),
convertArtifacts(dependency.getArtifacts()),
convertExcludeRules(clientConfiguration, dependency.getExcludeRules()),
force, changing, transitive);
return new DslOriginDependencyMetadataWrapper(dependencyMetaData, dependency);
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:17,代码来源:ExternalModuleIvyDependencyDescriptorFactory.java
示例3: isKeyEquals
import org.gradle.api.artifacts.ModuleDependency; //导入依赖的package包/类
protected boolean isKeyEquals(ModuleDependency dependencyRhs) {
if (getGroup() != null ? !getGroup().equals(dependencyRhs.getGroup()) : dependencyRhs.getGroup() != null) {
return false;
}
if (!getName().equals(dependencyRhs.getName())) {
return false;
}
if (getTargetConfiguration() != null ? !getTargetConfiguration().equals(dependencyRhs.getTargetConfiguration())
: dependencyRhs.getTargetConfiguration()!=null) {
return false;
}
if (getVersion() != null ? !getVersion().equals(dependencyRhs.getVersion())
: dependencyRhs.getVersion() != null) {
return false;
}
return true;
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:AbstractModuleDependency.java
示例4: isCommonContentEquals
import org.gradle.api.artifacts.ModuleDependency; //导入依赖的package包/类
protected boolean isCommonContentEquals(ModuleDependency dependencyRhs) {
if (!isKeyEquals(dependencyRhs)) {
return false;
}
if (isTransitive() != dependencyRhs.isTransitive()) {
return false;
}
if (getArtifacts() != null ? !getArtifacts().equals(dependencyRhs.getArtifacts())
: dependencyRhs.getArtifacts() != null) {
return false;
}
if (getExcludeRules() != null ? !getExcludeRules().equals(dependencyRhs.getExcludeRules())
: dependencyRhs.getExcludeRules() != null) {
return false;
}
return true;
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:AbstractModuleDependency.java
示例5: addDependencies
import org.gradle.api.artifacts.ModuleDependency; //导入依赖的package包/类
/**
* Add dependencies to the POM
*
* Adds all dependencies from the provided configuration with the provided scope to the POM and to the set of
* existing dependencies. Dependencies are only added if they are not contained in the set of existing dependencies.
*
* @param dependencies Element to add dependencies to
* @param configuration Configuration whose provides depencencies to add
* @param scope Scope to use for added depencencies
*/
protected void addDependencies(Element dependencies, Configuration configuration, String scope) {
for (@NonNull Dependency dependency : configuration.getDependencies()) {
if (dependency instanceof ModuleDependency) {
ModuleDependency moduleDependency = (ModuleDependency) dependency;
if (moduleDependency.getArtifacts().isEmpty()) {
addDependency(dependencies, moduleDependency, moduleDependency.getName(), null, "jar", scope);
}
else {
for (DependencyArtifact artifact : moduleDependency.getArtifacts()) {
addDependency(dependencies, moduleDependency, artifact.getName(), artifact.getClassifier(),
artifact.getType(), scope);
}
}
}
}
}
开发者ID:jochenseeber,项目名称:gradle-project-config,代码行数:28,代码来源:PomConfigurator.java
示例6: deployProject
import org.gradle.api.artifacts.ModuleDependency; //导入依赖的package包/类
@TaskAction
protected void deployProject()
{
Set<PublishArtifact> seenArtifacts = new HashSet<>();
for ( SoftwareComponent component : getProject().getComponents() )
{
SoftwareComponentInternal internalComponent = (SoftwareComponentInternal) component;
for ( UsageContext usage : internalComponent.getUsages() )
{
Set<? extends ModuleDependency> dependencies = usage.getDependencies();
for ( PublishArtifact artifact : usage.getArtifacts() )
{
if ( seenArtifacts.add( artifact ) )
{
deploy( artifact, dependencies );
}
}
}
}
}
开发者ID:fedora-java,项目名称:xmvn,代码行数:24,代码来源:XMvnInstallTask.java
示例7: from
import org.gradle.api.artifacts.ModuleDependency; //导入依赖的package包/类
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);
}
}
}
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:23,代码来源:DefaultMavenPublication.java
示例8: resolve
import org.gradle.api.artifacts.ModuleDependency; //导入依赖的package包/类
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);
}
}
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:21,代码来源:ClientModuleResolver.java
示例9: createDependencyDescriptor
import org.gradle.api.artifacts.ModuleDependency; //导入依赖的package包/类
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;
}
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:18,代码来源:ClientModuleIvyDependencyDescriptorFactory.java
示例10: getFirstLevelNodes
import org.gradle.api.artifacts.ModuleDependency; //导入依赖的package包/类
private Set<DependencyGraphNodeResult> getFirstLevelNodes(Spec<? super Dependency> dependencySpec) {
Set<DependencyGraphNodeResult> matches = new LinkedHashSet<DependencyGraphNodeResult>();
TransientConfigurationResults graphResults = loadTransientGraphResults(selectedArtifacts);
for (Map.Entry<ModuleDependency, DependencyGraphNodeResult> entry : graphResults.getFirstLevelDependencies().entrySet()) {
if (dependencySpec.isSatisfiedBy(entry.getKey())) {
matches.add(entry.getValue());
}
}
return matches;
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:11,代码来源:DefaultLenientConfiguration.java
示例11: addClientModuleDependencies
import org.gradle.api.artifacts.ModuleDependency; //导入依赖的package包/类
private void addClientModuleDependencies(ClientModule clientModule, MutableModuleComponentResolveMetadata clientModuleMetaData) {
List<DependencyMetadata> dependencies = Lists.newArrayList();
for (ModuleDependency moduleDependency : clientModule.getDependencies()) {
DependencyMetadata dependencyMetadata = dependencyDescriptorFactory.createDependencyDescriptor(moduleDependency.getTargetConfiguration(), null, moduleDependency);
dependencies.add(dependencyMetadata);
}
clientModuleMetaData.setDependencies(dependencies);
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:ClientModuleResolver.java
示例12: findFactoryForDependency
import org.gradle.api.artifacts.ModuleDependency; //导入依赖的package包/类
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());
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:DefaultDependencyDescriptorFactory.java
示例13: addDependencies
import org.gradle.api.artifacts.ModuleDependency; //导入依赖的package包/类
private void addDependencies(BuildableLocalComponentMetadata metaData, ConfigurationInternal configuration) {
AttributeContainerInternal attributes = configuration.getAttributes().asImmutable();
for (Dependency dependency : configuration.getDependencies()) {
if (dependency instanceof ModuleDependency) {
ModuleDependency moduleDependency = (ModuleDependency) dependency;
metaData.addDependency(dependencyDescriptorFactory.createDependencyDescriptor(configuration.getName(), attributes, moduleDependency));
} else if (dependency instanceof FileCollectionDependency) {
final FileCollectionDependency fileDependency = (FileCollectionDependency) dependency;
metaData.addFiles(configuration.getName(), new DefaultLocalFileDependencyMetadata(fileDependency));
} else {
throw new IllegalArgumentException("Cannot convert dependency " + dependency + " to local component dependency metadata.");
}
}
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:15,代码来源:DefaultDependenciesToModuleDescriptorConverter.java
示例14: getModuleDependency
import org.gradle.api.artifacts.ModuleDependency; //导入依赖的package包/类
@Override
public ModuleDependency getModuleDependency(long nodeId) {
ModuleDependency m = modulesMap.get(nodeId);
if (m == null) {
throw new IllegalArgumentException("Unable to find module dependency for id: " + nodeId);
}
return m;
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:DefaultResolvedGraphResults.java
示例15: visitEdge
import org.gradle.api.artifacts.ModuleDependency; //导入依赖的package包/类
public void visitEdge(DependencyGraphNode resolvedConfiguration) {
for (DependencyGraphEdge dependency : resolvedConfiguration.getIncomingEdges()) {
if (dependency.getFrom() == root) {
ModuleDependency moduleDependency = dependency.getModuleDependency();
builder.addFirstLevelDependency(moduleDependency, resolvedConfiguration);
}
}
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:ResolvedConfigurationDependencyGraphVisitor.java
示例16: addFirstLevelDependency
import org.gradle.api.artifacts.ModuleDependency; //导入依赖的package包/类
@Override
public void addFirstLevelDependency(ModuleDependency moduleDependency, DependencyGraphNode dependency) {
builder.firstLevelDependency(dependency.getNodeId());
//we don't serialise the module dependencies at this stage so we need to keep track
//of the mapping module dependency <-> resolved dependency
modulesMap.put(dependency.getNodeId(), moduleDependency);
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:8,代码来源:DefaultResolvedConfigurationBuilder.java
示例17: getModuleDependency
import org.gradle.api.artifacts.ModuleDependency; //导入依赖的package包/类
@Override
public ModuleDependency getModuleDependency() {
if (dependencyMetadata instanceof DslOriginDependencyMetadata) {
return ((DslOriginDependencyMetadata) dependencyMetadata).getSource();
}
return null;
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:8,代码来源:DependencyGraphBuilder.java
示例18: extractClientModule
import org.gradle.api.artifacts.ModuleDependency; //导入依赖的package包/类
private static ClientModule extractClientModule(DependencyMetadata dependencyMetadata) {
if (dependencyMetadata instanceof DslOriginDependencyMetadata) {
ModuleDependency source = ((DslOriginDependencyMetadata) dependencyMetadata).getSource();
if (source instanceof ClientModule) {
return (ClientModule) source;
}
}
return null;
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:10,代码来源:DefaultComponentOverrideMetadata.java
示例19: from
import org.gradle.api.artifacts.ModuleDependency; //导入依赖的package包/类
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.getTargetConfiguration() == null ? Dependency.DEFAULT_CONFIGURATION : dependency.getTargetConfiguration());
if (dependency instanceof ProjectDependency) {
addProjectDependency((ProjectDependency) dependency, confMapping);
} else {
addModuleDependency(dependency, confMapping);
}
}
}
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:29,代码来源:DefaultIvyPublication.java
示例20: copy
import org.gradle.api.artifacts.ModuleDependency; //导入依赖的package包/类
public ClientModule copy() {
DefaultClientModule copiedClientModule = new DefaultClientModule(getGroup(), getName(), getVersion(), getTargetConfiguration());
copyTo(copiedClientModule);
for (ModuleDependency dependency : dependencies) {
copiedClientModule.addDependency(dependency.copy());
}
return copiedClientModule;
}
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:DefaultClientModule.java
注:本文中的org.gradle.api.artifacts.ModuleDependency类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论