use of org.gradle.plugins.ide.internal.tooling.model.DefaultGradleProject in project gradle by gradle.
the class IdeaModelBuilder method createModule.
private DefaultIdeaModule createModule(IdeaModule ideaModule, DefaultIdeaProject ideaProject, DefaultGradleProject rootGradleProject) {
DefaultIdeaContentRoot contentRoot = new DefaultIdeaContentRoot().setRootDirectory(ideaModule.getContentRoot()).setSourceDirectories(srcDirs(ideaModule.getSourceDirs(), ideaModule.getGeneratedSourceDirs())).setTestDirectories(srcDirs(ideaModule.getTestSources().getFiles(), ideaModule.getGeneratedSourceDirs())).setResourceDirectories(srcDirs(ideaModule.getResourceDirs(), ideaModule.getGeneratedSourceDirs())).setTestResourceDirectories(srcDirs(ideaModule.getTestResources().getFiles(), ideaModule.getGeneratedSourceDirs())).setExcludeDirectories(ideaModule.getExcludeDirs());
Project project = ideaModule.getProject();
DefaultIdeaModule defaultIdeaModule = new DefaultIdeaModule().setName(ideaModule.getName()).setParent(ideaProject).setGradleProject(rootGradleProject.findByPath(ideaModule.getProject().getPath())).setContentRoots(Collections.singletonList(contentRoot)).setJdkName(ideaModule.getJdkName()).setCompilerOutput(new DefaultIdeaCompilerOutput().setInheritOutputDirs(ideaModule.getInheritOutputDirs() != null ? ideaModule.getInheritOutputDirs() : false).setOutputDir(ideaModule.getOutputDir()).setTestOutputDir(ideaModule.getTestOutputDir()));
JavaPluginExtension javaPluginExtension = project.getExtensions().findByType(JavaPluginExtension.class);
if (javaPluginExtension != null) {
final IdeaLanguageLevel ideaModuleLanguageLevel = ideaModule.getLanguageLevel();
JavaVersion moduleSourceLanguageLevel = convertIdeaLanguageLevelToJavaVersion(ideaModuleLanguageLevel);
JavaVersion moduleTargetBytecodeVersion = ideaModule.getTargetBytecodeVersion();
defaultIdeaModule.setJavaLanguageSettings(new DefaultIdeaJavaLanguageSettings().setSourceLanguageLevel(moduleSourceLanguageLevel).setTargetBytecodeVersion(moduleTargetBytecodeVersion));
}
buildDependencies(defaultIdeaModule, ideaModule);
return defaultIdeaModule;
}
use of org.gradle.plugins.ide.internal.tooling.model.DefaultGradleProject in project gradle by gradle.
the class IdeaModelBuilder method buildAll.
@Override
public DefaultIdeaProject buildAll(String modelName, Project project) {
Project root = project.getRootProject();
applyIdeaPlugin((ProjectInternal) root, new ArrayList<>());
DefaultGradleProject rootGradleProject = gradleProjectBuilder.buildAll(project);
return build(root, rootGradleProject);
}
use of org.gradle.plugins.ide.internal.tooling.model.DefaultGradleProject in project gradle by gradle.
the class GradleProjectBuilder method buildHierarchy.
private DefaultGradleProject buildHierarchy(Project project) {
List<DefaultGradleProject> children = new ArrayList<DefaultGradleProject>();
for (Project child : project.getChildProjects().values()) {
children.add(buildHierarchy(child));
}
DefaultGradleProject gradleProject = new DefaultGradleProject().setProjectIdentifier(new DefaultProjectIdentifier(project.getRootDir(), project.getPath())).setName(project.getName()).setDescription(project.getDescription()).setBuildDirectory(project.getBuildDir()).setProjectDirectory(project.getProjectDir()).setChildren(children);
gradleProject.getBuildScript().setSourceFile(project.getBuildFile());
/*
Internal system property to investigate model loading performance in IDEA/Android Studio.
The model loading can be altered with the following values:
- "omit_all_tasks": The model builder won't realize the task graph. The returned model will contain an empty task list.
- "skip_task_graph_realization": The model builder won't realize the task graph. The returned model will contain artificial tasks created from the task names.
- "skip_task_serialization": The model builder will realize the task graph but won't send it to the client.
- "unmodified" (or any other value): The model builder will run unchanged.
*/
String projectOptions = System.getProperty("org.gradle.internal.GradleProjectBuilderOptions", "unmodified");
List<LaunchableGradleTask> tasks = tasks(gradleProject, (TaskContainerInternal) project.getTasks(), projectOptions);
if (!"skip_task_serialization".equals(projectOptions)) {
gradleProject.setTasks(tasks);
}
for (DefaultGradleProject child : children) {
child.setParent(gradleProject);
}
return gradleProject;
}
Aggregations