use of org.gradle.api.Project in project gradle by gradle.
the class GradleProjectBuilder method buildHierarchy.
private DefaultGradleProject<LaunchableGradleTask> buildHierarchy(Project project) {
List<DefaultGradleProject<LaunchableGradleTask>> children = new ArrayList<DefaultGradleProject<LaunchableGradleTask>>();
for (Project child : project.getChildProjects().values()) {
children.add(buildHierarchy(child));
}
DefaultGradleProject<LaunchableGradleTask> gradleProject = new DefaultGradleProject<LaunchableGradleTask>().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());
gradleProject.setTasks(tasks(gradleProject, (TaskContainerInternal) project.getTasks()));
for (DefaultGradleProject child : children) {
child.setParent(gradleProject);
}
return gradleProject;
}
use of org.gradle.api.Project 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.api.Project in project gradle by gradle.
the class IdeaModelBuilder method buildAll.
@Override
public DefaultIdeaProject buildAll(String modelName, Project project) {
Project root = project.getRootProject();
applyIdeaPlugin(root);
DefaultGradleProject<?> rootGradleProject = gradleProjectBuilder.buildAll(project);
return build(root, rootGradleProject);
}
use of org.gradle.api.Project in project gradle by gradle.
the class BuildInvocationsBuilder method findTasks.
private void findTasks(Project project, Map<String, LaunchableGradleTaskSelector> taskSelectors, Collection<String> visibleTasks) {
for (Project child : project.getChildProjects().values()) {
findTasks(child, taskSelectors, visibleTasks);
}
for (Task task : taskLister.listProjectTasks(project)) {
// this way, for each task selector, its description will be the one from the selected task with the 'smallest' path
if (!taskSelectors.containsKey(task.getName())) {
LaunchableGradleTaskSelector taskSelector = new LaunchableGradleTaskSelector().setDescription(task.getDescription()).setPath(task.getPath());
taskSelectors.put(task.getName(), taskSelector);
} else {
LaunchableGradleTaskSelector taskSelector = taskSelectors.get(task.getName());
if (hasPathWithLowerOrdering(task, taskSelector)) {
taskSelector.setDescription(task.getDescription()).setPath(task.getPath());
}
}
// visible tasks are specified as those that have a non-empty group
if (PublicTaskSpecification.INSTANCE.isSatisfiedBy(task)) {
visibleTasks.add(task.getName());
}
}
}
use of org.gradle.api.Project in project gradle by gradle.
the class EclipseModelBuilder method applyEclipsePlugin.
private void applyEclipsePlugin(Project root) {
Set<Project> allProjects = root.getAllprojects();
for (Project p : allProjects) {
p.getPluginManager().apply(EclipsePlugin.class);
}
root.getPlugins().getPlugin(EclipsePlugin.class).performPostEvaluationActions();
}
Aggregations