Java 类org.gradle.api.artifacts.ExternalModuleDependency 实例源码

项目:Reer    文件:ExternalModuleIvyDependencyDescriptorFactory.java   
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);
}
项目:Reer    文件:DefaultExternalModuleDependency.java   
public boolean contentEquals(Dependency dependency) {
    if (this == dependency) {
        return true;
    }
    if (dependency == null || getClass() != dependency.getClass()) {
        return false;
    }

    ExternalModuleDependency that = (ExternalModuleDependency) dependency;
    return isContentEqualsFor(that);

}
项目:Pushjet-Android    文件:DefaultExternalModuleDependency.java   
public boolean contentEquals(Dependency dependency) {
    if (this == dependency) {
        return true;
    }
    if (dependency == null || getClass() != dependency.getClass()) {
        return false;
    }

    ExternalModuleDependency that = (ExternalModuleDependency) dependency;
    return isContentEqualsFor(that);

}
项目:Reer    文件:ExternalModuleIvyDependencyDescriptorFactory.java   
public boolean canConvert(ModuleDependency dependency) {
    return dependency instanceof ExternalModuleDependency;
}
项目:Reer    文件:AbstractExternalModuleDependency.java   
protected boolean isContentEqualsFor(ExternalModuleDependency dependencyRhs) {
    if (!isKeyEquals(dependencyRhs) || !isCommonContentEquals(dependencyRhs)) {
        return false;
    }
    return force == dependencyRhs.isForce() && changing == dependencyRhs.isChanging();
}
项目:Reer    文件:AbstractExternalModuleDependency.java   
public ExternalModuleDependency setForce(boolean force) {
    this.force = force;
    return this;
}
项目:Reer    文件:AbstractExternalModuleDependency.java   
public ExternalModuleDependency setChanging(boolean changing) {
    this.changing = changing;
    return this;
}
项目:Pushjet-Android    文件:ExternalModuleIvyDependencyDescriptorFactory.java   
private ExternalModuleDependency getExternalModuleDependency(ModuleDependency dependency) {
    return (ExternalModuleDependency) dependency;
}
项目:Pushjet-Android    文件:ExternalModuleIvyDependencyDescriptorFactory.java   
public boolean canConvert(ModuleDependency dependency) {
    return dependency instanceof ExternalModuleDependency;
}
项目:Pushjet-Android    文件:AbstractExternalModuleDependency.java   
protected boolean isContentEqualsFor(ExternalModuleDependency dependencyRhs) {
    if (!isKeyEquals(dependencyRhs) || !isCommonContentEquals(dependencyRhs)) {
        return false;
    }
    return force == dependencyRhs.isForce() && changing == dependencyRhs.isChanging();
}
项目:Pushjet-Android    文件:AbstractExternalModuleDependency.java   
public ExternalModuleDependency setForce(boolean force) {
    this.force = force;
    return this;
}
项目:Pushjet-Android    文件:AbstractExternalModuleDependency.java   
public ExternalModuleDependency setChanging(boolean changing) {
    this.changing = changing;
    return this;
}
项目:Pushjet-Android    文件:ExternalModuleIvyDependencyDescriptorFactory.java   
private ExternalModuleDependency getExternalModuleDependency(ModuleDependency dependency) {
    return (ExternalModuleDependency) dependency;
}
项目:Pushjet-Android    文件:ExternalModuleIvyDependencyDescriptorFactory.java   
public boolean canConvert(ModuleDependency dependency) {
    return dependency instanceof ExternalModuleDependency;
}
项目:gradle-workspace-plugin    文件:WorkspacePlugin.java   
/**
 * Replace the dependencies of a configuration
 *
 * @param project Project the configuration belongs to
 * @param configuration Configuration whose dependencies to replace
 * @param exports Exporting configurations
 */
protected void replaceDependencies(Project project, Configuration configuration,
        Multimap<@NonNull String, @NonNull ExportingConfiguration> exports) {
    List<@NonNull Dependency> removeDependencies = new ArrayList<>();
    List<@NonNull Dependency> addDependencies = new ArrayList<>();

    getLogger().debug("Replacing dependencies for {}", configuration);

    for (Dependency dependency : configuration.getDependencies()) {
        if (dependency instanceof ExternalModuleDependency) {
            ExternalModuleDependency moduleDependency = (ExternalModuleDependency) dependency;
            Collection<ExportingConfiguration> infos = null;

            if (moduleDependency.getArtifacts().isEmpty()) {
                infos = exports.get(moduleKey(moduleDependency));
            }
            else {
                infos = new TreeSet<>(CONFIGURATION_INFO_COMPARATOR);
                boolean first = false;

                for (DependencyArtifact artifact : moduleDependency.getArtifacts()) {
                    Collection<@NonNull ExportingConfiguration> additionalInfos = exports
                            .get(moduleKey(dependency, artifact));

                    if (additionalInfos != null) {
                        if (first) {
                            infos.addAll(additionalInfos);
                        }
                        else {
                            infos.retainAll(additionalInfos);
                        }
                    }
                }
            }

            if (infos != null && !infos.isEmpty()) {
                ExportingConfiguration info = infos.iterator().next();
                Dependency projectDependency = project.getDependencies().project(info.getProperties());

                getLogger().debug("Replacing dependency {} with {}", dependency, projectDependency);

                if (!dependency.getVersion().equals(projectDependency.getVersion())) {
                    getLogger().error(
                            "Version '{}' of local project '{}' does not match version '{}' specified in build file '{}'",
                            projectDependency.getVersion(), projectDependency.getName(), dependency.getVersion(),
                            project.getRootProject().relativePath(project.getBuildFile()));
                    this.abortBuild = true;
                }

                removeDependencies.add(moduleDependency);
                addDependencies.add(projectDependency);
            }
        }
    }

    configuration.getDependencies().removeAll(removeDependencies);
    configuration.getDependencies().addAll(addDependencies);
}
项目:gradle-workspace-plugin    文件:WorkspacePlugin.java   
/**
 * Provide a string key for a dependency
 *
 * @param dependency Selector to provide key for
 * @return Module key
 */
protected String moduleKey(ExternalModuleDependency dependency) {
    String key = Objects
            .requireNonNull(ARTIFACT_JOINER.join(dependency.getGroup(), dependency.getName(), "jar", "jar"));
    return key;
}