Search in sources :

Example 6 with BuildIdentifier

use of org.gradle.api.artifacts.component.BuildIdentifier in project gradle by gradle.

the class IdeaPlugin method allImlArtifactsInComposite.

private List<TaskDependency> allImlArtifactsInComposite(ProjectInternal project, IdeaProject ideaProject) {
    List<TaskDependency> dependencies = Lists.newArrayList();
    ProjectComponentIdentifier thisProjectId = projectPathRegistry.getProjectComponentIdentifier(project.getIdentityPath());
    for (IdeArtifactRegistry.Reference<IdeaModuleMetadata> reference : artifactRegistry.getIdeArtifactMetadata(IdeaModuleMetadata.class)) {
        BuildIdentifier otherBuildId = reference.getOwningProject().getBuild();
        if (thisProjectId.getBuild().equals(otherBuildId)) {
            // IDEA Module for project in current build: don't include any module that has been excluded from project
            boolean found = false;
            for (IdeaModule ideaModule : ideaProject.getModules()) {
                if (reference.get().getFile().equals(ideaModule.getOutputFile())) {
                    found = true;
                    break;
                }
            }
            if (!found) {
                continue;
            }
        }
        dependencies.add(reference.getBuildDependencies());
    }
    return dependencies;
}
Also used : TaskDependency(org.gradle.api.tasks.TaskDependency) IdeaModule(org.gradle.plugins.ide.idea.model.IdeaModule) IdeaModuleMetadata(org.gradle.plugins.ide.idea.internal.IdeaModuleMetadata) IdeArtifactRegistry(org.gradle.plugins.ide.internal.IdeArtifactRegistry) BuildIdentifier(org.gradle.api.artifacts.component.BuildIdentifier) ProjectComponentIdentifier(org.gradle.api.artifacts.component.ProjectComponentIdentifier)

Example 7 with BuildIdentifier

use of org.gradle.api.artifacts.component.BuildIdentifier in project gradle by gradle.

the class IdeaProject method configureModulePaths.

private void configureModulePaths(Project xmlProject) {
    ProjectComponentIdentifier thisProjectId = projectPathRegistry.getProjectComponentIdentifier(((ProjectInternal) project).getIdentityPath());
    for (IdeArtifactRegistry.Reference<IdeaModuleMetadata> reference : artifactRegistry.getIdeArtifactMetadata(IdeaModuleMetadata.class)) {
        BuildIdentifier otherBuildId = reference.getOwningProject().getBuild();
        if (thisProjectId.getBuild().equals(otherBuildId)) {
            // IDEA Module for project in current build: handled via `modules` model elements.
            continue;
        }
        xmlProject.addModulePath(reference.get().getFile());
    }
}
Also used : IdeaModuleMetadata(org.gradle.plugins.ide.idea.internal.IdeaModuleMetadata) IdeArtifactRegistry(org.gradle.plugins.ide.internal.IdeArtifactRegistry) BuildIdentifier(org.gradle.api.artifacts.component.BuildIdentifier) ProjectComponentIdentifier(org.gradle.api.artifacts.component.ProjectComponentIdentifier)

Example 8 with BuildIdentifier

use of org.gradle.api.artifacts.component.BuildIdentifier in project gradle by gradle.

the class CompositeBuildTaskDelegate method executeTasksInOtherBuild.

@TaskAction
public void executeTasksInOtherBuild() {
    IncludedBuilds includedBuilds = getServices().get(IncludedBuilds.class);
    IncludedBuildExecuter builder = getServices().get(IncludedBuildExecuter.class);
    IncludedBuild includedBuild = includedBuilds.getBuild(build);
    BuildIdentifier buildId = new DefaultBuildIdentifier(includedBuild.getName());
    // sourceBuild is currently always root build in a composite
    builder.execute(new DefaultBuildIdentifier(":", true), buildId, tasks);
}
Also used : DefaultBuildIdentifier(org.gradle.api.internal.artifacts.component.DefaultBuildIdentifier) BuildIdentifier(org.gradle.api.artifacts.component.BuildIdentifier) DefaultBuildIdentifier(org.gradle.api.internal.artifacts.component.DefaultBuildIdentifier) IncludedBuildExecuter(org.gradle.initialization.IncludedBuildExecuter) IncludedBuilds(org.gradle.initialization.IncludedBuilds) IncludedBuild(org.gradle.api.initialization.IncludedBuild) TaskAction(org.gradle.api.tasks.TaskAction)

