当前位置: 首页>>代码示例>>Java>>正文


Java ProjectDependency.getDependencyProject方法代码示例

本文整理汇总了Java中org.gradle.api.artifacts.ProjectDependency.getDependencyProject方法的典型用法代码示例。如果您正苦于以下问题:Java ProjectDependency.getDependencyProject方法的具体用法?Java ProjectDependency.getDependencyProject怎么用?Java ProjectDependency.getDependencyProject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.gradle.api.artifacts.ProjectDependency的用法示例。


在下文中一共展示了ProjectDependency.getDependencyProject方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resolve

import org.gradle.api.artifacts.ProjectDependency; //导入方法依赖的package包/类
public ModuleVersionIdentifier resolve(ProjectDependency dependency) {
    Project dependencyProject = dependency.getDependencyProject();
    ((ProjectInternal) dependencyProject).evaluate();

    PublishingExtension publishing = dependencyProject.getExtensions().findByType(PublishingExtension.class);

    if (publishing == null || publishing.getPublications().withType(PublicationInternal.class).isEmpty()) {
        // Project does not apply publishing (or has no publications): simply use the project name in place of the dependency name
        return new DefaultModuleVersionIdentifier(dependency.getGroup(), dependencyProject.getName(), dependency.getVersion());
    }

    // See if all publications have the same identifier
    Set<? extends PublicationInternal> publications = publishing.getPublications().withType(PublicationInternal.class);
    Iterator<? extends PublicationInternal> iterator = publications.iterator();
    ModuleVersionIdentifier candidate = iterator.next().getCoordinates();
    while (iterator.hasNext()) {
        ModuleVersionIdentifier alternative = iterator.next().getCoordinates();
        if (!candidate.equals(alternative)) {
            throw new UnsupportedOperationException("Publishing is not yet able to resolve a dependency on a project with multiple different publications.");
        }
    }
    return candidate;

}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:25,代码来源:ProjectDependencyPublicationResolver.java

示例2: getProjectTypeDependencies

import org.gradle.api.artifacts.ProjectDependency; //导入方法依赖的package包/类
/**
 * Helper to get project dependent, optionally recursively.
 */
private static Set<Project> getProjectTypeDependencies(final Project project, boolean recursive) {
  //System.out.println("--------getProjectDependencies--------");
  Set<Project> result = new HashSet<Project>();
  //Set<ProjectDependency> set = new HashSet<ProjectDependency>();
  DomainObjectSet<ProjectDependency> directProjectTypeDependent = getDirectProjectTypeDependencies(project);
  //System.out.println("--directDependentProjects.size(): " + directDependentProjects.size());
  for (ProjectDependency projectTypeDependency : directProjectTypeDependent) {
    Project dependentProject = projectTypeDependency.getDependencyProject();
    //System.out.println("------project: " + dependentProject);
    if (dependentProject!=null) {
      result.add(dependentProject);
      if (recursive) {
        result.addAll(getProjectTypeDependencies(dependentProject, recursive));
      }
    }
  }
  return result;
}
 
开发者ID:r-murphy,项目名称:nw-gradle,代码行数:22,代码来源:DependenciesUtil.java

示例3: ProjectDependencyArtifactIdExtractorHack

import org.gradle.api.artifacts.ProjectDependency; //导入方法依赖的package包/类
public ProjectDependencyArtifactIdExtractorHack(ProjectDependency dependency) {
    this.project = dependency.getDependencyProject();
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:4,代码来源:ProjectDependencyArtifactIdExtractorHack.java


注:本文中的org.gradle.api.artifacts.ProjectDependency.getDependencyProject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。