• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java GradleProject类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.gradle.tooling.model.GradleProject的典型用法代码示例。如果您正苦于以下问题:Java GradleProject类的具体用法?Java GradleProject怎么用?Java GradleProject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



GradleProject类属于org.gradle.tooling.model包,在下文中一共展示了GradleProject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: buildRecursively

import org.gradle.tooling.model.GradleProject; //导入依赖的package包/类
private List<ConsumerProvidedTaskSelector> buildRecursively(GradleProject project) {
    Multimap<String, String> aggregatedTasks = ArrayListMultimap.create();

    collectTasks(project, aggregatedTasks);

    List<ConsumerProvidedTaskSelector> selectors = Lists.newArrayList();
    for (String selectorName : aggregatedTasks.keySet()) {
        SortedSet<String> selectorTasks = Sets.newTreeSet(new TaskNameComparator());
        selectorTasks.addAll(aggregatedTasks.get(selectorName));
        selectors.add(new ConsumerProvidedTaskSelector().
                setName(selectorName).
                setTaskNames(selectorTasks).
                setDescription(project.getParent() != null
                        ? String.format("%s:%s task selector", project.getPath(), selectorName)
                        : String.format("%s task selector", selectorName)).
                setDisplayName(String.format("%s in %s and subprojects.", selectorName, project.getName())));
    }
    return selectors;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:20,代码来源:BuildInvocationsConverter.java


示例2: newIdeaGradleProject

import org.gradle.tooling.model.GradleProject; //导入依赖的package包/类
/**
 * Creates a new {@link IdeaGradleProject}.
 * @param moduleName    the name of the IDEA module.
 * @param gradleProject the Gradle project.
 * @param buildFile     the build.gradle file.
 * @param gradleVersion the version of Gradle used to sync the project.
 */
public static IdeaGradleProject newIdeaGradleProject(@NotNull String moduleName,
                                                     @NotNull GradleProject gradleProject,
                                                     @Nullable File buildFile,
                                                     @Nullable String gradleVersion) {
  List<String> taskNames = Lists.newArrayList();
  DomainObjectSet<? extends GradleTask> tasks = gradleProject.getTasks();
  if (!tasks.isEmpty()) {
    for (GradleTask task : tasks) {
      String name = task.getName();
      if (isNotEmpty(name)) {
        taskNames.add(task.getProject().getPath() + SdkConstants.GRADLE_PATH_SEPARATOR + task.getName());
      }
    }
  }

  return new IdeaGradleProject(moduleName, taskNames, gradleProject.getPath(), buildFile, gradleVersion);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:IdeaGradleProject.java


示例3: buildRecursively

import org.gradle.tooling.model.GradleProject; //导入依赖的package包/类
private List<BasicGradleTaskSelector> buildRecursively(GradleProject project) {
    Multimap<String, String> aggregatedTasks = ArrayListMultimap.create();
    for (GradleProject childProject : project.getChildren()) {
        List<BasicGradleTaskSelector> childSelectors = buildRecursively(childProject);
        for (BasicGradleTaskSelector childSelector : childSelectors) {
            aggregatedTasks.putAll(childSelector.getName(), childSelector.getTaskNames());
        }
    }
    for (GradleTask task : project.getTasks()) {
        aggregatedTasks.put(task.getName(), task.getPath());
    }
    List<BasicGradleTaskSelector> selectors = Lists.newArrayList();
    for (String selectorName : aggregatedTasks.keySet()) {
        SortedSet<String> selectorTasks = Sets.newTreeSet(new TaskNameComparator());
        selectorTasks.addAll(aggregatedTasks.get(selectorName));
        selectors.add(new BasicGradleTaskSelector().
                setName(selectorName).
                setTaskNames(selectorTasks).
                setDescription(project.getParent() != null
                        ? String.format("%s:%s task selector", project.getPath(), selectorName)
                        : String.format("%s task selector", selectorName)).
                setDisplayName(String.format("%s in %s and subprojects.", selectorName, project.getName())));
    }
    return selectors;
}
 
开发者ID:Pushjet,项目名称:Pushjet-Android,代码行数:26,代码来源:BuildInvocationsConverter.java


示例4: addModelVersions

import org.gradle.tooling.model.GradleProject; //导入依赖的package包/类
private static void addModelVersions(Map<Class<?>, String> map) {
    map.put(HierarchicalEclipseProject.class, "1.0-milestone-3");
    map.put(EclipseProject.class, "1.0-milestone-3");
    map.put(IdeaProject.class, "1.0-milestone-5");
    map.put(GradleProject.class, "1.0-milestone-5");
    map.put(BasicIdeaProject.class, "1.0-milestone-5");
    map.put(BuildEnvironment.class, "1.0-milestone-8");
    map.put(ProjectOutcomes.class, "1.2");
    map.put(Void.class, "1.0-milestone-3");
    map.put(GradleBuild.class, "1.8");
    map.put(ProjectPublications.class, "1.12");
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:13,代码来源:ModelMapping.java


示例5: addModelToProtocolMappings

import org.gradle.tooling.model.GradleProject; //导入依赖的package包/类
static void addModelToProtocolMappings(Map<Class<?>, Class<?>> map) {
    map.put(HierarchicalEclipseProject.class, HierarchicalEclipseProjectVersion1.class);
    map.put(EclipseProject.class, EclipseProjectVersion3.class);
    map.put(IdeaProject.class, InternalIdeaProject.class);
    map.put(GradleProject.class, InternalGradleProject.class);
    map.put(BasicIdeaProject.class, InternalBasicIdeaProject.class);
    map.put(BuildEnvironment.class, InternalBuildEnvironment.class);
    map.put(ProjectOutcomes.class, InternalProjectOutcomes.class);
    map.put(Void.class, Void.class);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:11,代码来源:ModelMapping.java


示例6: addModelNameMappings

import org.gradle.tooling.model.GradleProject; //导入依赖的package包/类
static void addModelNameMappings(Map<Class<?>, String> map) {
    map.put(HierarchicalEclipseProject.class, "org.gradle.tooling.model.eclipse.HierarchicalEclipseProject");
    map.put(EclipseProject.class, "org.gradle.tooling.model.eclipse.EclipseProject");
    map.put(IdeaProject.class, "org.gradle.tooling.model.idea.IdeaProject");
    map.put(GradleProject.class, "org.gradle.tooling.model.GradleProject");
    map.put(BasicIdeaProject.class, "org.gradle.tooling.model.idea.BasicIdeaProject");
    map.put(BuildEnvironment.class, "org.gradle.tooling.model.build.BuildEnvironment");
    map.put(ProjectOutcomes.class, "org.gradle.tooling.model.outcomes.ProjectOutcomes");
    map.put(Void.class, Void.class.getName());
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:11,代码来源:ModelMapping.java


示例7: maySupportModel

import org.gradle.tooling.model.GradleProject; //导入依赖的package包/类
@Override
public boolean maySupportModel(Class<?> modelType) {
    return modelType.equals(ProjectOutcomes.class)
        || modelType.equals(HierarchicalEclipseProject.class)
        || modelType.equals(EclipseProject.class)
        || modelType.equals(IdeaProject.class)
        || modelType.equals(BasicIdeaProject.class)
        || modelType.equals(BuildEnvironment.class)
        || modelType.equals(GradleProject.class)
        || modelType.equals(Void.class);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:12,代码来源:VersionDetails.java


示例8: produceModel

import org.gradle.tooling.model.GradleProject; //导入依赖的package包/类
public <T> T produceModel(Class<T> type, ConsumerOperationParameters operationParameters) {
    if (type.equals(BuildInvocations.class)) {
        if (!versionDetails.maySupportModel(GradleProject.class)) {
            throw Exceptions.unsupportedModel(type, versionDetails.getVersion());
        }
        GradleProject gradleProject = delegate.produceModel(GradleProject.class, operationParameters);
        return adapter.adapt(type, new BuildInvocationsConverter().convert(gradleProject));
    }
    return delegate.produceModel(type, operationParameters);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:11,代码来源:BuildInvocationsAdapterProducer.java


示例9: getModel

import org.gradle.tooling.model.GradleProject; //导入依赖的package包/类
@Override
public <T> T getModel(Model target, Class<T> modelType) throws UnknownModelException {
    if (modelType.equals(BuildInvocations.class)) {
        GradleProject gradleProject = delegate.getModel(target, GradleProject.class);
        return adapter.adapt(modelType, new BuildInvocationsConverter().convert(gradleProject));
    }
    return delegate.getModel(target, modelType);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:BuildInvocationsAdapterController.java


示例10: produceModel

import org.gradle.tooling.model.GradleProject; //导入依赖的package包/类
public <T> T produceModel(Class<T> type, ConsumerOperationParameters operationParameters) {
    if (type.equals(GradleBuild.class)) {
        GradleProject gradleProject = delegate.produceModel(GradleProject.class, operationParameters);
        final DefaultGradleBuild convert = new GradleBuildConverter().convert(gradleProject);
        return mappingProvider.applyCompatibilityMapping(adapter.builder(type), operationParameters).build(convert);
    }
    return delegate.produceModel(type, operationParameters);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:GradleBuildAdapterProducer.java


示例11: applyCompatibilityMapping

import org.gradle.tooling.model.GradleProject; //导入依赖的package包/类
public <T> ViewBuilder<T> applyCompatibilityMapping(ViewBuilder<T> viewBuilder, DefaultProjectIdentifier projectIdentifier) {
    viewBuilder.mixInTo(GradleProject.class, new GradleProjectIdentifierMixin(projectIdentifier.getBuildIdentifier()));
    viewBuilder.mixInTo(BasicGradleProject.class, new BasicGradleProjectIdentifierMixin(projectIdentifier.getBuildIdentifier()));
    FixedBuildIdentifierProvider identifierProvider = new FixedBuildIdentifierProvider(projectIdentifier);
    identifierProvider.applyTo(viewBuilder);
    viewBuilder.mixInTo(GradleTask.class, TaskDisplayNameMixin.class);
    viewBuilder.mixInTo(IdeaProject.class, IdeaProjectJavaLanguageSettingsMixin.class);
    viewBuilder.mixInTo(IdeaDependency.class, IdeaModuleDependencyTargetNameMixin.class);
    viewBuilder.mixInTo(GradleBuild.class, new IncludedBuildsMixin());
    return viewBuilder;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:12,代码来源:HasCompatibilityMapping.java


示例12: collectTasks

import org.gradle.tooling.model.GradleProject; //导入依赖的package包/类
private void collectTasks(GradleProject project, Multimap<String, String> aggregatedTasks) {
    for (GradleProject childProject : project.getChildren()) {
        collectTasks(childProject, aggregatedTasks);
    }
    for (GradleTask task : project.getTasks()) {
        aggregatedTasks.put(task.getName(), task.getPath());
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:BuildInvocationsConverter.java


示例13: convert

import org.gradle.tooling.model.GradleProject; //导入依赖的package包/类
public DefaultGradleBuild convert(GradleProject project) {
    DefaultGradleBuild gradleBuild = new DefaultGradleBuild();
    PartialBasicGradleProject rootProject = toPartialGradleProject(project);
    gradleBuild.setRootProject(rootProject);
    gradleBuild.addProject(rootProject);
    convertChildren(gradleBuild, rootProject, project);
    return gradleBuild;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:9,代码来源:GradleBuildConverter.java


示例14: convertChildren

import org.gradle.tooling.model.GradleProject; //导入依赖的package包/类
private void convertChildren(DefaultGradleBuild gradleBuild, PartialBasicGradleProject rootProject, GradleProject project) {
    final List<? extends GradleProject> childProjects = new ArrayList<GradleProject>(project.getChildren());
    Collections.sort(childProjects, new Comparator<GradleProject>() {
        public int compare(GradleProject gp1, GradleProject gp2) {
            return gp1.getName().compareTo(gp2.getName());
        }
    });
    for (GradleProject childProject : childProjects) {
        PartialBasicGradleProject basicGradleProject = toPartialGradleProject(childProject);
        gradleBuild.addProject(basicGradleProject);
        basicGradleProject.setParent(rootProject);
        rootProject.addChild(basicGradleProject);
        convertChildren(gradleBuild, basicGradleProject, childProject);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:16,代码来源:GradleBuildConverter.java


示例15: toPartialGradleProject

import org.gradle.tooling.model.GradleProject; //导入依赖的package包/类
private PartialBasicGradleProject toPartialGradleProject(GradleProject childProject) {
    PartialBasicGradleProject basicGradleProject = new PartialBasicGradleProject();
    basicGradleProject.setName(childProject.getName());
    ProjectIdentifier id = childProject.getProjectIdentifier();
    basicGradleProject.setProjectIdentifier(new DefaultProjectIdentifier(id.getBuildIdentifier().getRootDir(), id.getProjectPath()));
    return basicGradleProject;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:8,代码来源:GradleBuildConverter.java


示例16: getValues

import org.gradle.tooling.model.GradleProject; //导入依赖的package包/类
@Override
public List<String> getValues(String attributeName) throws ValueStorageException {
    final java.io.File ioFolder = projectFolder.getVirtualFile().getIoFile();

    if (!isGradleProject(ioFolder)) {
        return unmodifiableList(emptyList());
    }

    final ProjectConnection projectConnection = projectManager.getProjectConnection(ioFolder);
    final GradleProject projectModel = projectConnection.getModel(GradleProject.class);
    final IdeaProject ideaProjectModel = projectConnection.getModel(IdeaProject.class);
    final BuildEnvironment buildEnvironmentModel = projectConnection.getModel(BuildEnvironment.class);

    try {

        switch (attributeName) {
            case PROJECT_TASKS_VAR:
                return getPublicTasks(projectModel);
            case PROJECT_BUILD_DIR_VAR:
                return unmodifiableList(singletonList(getBuildDirectory(projectModel)));
            case PROJECT_PATH_VAR:
                return unmodifiableList(singletonList(getPath(projectModel)));
            case PROJECT_BUILD_SCRIPT_VAR:
                return unmodifiableList(singletonList(getBuildScriptPath(projectModel)));
            case PROJECT_DESCRIPTION_VAR:
                return unmodifiableList(singletonList(getProjectDescription(projectModel)));
            case PROJECT_SOURCE_DIR_VAR:
                return getProjectSourceDirectories(ideaProjectModel, SOURCE);
            case PROJECT_TEST_DIR_VAR:
                return getProjectSourceDirectories(ideaProjectModel, TEST_SOURCE);
            case PROJECT_GRADLE_VERSION_VAR:
                return unmodifiableList(singletonList(getGradleVersion(buildEnvironmentModel)));
            default:
                return unmodifiableList(emptyList());
        }

    } finally {
        projectConnection.close();
    }
}
 
开发者ID:vzhukovskii,项目名称:che-gradle-plugin,代码行数:41,代码来源:GradleValueProviderFactory.java


示例17: getPublicTasks

import org.gradle.tooling.model.GradleProject; //导入依赖的package包/类
/**
 * Returns unmodifiable list with public tasks from Gradle project.
 *
 * @param projectModel
 *         gradle project model
 * @return unmodifiable list which contains public tasks
 * @see GradleTask
 * @see Task
 * @see Launchable
 */
public static List<String> getPublicTasks(GradleProject projectModel) {
    checkNotNull(projectModel);

    List<String> tasks = projectModel.getTasks()
                                     .stream()
                                     .filter(Launchable::isPublic)
                                     .map(Task::getPath)
                                     .collect(Collectors.toList());

    return unmodifiableList(tasks);
}
 
开发者ID:vzhukovskii,项目名称:che-gradle-plugin,代码行数:22,代码来源:GradleProjectManager.java


示例18: getBuildDirectory

import org.gradle.tooling.model.GradleProject; //导入依赖的package包/类
/**
 * Returns build path.
 * Build path is relative according to project.
 *
 * @param projectModel
 *         gradle project model
 * @return build directory path
 */
public static String getBuildDirectory(GradleProject projectModel) {
    checkNotNull(projectModel);

    final URI absProjectDir = new File(projectModel.getProjectDirectory().getAbsolutePath()).toURI();
    final URI absBuildDir = new File(projectModel.getBuildDirectory().getAbsolutePath()).toURI();

    return absProjectDir.relativize(absBuildDir).getPath();
}
 
开发者ID:vzhukovskii,项目名称:che-gradle-plugin,代码行数:17,代码来源:GradleProjectManager.java


示例19: getBuildScriptPath

import org.gradle.tooling.model.GradleProject; //导入依赖的package包/类
/**
 * Returns path to build script, usually '/project_name/build.gradle'.
 *
 * @param projectModel
 *         gradle project model
 * @return build script path
 */
public static String getBuildScriptPath(GradleProject projectModel) {
    checkNotNull(projectModel);

    final URI absProjectDir = new File(projectModel.getProjectDirectory().getAbsolutePath()).toURI();
    final URI absBuildDir = new File(projectModel.getBuildScript().getSourceFile().getAbsolutePath()).toURI();

    return absProjectDir.relativize(absBuildDir).getPath();
}
 
开发者ID:vzhukovskii,项目名称:che-gradle-plugin,代码行数:16,代码来源:GradleProjectManager.java


示例20: getProjectDescription

import org.gradle.tooling.model.GradleProject; //导入依赖的package包/类
/**
 * Returns project description.
 *
 * @param projectModel
 *         gradle project model
 * @return project description or empty string
 */
public static String getProjectDescription(GradleProject projectModel) {
    checkNotNull(projectModel);

    final String description = projectModel.getDescription();

    return nullToEmpty(description);
}
 
开发者ID:vzhukovskii,项目名称:che-gradle-plugin,代码行数:15,代码来源:GradleProjectManager.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Marker类代码示例发布时间:2022-05-23
下一篇:
Java NoOpLog类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap