Search in sources :

Example 1 with ProjectState

use of org.gradle.api.internal.project.ProjectState in project gradle by gradle.

the class InstantiatingBuildLoader method createChildProjectsRecursively.

private void createChildProjectsRecursively(BuildState owner, DefaultProjectDescriptor parentProjectDescriptor, ClassLoaderScope parentProjectClassLoaderScope, ClassLoaderScope baseProjectClassLoaderScope) {
    for (DefaultProjectDescriptor childProjectDescriptor : parentProjectDescriptor.children()) {
        ClassLoaderScope childProjectClassLoaderScope = parentProjectClassLoaderScope.createChild("project-" + childProjectDescriptor.getName());
        ProjectState projectState = owner.getProjects().getProject(childProjectDescriptor.path());
        projectState.createMutableModel(childProjectClassLoaderScope, baseProjectClassLoaderScope);
        createChildProjectsRecursively(owner, childProjectDescriptor, childProjectClassLoaderScope, baseProjectClassLoaderScope);
    }
}
Also used : ClassLoaderScope(org.gradle.api.internal.initialization.ClassLoaderScope) ProjectState(org.gradle.api.internal.project.ProjectState)

Example 2 with ProjectState

use of org.gradle.api.internal.project.ProjectState in project gradle by gradle.

the class DefaultConfiguration method markReferencedProjectConfigurationsObserved.

private void markReferencedProjectConfigurationsObserved(InternalState requestedState, ResolverResults results) {
    ProjectInternal consumingProject = domainObjectContext.getProject();
    ProjectState consumingProjectState = consumingProject == null ? null : consumingProject.getOwner();
    for (ResolvedProjectConfiguration projectResult : results.getResolvedLocalComponents().getResolvedProjectConfigurations()) {
        ProjectState targetProjectState = projectStateRegistry.stateFor(projectResult.getId());
        dependencyObservedBroadcast.dependencyObserved(consumingProjectState, targetProjectState, requestedState, projectResult);
    }
}
Also used : ProjectInternal(org.gradle.api.internal.project.ProjectInternal) ProjectState(org.gradle.api.internal.project.ProjectState) ResolvedProjectConfiguration(org.gradle.api.internal.artifacts.ivyservice.resolveengine.projectresult.ResolvedProjectConfiguration)

Example 3 with ProjectState

use of org.gradle.api.internal.project.ProjectState in project gradle by gradle.

the class ProjectArtifactResolver method resolveArtifactLater.

public ValueCalculator<File> resolveArtifactLater(ComponentArtifactMetadata artifact) {
    LocalComponentArtifactMetadata projectArtifact = (LocalComponentArtifactMetadata) artifact;
    ProjectComponentIdentifier projectId = (ProjectComponentIdentifier) artifact.getComponentId();
    ProjectState projectState = projectStateRegistry.stateFor(projectId);
    return new ResolvingCalculator(projectState, projectArtifact);
}
Also used : ProjectState(org.gradle.api.internal.project.ProjectState) ProjectComponentIdentifier(org.gradle.api.artifacts.component.ProjectComponentIdentifier) LocalComponentArtifactMetadata(org.gradle.internal.component.local.model.LocalComponentArtifactMetadata)

Example 4 with ProjectState

use of org.gradle.api.internal.project.ProjectState in project gradle by gradle.

the class DefaultIdeArtifactRegistry method getIdeProjects.

@Override
public <T extends IdeProjectMetadata> List<Reference<T>> getIdeProjects(Class<T> type) {
    List<Reference<T>> result = Lists.newArrayList();
    for (ProjectState project : projectRegistry.getAllProjects()) {
        if (project.getOwner().isImplicitBuild()) {
            // Do not include implicit builds in workspace
            continue;
        }
        ProjectComponentIdentifier projectId = project.getComponentIdentifier();
        for (IdeProjectMetadata ideProjectMetadata : store.get(projectId)) {
            if (type.isInstance(ideProjectMetadata)) {
                T metadata = type.cast(ideProjectMetadata);
                result.add(new MetadataReference<T>(metadata, projectId));
            }
        }
    }
    return result;
}
Also used : ProjectState(org.gradle.api.internal.project.ProjectState) ProjectComponentIdentifier(org.gradle.api.artifacts.component.ProjectComponentIdentifier)

Example 5 with ProjectState

use of org.gradle.api.internal.project.ProjectState in project gradle by gradle.

the class GradleBuildBuilder method addProjects.

private void addProjects(BuildState target, DefaultGradleBuild model) {
    Map<ProjectState, BasicGradleProject> convertedProjects = new LinkedHashMap<>();
    ProjectState rootProject = target.getProjects().getRootProject();
    BasicGradleProject convertedRootProject = convert(target, rootProject, convertedProjects);
    model.setRootProject(convertedRootProject);
    for (ProjectState project : target.getProjects().getAllProjects()) {
        model.addProject(convertedProjects.get(project));
    }
}
Also used : BasicGradleProject(org.gradle.plugins.ide.internal.tooling.model.BasicGradleProject) ProjectState(org.gradle.api.internal.project.ProjectState) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

ProjectState (org.gradle.api.internal.project.ProjectState)20 ProjectInternal (org.gradle.api.internal.project.ProjectInternal)4 ProjectComponentIdentifier (org.gradle.api.artifacts.component.ProjectComponentIdentifier)3 ClassLoaderScope (org.gradle.api.internal.initialization.ClassLoaderScope)3 File (java.io.File)2 ArrayList (java.util.ArrayList)2 FileResolver (org.gradle.api.internal.file.FileResolver)2 ProjectStateRegistry (org.gradle.api.internal.project.ProjectStateRegistry)2 DefaultProjectDescriptor (org.gradle.initialization.DefaultProjectDescriptor)2 ProjectDescriptorRegistry (org.gradle.initialization.ProjectDescriptorRegistry)2 BuildState (org.gradle.internal.build.BuildState)2 DefaultResourceLockCoordinationService (org.gradle.internal.resources.DefaultResourceLockCoordinationService)2 ResourceLockCoordinationService (org.gradle.internal.resources.ResourceLockCoordinationService)2 BasicGradleProject (org.gradle.plugins.ide.internal.tooling.model.BasicGradleProject)2 LinkedHashMap (java.util.LinkedHashMap)1 ModuleVersionIdentifier (org.gradle.api.artifacts.ModuleVersionIdentifier)1 GradleInternal (org.gradle.api.internal.GradleInternal)1 StartParameterInternal (org.gradle.api.internal.StartParameterInternal)1 ResolvedProjectConfiguration (org.gradle.api.internal.artifacts.ivyservice.resolveengine.projectresult.ResolvedProjectConfiguration)1 AttributesSchemaInternal (org.gradle.api.internal.attributes.AttributesSchemaInternal)1