use of org.gradle.tooling.internal.gradle.DefaultProjectIdentifier in project gradle by gradle.
the class GradleBuildBuilder method convert.
private BasicGradleProject convert(Project project, Map<Project, BasicGradleProject> convertedProjects) {
DefaultProjectIdentifier id = new DefaultProjectIdentifier(project.getRootDir(), project.getPath());
BasicGradleProject converted = new BasicGradleProject().setName(project.getName()).setProjectIdentifier(id);
converted.setProjectDirectory(project.getProjectDir());
if (project.getParent() != null) {
converted.setParent(convertedProjects.get(project.getParent()));
}
convertedProjects.put(project, converted);
for (Project child : project.getChildProjects().values()) {
converted.addChild(convert(child, convertedProjects));
}
return converted;
}
use of org.gradle.tooling.internal.gradle.DefaultProjectIdentifier in project gradle by gradle.
the class GradleBuildConverter method toPartialGradleProject.
private PartialBasicGradleProject toPartialGradleProject(GradleProject childProject) {
PartialBasicGradleProject basicGradleProject = new PartialBasicGradleProject();
basicGradleProject.setName(childProject.getName());
ProjectIdentifier id = childProject.getProjectIdentifier();
basicGradleProject.setProjectIdentifier(new DefaultProjectIdentifier(id.getBuildIdentifier().getRootDir(), id.getProjectPath()));
return basicGradleProject;
}
use of org.gradle.tooling.internal.gradle.DefaultProjectIdentifier in project gradle by gradle.
the class CppModelBuilder method buildAll.
@Override
public Object buildAll(String modelName, Project project) {
DefaultProjectIdentifier projectIdentifier = new DefaultProjectIdentifier(project.getRootDir(), project.getPath());
CompilerOutputFileNamingSchemeFactory namingSchemeFactory = new CompilerOutputFileNamingSchemeFactory(((ProjectInternal) project).getFileResolver());
DefaultCppComponentModel mainComponent = null;
CppApplication application = project.getComponents().withType(CppApplication.class).findByName("main");
if (application != null) {
mainComponent = new DefaultCppApplicationModel(application.getName(), application.getBaseName().get(), binariesFor(application, application.getPrivateHeaderDirs(), projectIdentifier, namingSchemeFactory));
} else {
DefaultCppLibrary library = (DefaultCppLibrary) project.getComponents().withType(CppLibrary.class).findByName("main");
if (library != null) {
mainComponent = new DefaultCppLibraryModel(library.getName(), library.getBaseName().get(), binariesFor(library, library.getAllHeaderDirs(), projectIdentifier, namingSchemeFactory));
}
}
DefaultCppComponentModel testComponent = null;
CppTestSuite testSuite = project.getComponents().withType(CppTestSuite.class).findByName("test");
if (testSuite != null) {
testComponent = new DefaultCppTestSuiteModel(testSuite.getName(), testSuite.getBaseName().get(), binariesFor(testSuite, testSuite.getPrivateHeaderDirs(), projectIdentifier, namingSchemeFactory));
}
return new DefaultCppProjectModel(projectIdentifier, mainComponent, testComponent);
}
use of org.gradle.tooling.internal.gradle.DefaultProjectIdentifier in project gradle by gradle.
the class GradleBuildBuilder method convert.
private BasicGradleProject convert(BuildState owner, ProjectState project, Map<ProjectState, BasicGradleProject> convertedProjects) {
DefaultProjectIdentifier id = new DefaultProjectIdentifier(owner.getBuildRootDir(), project.getProjectPath().getPath());
BasicGradleProject converted = new BasicGradleProject().setName(project.getName()).setProjectIdentifier(id);
converted.setProjectDirectory(project.getProjectDir());
if (project.getBuildParent() != null) {
converted.setParent(convertedProjects.get(project.getBuildParent()));
}
convertedProjects.put(project, converted);
for (ProjectState child : project.getChildProjects()) {
converted.addChild(convert(owner, child, convertedProjects));
}
return converted;
}
use of org.gradle.tooling.internal.gradle.DefaultProjectIdentifier 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