use of org.gradle.api.internal.project.ProjectState 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.api.internal.project.ProjectState in project gradle by gradle.
the class DefaultUniqueProjectNameProvider method getUniqueName.
@Override
public String getUniqueName(Project project) {
ProjectState projectState = projectRegistry.stateFor(project);
String uniqueName = getDeduplicatedNames().get(projectState);
if (uniqueName != null) {
return uniqueName;
}
return project.getName();
}
use of org.gradle.api.internal.project.ProjectState in project gradle by gradle.
the class TestExecutionBuildConfigurationAction method configureBuildForInternalJvmTestRequest.
private List<Test> configureBuildForInternalJvmTestRequest(GradleInternal gradle, TestExecutionRequestAction testExecutionRequest) {
final Collection<InternalJvmTestRequest> internalJvmTestRequests = testExecutionRequest.getInternalJvmTestRequests();
if (internalJvmTestRequests.isEmpty()) {
return Collections.emptyList();
}
List<Test> tasksToExecute = new ArrayList<Test>();
gradle.getOwner().ensureProjectsConfigured();
for (ProjectState projectState : gradle.getOwner().getProjects().getAllProjects()) {
projectState.ensureConfigured();
projectState.applyToMutableState(project -> {
final Collection<Test> testTasks = project.getTasks().withType(Test.class);
for (Test testTask : testTasks) {
for (InternalJvmTestRequest jvmTestRequest : internalJvmTestRequests) {
final TestFilter filter = testTask.getFilter();
filter.includeTest(jvmTestRequest.getClassName(), jvmTestRequest.getMethodName());
}
}
tasksToExecute.addAll(testTasks);
});
}
return tasksToExecute;
}
use of org.gradle.api.internal.project.ProjectState in project gradle by gradle.
the class DefaultBuildController method getTarget.
private ToolingModelScope getTarget(@Nullable Object target, ModelIdentifier modelIdentifier, boolean parameter) {
if (target == null) {
return controller.locateBuilderForDefaultTarget(modelIdentifier.getName(), parameter);
} else if (target instanceof GradleProjectIdentity) {
GradleProjectIdentity projectIdentity = (GradleProjectIdentity) target;
BuildState build = findBuild(projectIdentity);
ProjectState project = findProject(build, projectIdentity);
return controller.locateBuilderForTarget(project, modelIdentifier.getName(), parameter);
} else if (target instanceof GradleBuildIdentity) {
GradleBuildIdentity buildIdentity = (GradleBuildIdentity) target;
BuildState build = findBuild(buildIdentity);
return controller.locateBuilderForTarget(build, modelIdentifier.getName(), parameter);
} else {
throw new IllegalArgumentException("Don't know how to build models for " + target);
}
}
use of org.gradle.api.internal.project.ProjectState in project gradle by gradle.
the class DefaultBuildToolingModelController method locateBuilderForTarget.
@Override
public ToolingModelScope locateBuilderForTarget(String modelName, boolean param) {
// Look for a build scoped builder
ToolingModelBuilderLookup.Builder builder = buildScopeLookup.maybeLocateForBuildScope(modelName, param, buildState);
if (builder != null) {
return new BuildToolingScope(builder);
}
// Force configuration of the build and locate builder for default project
ProjectState targetProject = buildController.withProjectsConfigured(gradle -> gradle.getDefaultProject().getOwner());
return doLocate(targetProject, modelName, param);
}
Aggregations