Search in sources :

Example 1 with DefaultGradleBuild

use of org.gradle.tooling.internal.gradle.DefaultGradleBuild in project gradle by gradle.

the class GradleBuildBuilder method convert.

private DefaultGradleBuild convert(Gradle gradle) {
    DefaultGradleBuild model = new DefaultGradleBuild();
    Map<Project, BasicGradleProject> convertedProjects = new LinkedHashMap<Project, BasicGradleProject>();
    Project rootProject = gradle.getRootProject();
    BasicGradleProject convertedRootProject = convert(rootProject, convertedProjects);
    model.setRootProject(convertedRootProject);
    for (Project project : rootProject.getAllprojects()) {
        model.addProject(convertedProjects.get(project));
    }
    for (IncludedBuild includedBuild : gradle.getIncludedBuilds()) {
        Gradle includedGradle = ((IncludedBuildInternal) includedBuild).getConfiguredBuild();
        DefaultGradleBuild convertedIncludedBuild = convert(includedGradle);
        model.addIncludedBuild(convertedIncludedBuild);
    }
    return model;
}
Also used : Project(org.gradle.api.Project) BasicGradleProject(org.gradle.tooling.internal.gradle.BasicGradleProject) IncludedBuildInternal(org.gradle.composite.internal.IncludedBuildInternal) DefaultGradleBuild(org.gradle.tooling.internal.gradle.DefaultGradleBuild) BasicGradleProject(org.gradle.tooling.internal.gradle.BasicGradleProject) Gradle(org.gradle.api.invocation.Gradle) LinkedHashMap(java.util.LinkedHashMap) IncludedBuild(org.gradle.api.initialization.IncludedBuild)

Example 2 with DefaultGradleBuild

use of org.gradle.tooling.internal.gradle.DefaultGradleBuild in project gradle by gradle.

the class GradleBuildConverter method convert.

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;
}
Also used : DefaultGradleBuild(org.gradle.tooling.internal.gradle.DefaultGradleBuild) PartialBasicGradleProject(org.gradle.tooling.internal.gradle.PartialBasicGradleProject)

Example 3 with DefaultGradleBuild

use of org.gradle.tooling.internal.gradle.DefaultGradleBuild in project gradle by gradle.

the class GradleBuildAdapterProducer method produceModel.

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);
}
Also used : GradleBuildConverter(org.gradle.tooling.internal.consumer.converters.GradleBuildConverter) DefaultGradleBuild(org.gradle.tooling.internal.gradle.DefaultGradleBuild) GradleProject(org.gradle.tooling.model.GradleProject)

Aggregations

DefaultGradleBuild (org.gradle.tooling.internal.gradle.DefaultGradleBuild)3 LinkedHashMap (java.util.LinkedHashMap)1 Project (org.gradle.api.Project)1 IncludedBuild (org.gradle.api.initialization.IncludedBuild)1 Gradle (org.gradle.api.invocation.Gradle)1 IncludedBuildInternal (org.gradle.composite.internal.IncludedBuildInternal)1 GradleBuildConverter (org.gradle.tooling.internal.consumer.converters.GradleBuildConverter)1 BasicGradleProject (org.gradle.tooling.internal.gradle.BasicGradleProject)1 PartialBasicGradleProject (org.gradle.tooling.internal.gradle.PartialBasicGradleProject)1 GradleProject (org.gradle.tooling.model.GradleProject)1