org.gradle.api.Project.getSubprojects()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(177)

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

Project.getSubprojects介绍

暂无

代码示例

代码示例来源:origin: uber/okbuck

public static void resetTargetCacheForAll(Project project) {
 resetTargetCache(project);
 project.getSubprojects().forEach(ProjectCache::resetTargetCache);
}

代码示例来源:origin: uber/okbuck

public static void initTargetCacheForAll(Project project) {
 initTargetCache(project);
 project.getSubprojects().forEach(ProjectCache::initTargetCache);
}

代码示例来源:origin: uber/okbuck

private LinkedHashMap<String, String> repositoryMap(boolean downloadInBuck) {
 LinkedHashMap<String, String> rawRepositories = new LinkedHashMap<>();
 if (!downloadInBuck) {
  return rawRepositories;
 }
 addRepositories(getProject().getRootProject(), rawRepositories);
 getProject()
   .getRootProject()
   .getSubprojects()
   .forEach(
     subProject -> {
      addRepositories(subProject, rawRepositories);
     });
 LinkedHashMap<String, String> filteredRepositories = new LinkedHashMap<>();
 rawRepositories.forEach(
   (key, value) -> {
    if (!filteredRepositories.values().contains(value)) {
     // Skip adding any `file:` repositories since the path would be absolute
     // and will prevent from checking in the generated buckconfig file.
     if (!value.startsWith("file:")) {
      filteredRepositories.put(key, value);
     }
    }
   });
 return filteredRepositories;
}

代码示例来源:origin: uber/okbuck

public OkBuckExtension(Project project) {
 buckProjects = project.getSubprojects();
 kotlinExtension = new KotlinExtension(project);
 lintExtension = new LintExtension(project);
 jetifierExtension = new JetifierExtension(project);
 externalDependenciesExtension = new ExternalDependenciesExtension(project);
 ruleOverridesExtension = new RuleOverridesExtension(project);
}

代码示例来源:origin: diffplug/spotless

for (Project subproject : getProject().getSubprojects()) {
  relativizeIfSubdir(excludes, dir, subproject.getBuildDir());

代码示例来源:origin: gradle.plugin.com.liferay/gradle-plugins-app-docker

@Override
public boolean isSatisfiedBy(Project project) {
  Set<Project> subprojects = project.getSubprojects();
  if (subprojects.isEmpty()) {
    return true;
  }
  return false;
}

代码示例来源:origin: gradle.plugin.com.liferay/gradle-plugins-jsdoc

public AppJSDocConfigurationExtension(Project project) {
  _subprojects.addAll(project.getSubprojects());
}

代码示例来源:origin: gradle.plugin.com.liferay/gradle-plugins-tlddoc-builder

public AppTLDDocBuilderExtension(Project project) {
  _subprojects.addAll(project.getSubprojects());
}

代码示例来源:origin: gradle.plugin.ru.rambler.jiratasksupdater/jiraTaskUpdater

@Override
public void apply(Project project) {
  project.getExtensions().create(JIRA_TASKS_UPDATER_PLUGIN, JiraTasksUpdaterExtension.class);
  createTask(project);
  for (Project p : project.getSubprojects()) {
    createTask(p);
  }
}

代码示例来源:origin: gradle.plugin.ru.rambler.jiratasksupdater/gradle-plugin

@Override
public void apply(Project project) {
  project.getExtensions().create(JIRA_TASKS_UPDATER_PLUGIN, JiraTasksUpdaterExtension.class);
  createTask(project);
  for (Project p : project.getSubprojects()) {
    createTask(p);
  }
}

代码示例来源:origin: gradle.plugin.com.github.frankfarrell.blastradius/blast-radius

private void addAllModulesChanged(Project project, Map<String, Boolean> changedModules) {
  changedModules.put(project.getPath(), true);
  project.getSubprojects()
      .forEach(subProject -> addAllModulesChanged(subProject, changedModules));
}

代码示例来源:origin: gradle.plugin.com.liferay/gradle-plugins-app-javadoc-builder

public AppJavadocBuilderExtension(Project project) {
  JavaVersion javaVersion = JavaVersion.current();
  if (javaVersion.isJava8Compatible()) {
    _doclintDisabled = true;
  }
  _groupNameClosure = new Closure<String>(project) {
    @SuppressWarnings("unused")
    public String doCall(Project subproject) {
      String groupName = subproject.getDescription();
      if (Validator.isNull(groupName)) {
        groupName = subproject.getName();
      }
      return groupName;
    }
  };
  _subprojects.addAll(project.getSubprojects());
}

代码示例来源:origin: com.android.tools.build/gradle-core

@Override
  public void execute(Project prj) {
    for (Project p : prj.getSubprojects()) {
      TaskCollection<AndroidReportTask> tasks = p.getTasks().withType(
          AndroidReportTask.class);
      for (AndroidReportTask task : tasks) {
        mergeReportsTask.addTask(task);
      }
      TaskCollection<DeviceProviderInstrumentTestTask> tasks2 =
          p.getTasks().withType(DeviceProviderInstrumentTestTask.class);
      for (DeviceProviderInstrumentTestTask task : tasks2) {
        mergeReportsTask.addTask(task);
      }
    }
  }
});

