Search in sources :

Example 46 with ProjectInternal

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

the class TasksFromProjectDependencies method resolveProjectDependencies.

void resolveProjectDependencies(TaskDependencyResolveContext context, Set<ProjectDependency> projectDependencies) {
    for (ProjectDependency projectDependency : projectDependencies) {
        ProjectInternal dependencyProject = (ProjectInternal) projectDependency.getDependencyProject();
        dependencyProject.getOwner().ensureTasksDiscovered();
        Task nextTask = projectDependency.getDependencyProject().getTasks().findByName(taskName);
        if (nextTask != null && context.getTask() != nextTask) {
            context.add(nextTask);
        }
    }
}
Also used : Task(org.gradle.api.Task) ProjectInternal(org.gradle.api.internal.project.ProjectInternal) ProjectDependency(org.gradle.api.artifacts.ProjectDependency)

Example 47 with ProjectInternal

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

the class DefaultProjectComponentSelector method newSelector.

public static ProjectComponentSelector newSelector(Project project, ImmutableAttributes attributes, List<Capability> requestedCapabilities) {
    ProjectInternal projectInternal = (ProjectInternal) project;
    ProjectComponentIdentifier projectComponentIdentifier = projectInternal.getOwner().getComponentIdentifier();
    return new DefaultProjectComponentSelector(projectComponentIdentifier.getBuild(), projectInternal.getIdentityPath(), projectInternal.getProjectPath(), project.getName(), attributes, requestedCapabilities);
}
Also used : ProjectInternal(org.gradle.api.internal.project.ProjectInternal) ProjectComponentIdentifier(org.gradle.api.artifacts.component.ProjectComponentIdentifier) DefaultProjectComponentIdentifier(org.gradle.api.internal.artifacts.DefaultProjectComponentIdentifier)

Example 48 with ProjectInternal

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

the class ComponentReport method report.

@TaskAction
public void report() {
    ProjectInternal project = (ProjectInternal) getProject();
    project.prepareForRuleBasedPlugins();
    StyledTextOutput textOutput = getTextOutputFactory().create(ComponentReport.class);
    ComponentReportRenderer renderer = new ComponentReportRenderer(getFileResolver(), getBinaryRenderer());
    renderer.setOutput(textOutput);
    ProjectDetails projectDetails = ProjectDetails.of(project);
    renderer.startProject(projectDetails);
    Collection<ComponentSpec> components = new ArrayList<>();
    ComponentSpecContainer componentSpecs = modelElement("components", ComponentSpecContainer.class);
    if (componentSpecs != null) {
        components.addAll(componentSpecs.values());
    }
    ModelMap<ComponentSpec> testSuites = modelElement("testSuites", modelMap(ComponentSpec.class));
    if (testSuites != null) {
        components.addAll(testSuites.values());
    }
    renderer.renderComponents(components);
    ProjectSourceSet sourceSets = modelElement("sources", ProjectSourceSet.class);
    if (sourceSets != null) {
        renderer.renderSourceSets(sourceSets);
    }
    BinaryContainer binaries = modelElement("binaries", BinaryContainer.class);
    if (binaries != null) {
        renderer.renderBinaries(binaries.values());
    }
    renderer.completeProject(projectDetails);
    renderer.complete();
}
Also used : ProjectDetails(org.gradle.api.tasks.diagnostics.internal.ProjectDetails) ProjectSourceSet(org.gradle.language.base.ProjectSourceSet) ComponentSpecContainer(org.gradle.platform.base.ComponentSpecContainer) ProjectInternal(org.gradle.api.internal.project.ProjectInternal) ComponentReportRenderer(org.gradle.api.reporting.components.internal.ComponentReportRenderer) BinaryContainer(org.gradle.platform.base.BinaryContainer) ArrayList(java.util.ArrayList) StyledTextOutput(org.gradle.internal.logging.text.StyledTextOutput) ComponentSpec(org.gradle.platform.base.ComponentSpec) TaskAction(org.gradle.api.tasks.TaskAction)

