use of org.gradle.plugins.ide.internal.tooling.idea.DefaultIdeaProject in project gradle by gradle.
the class IdeaModelBuilder method appendModule.
private void appendModule(Map<String, DefaultIdeaModule> modules, IdeaModule ideaModule, DefaultIdeaProject ideaProject, DefaultGradleProject rootGradleProject) {
DefaultIdeaContentRoot contentRoot = new DefaultIdeaContentRoot().setRootDirectory(ideaModule.getContentRoot()).setSourceDirectories(srcDirs(ideaModule.getSourceDirs(), ideaModule.getGeneratedSourceDirs())).setTestDirectories(srcDirs(ideaModule.getTestSourceDirs(), 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()));
JavaPluginConvention javaPluginConvention = project.getConvention().findPlugin(JavaPluginConvention.class);
if (javaPluginConvention != null) {
final IdeaLanguageLevel ideaModuleLanguageLevel = ideaModule.getLanguageLevel();
JavaVersion moduleSourceLanguageLevel = convertIdeaLanguageLevelToJavaVersion(ideaModuleLanguageLevel);
JavaVersion moduleTargetBytecodeVersion = ideaModule.getTargetBytecodeVersion();
defaultIdeaModule.setJavaLanguageSettings(new DefaultIdeaJavaLanguageSettings().setSourceLanguageLevel(moduleSourceLanguageLevel).setTargetBytecodeVersion(moduleTargetBytecodeVersion));
}
modules.put(ideaModule.getName(), defaultIdeaModule);
}
use of org.gradle.plugins.ide.internal.tooling.idea.DefaultIdeaProject 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.idea.DefaultIdeaProject in project gradle by gradle.
the class IdeaModelBuilder method build.
private DefaultIdeaProject build(Project project, DefaultGradleProject rootGradleProject) {
IdeaModel ideaModel = ideaPluginFor(project).getModel();
IdeaProject projectModel = ideaModel.getProject();
JavaVersion projectSourceLanguageLevel = convertIdeaLanguageLevelToJavaVersion(projectModel.getLanguageLevel());
JavaVersion projectTargetBytecodeLevel = projectModel.getTargetBytecodeVersion();
DefaultIdeaProject out = new DefaultIdeaProject().setName(projectModel.getName()).setJdkName(projectModel.getJdkName()).setLanguageLevel(new DefaultIdeaLanguageLevel(projectModel.getLanguageLevel().getLevel())).setJavaLanguageSettings(new DefaultIdeaJavaLanguageSettings().setSourceLanguageLevel(projectSourceLanguageLevel).setTargetBytecodeVersion(projectTargetBytecodeLevel).setJdk(DefaultInstalledJdk.current()));
List<DefaultIdeaModule> ideaModules = Lists.newArrayList();
for (IdeaModule module : projectModel.getModules()) {
ideaModules.add(createModule(module, out, rootGradleProject));
}
out.setChildren(new LinkedList<>(ideaModules));
return out;
}
use of org.gradle.plugins.ide.internal.tooling.idea.DefaultIdeaProject 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);
}
Aggregations