代码示例来源:origin: gradle.plugin.com.liferay/gradle-plugins-app-docker

_project.getSubprojects(),
new Spec<Project>() {

代码示例来源:origin: gradle.plugin.com.github.frankfarrell.blastradius/blast-radius

private void checkIfModuleHasChanged(final Project project,
                   final Map<String, Boolean> moduleMap,
                   final List<String> pathWithDiff,
                   final Set<String> defaultFilePatterns,
                   final Map<String, Set<String>> moduleFilePatterns,
                   final Boolean hasParentModuleChange){
  final GradleModule gradleModule = new GradleModule(project);
  final Boolean hasModuleChanged = hasParentModuleChange || gradleModule.hasChanged(moduleFilePatterns.getOrDefault(project.getPath(), defaultFilePatterns), pathWithDiff);
  if(hasModuleChanged){
    logger.info("Module {} has changed", project.getPath());
    moduleMap.putIfAbsent(project.getPath() , true);
  }
  else {
    logger.info("Module {} hasn't changed", project.getPath());
    moduleMap.putIfAbsent(project.getPath(), false);
  }
  project.getSubprojects()
      .forEach(subProject -> checkIfModuleHasChanged(subProject, moduleMap, pathWithDiff, defaultFilePatterns, moduleFilePatterns, hasModuleChanged));
}

代码示例来源:origin: gradle.plugin.io.apioo.build/build-plugin

@Override
public void apply(Project project) {
  project.getPluginManager().apply(GradleWrapperRule.class);
  if (isFolderPresent(project, JAVA_SOURCE_PATH)) {
    project.getPluginManager().apply(PLUGIN_JAVA);
    project.getPluginManager().apply(CustomMavenRepositoryRule.class);
    project.getPluginManager().apply(PLUGIN_MAVEN_PUBLISH);
    project.getPluginManager().apply(CustomMavenPublishRepositoryRule.class);
    project.getPluginManager().apply(PLUGIN_IDEA);
  }
  if (isFolderPresent(project, INTEGRATION_TEST_PATH)) {
    project.getPluginManager().apply(PLUGIN_JAVA);
    project.getPluginManager().apply(IntegrationTestSourceSetRule.class);
  }
  if (isJavaPluginApplied(project)) {
    project.getPluginManager().apply(PLUGIN_JACOCO);
    project.getPluginManager().apply(JacocoTestReportRule.class);
    // Don't apply sonarqube plugin for multi project builds.
    if (project.getRootProject().getSubprojects().isEmpty()) {
      project.getPluginManager().apply(PLUGIN_SONARQUBE);
      project.getPluginManager().apply(SonarQubeRule.class);
    }
    project.getPluginManager().apply(DockerImageRule.class);
  }
}

相关文章