Example 49 with ProjectInternal

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

the class ModelReport method report.

@TaskAction
public void report() {
    ProjectInternal project = (ProjectInternal) getProject();
    project.prepareForRuleBasedPlugins();
    StyledTextOutput textOutput = getTextOutputFactory().create(ModelReport.class);
    ModelNodeRenderer renderer = new ModelNodeRenderer(isShowHidden(), getFormat());
    TextModelReportRenderer textModelReportRenderer = new TextModelReportRenderer(renderer);
    textModelReportRenderer.setOutput(textOutput);
    ProjectDetails projectDetails = ProjectDetails.of(project);
    textModelReportRenderer.startProject(projectDetails);
    ModelRegistry modelRegistry = getModelRegistry();
    ModelNode rootNode = modelRegistry.realizeNode(ModelPath.ROOT);
    // Ensure binding validation has been done. This should happen elsewhere
    modelRegistry.bindAllReferences();
    textModelReportRenderer.render(rootNode);
    textModelReportRenderer.completeProject(projectDetails);
    textModelReportRenderer.complete();
}
Also used : ProjectDetails(org.gradle.api.tasks.diagnostics.internal.ProjectDetails) ModelRegistry(org.gradle.model.internal.registry.ModelRegistry) ProjectInternal(org.gradle.api.internal.project.ProjectInternal) ModelNodeRenderer(org.gradle.api.reporting.model.internal.ModelNodeRenderer) TextModelReportRenderer(org.gradle.api.reporting.model.internal.TextModelReportRenderer) StyledTextOutput(org.gradle.internal.logging.text.StyledTextOutput) ModelNode(org.gradle.model.internal.core.ModelNode) TaskAction(org.gradle.api.tasks.TaskAction)

Example 50 with ProjectInternal

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

the class EclipseWtpComponent method mergeXmlComponent.

@SuppressWarnings("unchecked")
public void mergeXmlComponent(WtpComponent xmlComponent) {
    file.getBeforeMerged().execute(xmlComponent);
    ProjectInternal projectInternal = (ProjectInternal) this.project;
    IdeArtifactRegistry ideArtifactRegistry = projectInternal.getServices().get(IdeArtifactRegistry.class);
    ProjectStateRegistry projectRegistry = projectInternal.getServices().get(ProjectStateRegistry.class);
    new WtpComponentFactory(projectInternal, ideArtifactRegistry, projectRegistry).configure(this, xmlComponent);
    file.getWhenMerged().execute(xmlComponent);
}
Also used : ProjectInternal(org.gradle.api.internal.project.ProjectInternal) IdeArtifactRegistry(org.gradle.plugins.ide.internal.IdeArtifactRegistry) ProjectStateRegistry(org.gradle.api.internal.project.ProjectStateRegistry) WtpComponentFactory(org.gradle.plugins.ide.eclipse.model.internal.WtpComponentFactory)

Aggregations

ProjectInternal (org.gradle.api.internal.project.ProjectInternal)58 File (java.io.File)13 Project (org.gradle.api.Project)11 Task (org.gradle.api.Task)6 ServiceRegistry (org.gradle.internal.service.ServiceRegistry)6 Inject (javax.inject.Inject)5 Plugin (org.gradle.api.Plugin)5 ProjectStateRegistry (org.gradle.api.internal.project.ProjectStateRegistry)5 Map (java.util.Map)4 Configuration (org.gradle.api.artifacts.Configuration)4 FileResolver (org.gradle.api.internal.file.FileResolver)4 Lists (com.google.common.collect.Lists)3 ArrayList (java.util.ArrayList)3 Collections (java.util.Collections)3 HashSet (java.util.HashSet)3 List (java.util.List)3 Set (java.util.Set)3 Callable (java.util.concurrent.Callable)3 Collectors (java.util.stream.Collectors)3 FileCollectionFactory (org.gradle.api.internal.file.FileCollectionFactory)3