use of org.gradle.tooling.model.gradle.GradleBuild in project intellij-community by JetBrains.
the class ProjectImportAction method execute.
@Nullable
@Override
public AllModels execute(final BuildController controller) {
configureAdditionalTypes(controller);
//outer conditional is needed to be compatible with 1.8
final IdeaProject ideaProject = myIsPreviewMode ? controller.getModel(BasicIdeaProject.class) : controller.getModel(IdeaProject.class);
if (ideaProject == null || ideaProject.getModules().isEmpty()) {
return null;
}
AllModels allModels = new AllModels(ideaProject);
allModels.setGradleProjectDirSupported(myIsGradleProjectDirSupported);
BuildEnvironment buildEnvironment = controller.findModel(BuildEnvironment.class);
allModels.setBuildEnvironment(buildEnvironment);
addExtraProject(controller, allModels, null);
for (IdeaModule module : ideaProject.getModules()) {
addExtraProject(controller, allModels, module);
}
if (myIsCompositeBuildsSupported) {
GradleBuild gradleBuild = controller.getModel(GradleBuild.class);
for (GradleBuild build : gradleBuild.getIncludedBuilds()) {
IdeaProject ideaIncludedProject = controller.findModel(build, IdeaProject.class);
allModels.getIncludedBuilds().add(ideaIncludedProject);
for (IdeaModule module : ideaIncludedProject.getModules()) {
addExtraProject(controller, allModels, module);
}
}
}
return allModels;
}
use of org.gradle.tooling.model.gradle.GradleBuild in project gradle by gradle.
the class GetModel method execute.
@Override
public Map<String, AndroidProject> execute(BuildController controller) {
System.out.println("* Building models");
Timer timer = new Timer();
GradleBuild build = controller.getBuildModel();
Map<String, AndroidProject> result = new TreeMap<String, AndroidProject>();
for (BasicGradleProject project : build.getProjects()) {
AndroidProject androidProject = controller.findModel(project, AndroidProject.class);
result.put(project.getPath(), androidProject);
}
timer.stop();
System.out.println("building models took " + timer.duration());
// new Inspector().inspectModel(result);
return result;
}
use of org.gradle.tooling.model.gradle.GradleBuild in project gradle by gradle.
the class AccessIncludedBuildProjectBuildAction method execute.
public List<String> execute(BuildController controller) {
List<String> model = new ArrayList<String>();
for (GradleBuild included : controller.getBuildModel().getIncludedBuilds()) {
EclipseProject project = controller.getModel(included.getRootProject(), EclipseProject.class);
model.add(project.getName());
}
return model;
}
use of org.gradle.tooling.model.gradle.GradleBuild in project gradle by gradle.
the class ActionRunsMultipleLevelsOfNestedActions method execute.
@Override
public List<Models> execute(BuildController controller) {
GradleBuild buildModel = controller.getBuildModel();
List<GetModelViaNestedAction> projectActions = new ArrayList<GetModelViaNestedAction>();
for (BasicGradleProject project : buildModel.getProjects()) {
projectActions.add(new GetModelViaNestedAction(project));
}
return controller.run(projectActions);
}
use of org.gradle.tooling.model.gradle.GradleBuild in project gradle by gradle.
the class FetchIncludedGradleProjects method execute.
@Override
public List<GradleProject> execute(BuildController controller) {
List<GradleProject> projects = new ArrayList<GradleProject>();
GradleBuild build = controller.getBuildModel();
for (GradleBuild includedBuild : build.getIncludedBuilds()) {
projects.add(controller.getModel(includedBuild, GradleProject.class));
}
return projects;
}
Aggregations