本文整理汇总了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;
}
示例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;
}
示例3: ProjectDependencyArtifactIdExtractorHack
import org.gradle.api.artifacts.ProjectDependency; //导入方法依赖的package包/类
public ProjectDependencyArtifactIdExtractorHack(ProjectDependency dependency) {
this.project = dependency.getDependencyProject();
}