org.gradle.api.artifacts.Configuration.getHierarchy()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(135)

本文整理了Java中org.gradle.api.artifacts.Configuration.getHierarchy()方法的一些代码示例,展示了Configuration.getHierarchy()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Configuration.getHierarchy()方法的具体详情如下:
包路径:org.gradle.api.artifacts.Configuration
类名称:Configuration
方法名:getHierarchy

Configuration.getHierarchy介绍

暂无

代码示例

代码示例来源:origin: spring-gradle-plugins/dependency-management-plugin

private List<Configuration> getReversedHierarchy(Configuration configuration) {
  List<Configuration> hierarchy = new ArrayList<Configuration>(configuration.getHierarchy());
  Collections.reverse(hierarchy);
  return hierarchy;
}

代码示例来源:origin: spring-gradle-plugins/dependency-management-plugin

@Override
public void execute(ResolvableDependencies resolvableDependencies) {
  if (dependencyManagementSettings.isOverriddenByDependencies()) {
    for (Configuration configuration : root.getHierarchy()) {
      processConfiguration(configuration);
    }
  }
}

代码示例来源:origin: spring-gradle-plugins/dependency-management-plugin

private String findManagedVersion(Configuration source, String group, String name) {
  for (Configuration configuration : source.getHierarchy()) {
    String managedVersion = dependencyManagementForConfiguration(configuration)
        .getManagedVersion(group, name);
    if (managedVersion != null) {
      logger.debug("Found managed version '{}' for dependency '{}:{}' in dependency management for " +
          "configuration '{}'", managedVersion, group, name, configuration.getName());
      return managedVersion;
    }
  }
  return null;
}

代码示例来源:origin: gradle.plugin.com.google.cloud.tools/jib-gradle-plugin

/**
 * Collects a project's project dependencies, including all transitive project dependencies.
 *
 * @param project the project to find the project dependencies for
 * @return the set of project dependencies
 */
private static Set<ProjectDependency> findProjectDependencies(Project project) {
 Set<ProjectDependency> projectDependencies = new HashSet<>();
 Deque<Project> projects = new ArrayDeque<>();
 projects.push(project);
 while (!projects.isEmpty()) {
  Project currentProject = projects.pop();
  // Search through all dependencies
  for (Configuration configuration :
    currentProject.getConfigurations().getByName("runtime").getHierarchy()) {
   for (Dependency dependency : configuration.getDependencies()) {
    if (dependency instanceof ProjectDependency) {
     // If this is a project dependency, save it
     ProjectDependency projectDependency = (ProjectDependency) dependency;
     if (!projectDependencies.contains(projectDependency)) {
      projects.push(projectDependency.getDependencyProject());
      projectDependencies.add(projectDependency);
     }
    }
   }
  }
 }
 return projectDependencies;
}

代码示例来源:origin: google/play-services-plugins

@Test
public void testIsTest_fromHierarchy() {
 Configuration configuration = mock(Configuration.class);
 when(configuration.getName()).thenReturn("random");
 Configuration parent = mock(Configuration.class);
 when(parent.getName()).thenReturn("testCompile");
 Set<Configuration> hierarchy = new HashSet<>();
 hierarchy.add(parent);
 when(configuration.getHierarchy()).thenReturn(hierarchy);
 assertTrue(dependencyTask.isTest(configuration));
}

代码示例来源:origin: gradle.plugin.com.google.cloud.tools/jib-gradle-plugin

dependencyProject.getConfigurations().getByName(configurationName).getHierarchy()) {
for (PublishArtifact artifact : targetConfiguration.getArtifacts()) {
 projectDependencyJars.add(artifact.getFile());

代码示例来源:origin: spring-gradle-plugins/dependency-management-plugin

/**
 * Returns the {@link Exclusions} that have been configured for the given {@code configuration}.
 *
 * @param configuration the configuration
 * @return the exclusions
 */
public Exclusions getExclusions(Configuration configuration) {
  Exclusions exclusions = new Exclusions();
  if (configuration != null) {
    for (Configuration inHierarchy : configuration.getHierarchy()) {
      exclusions.addAll(dependencyManagementForConfiguration(inHierarchy)
          .getExclusions());
    }
  }
  exclusions.addAll(this.globalDependencyManagement.getExclusions());
  return exclusions;
}

相关文章