Example 9 with BuildIdentifier

use of org.gradle.api.artifacts.component.BuildIdentifier in project gradle by gradle.

the class DefaultIncludedBuildExecuter method reportCycle.

private String reportCycle(List<BuildIdentifier> cycle) {
    StringBuilder cycleReport = new StringBuilder();
    for (BuildIdentifier buildIdentifier : cycle) {
        cycleReport.append(buildIdentifier);
        cycleReport.append(" -> ");
    }
    cycleReport.append(cycle.get(0));
    return cycleReport.toString();
}
Also used : BuildIdentifier(org.gradle.api.artifacts.component.BuildIdentifier)

Example 10 with BuildIdentifier

use of org.gradle.api.artifacts.component.BuildIdentifier in project gradle by gradle.

the class IncludedBuildArtifactBuilder method willBuild.

public void willBuild(ComponentArtifactMetadata artifact) {
    if (artifact instanceof CompositeProjectComponentArtifactMetadata) {
        CompositeProjectComponentArtifactMetadata compositeBuildArtifact = (CompositeProjectComponentArtifactMetadata) artifact;
        BuildIdentifier buildId = getBuildIdentifier(compositeBuildArtifact);
        addTasksForBuild(buildId, compositeBuildArtifact);
    }
}
Also used : BuildIdentifier(org.gradle.api.artifacts.component.BuildIdentifier)

Aggregations

BuildIdentifier (org.gradle.api.artifacts.component.BuildIdentifier)15 ProjectComponentIdentifier (org.gradle.api.artifacts.component.ProjectComponentIdentifier)3 DefaultBuildIdentifier (org.gradle.api.internal.artifacts.DefaultBuildIdentifier)3 ProjectComponentSelector (org.gradle.api.artifacts.component.ProjectComponentSelector)2 DefaultProjectDescriptor (org.gradle.initialization.DefaultProjectDescriptor)2 DefaultProjectComponentSelector (org.gradle.internal.component.local.model.DefaultProjectComponentSelector)2 ModuleVersionResolveException (org.gradle.internal.resolve.ModuleVersionResolveException)2 IdeaModuleMetadata (org.gradle.plugins.ide.idea.internal.IdeaModuleMetadata)2 IdeArtifactRegistry (org.gradle.plugins.ide.internal.IdeArtifactRegistry)2 Task (org.gradle.api.Task)1 LibraryBinaryIdentifier (org.gradle.api.artifacts.component.LibraryBinaryIdentifier)1 ModuleComponentIdentifier (org.gradle.api.artifacts.component.ModuleComponentIdentifier)1 IncludedBuild (org.gradle.api.initialization.IncludedBuild)1 DefaultBuildIdentifier (org.gradle.api.internal.artifacts.component.DefaultBuildIdentifier)1 MavenUniqueSnapshotComponentIdentifier (org.gradle.api.internal.artifacts.repositories.resolver.MavenUniqueSnapshotComponentIdentifier)1 TaskAction (org.gradle.api.tasks.TaskAction)1 TaskDependency (org.gradle.api.tasks.TaskDependency)1 TaskInstantiationException (org.gradle.api.tasks.TaskInstantiationException)1 IncludedBuildExecuter (org.gradle.initialization.IncludedBuildExecuter)1 IncludedBuilds (org.gradle.initialization.IncludedBuilds)1