org.gradle.initialization.ProjectAccessListener Java Examples

The following examples show how to use org.gradle.initialization.ProjectAccessListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
DependencyFactory createDependencyFactory(Instantiator instantiator,
                                          ProjectAccessListener projectAccessListener,
                                          StartParameter startParameter,
                                          ClassPathRegistry classPathRegistry,
                                          FileLookup fileLookup) {
    DefaultProjectDependencyFactory factory = new DefaultProjectDependencyFactory(
            projectAccessListener, instantiator, startParameter.isBuildProjectDependencies());

    ProjectDependencyFactory projectDependencyFactory = new ProjectDependencyFactory(factory);

    return new DefaultDependencyFactory(
            DependencyNotationParser.parser(instantiator, factory, classPathRegistry, fileLookup),
            new ClientModuleNotationParserFactory(instantiator).create(),
            projectDependencyFactory);
}
 
Example #2
Source Project: pushfish-android   Author: PushFish   File: DefaultProjectDependency.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
public DefaultProjectDependency(ProjectInternal dependencyProject, String configuration,
                                ProjectAccessListener projectAccessListener, boolean buildProjectDependencies) {
    super(configuration);
    this.dependencyProject = dependencyProject;
    this.projectAccessListener = projectAccessListener;
    this.buildProjectDependencies = buildProjectDependencies;
}
 
Example #3
DependencyFactory createDependencyFactory(Instantiator instantiator,
                                          ProjectAccessListener projectAccessListener,
                                          StartParameter startParameter,
                                          ClassPathRegistry classPathRegistry,
                                          FileLookup fileLookup) {
    DefaultProjectDependencyFactory factory = new DefaultProjectDependencyFactory(
            projectAccessListener, instantiator, startParameter.isBuildProjectDependencies());

    ProjectDependencyFactory projectDependencyFactory = new ProjectDependencyFactory(factory);
    DependencyProjectNotationParser projParser = new DependencyProjectNotationParser(factory);

    NotationParser<Object, ? extends Dependency> moduleMapParser = new DependencyMapNotationParser<DefaultExternalModuleDependency>(instantiator, DefaultExternalModuleDependency.class);
    NotationParser<Object, ? extends Dependency> moduleStringParser = new DependencyStringNotationParser<DefaultExternalModuleDependency>(instantiator, DefaultExternalModuleDependency.class);
    NotationParser<Object, ? extends Dependency> selfResolvingDependencyFactory = new DependencyFilesNotationParser(instantiator);

    List<NotationParser<Object, ? extends Dependency>> notationParsers = Arrays.asList(
            moduleStringParser,
            moduleMapParser,
            selfResolvingDependencyFactory,
            projParser,
            new DependencyClassPathNotationParser(instantiator, classPathRegistry, fileLookup.getFileResolver()));

    return new DefaultDependencyFactory(
            new DependencyNotationParser(notationParsers),
            new ClientModuleNotationParserFactory(instantiator).create(),
            projectDependencyFactory);
}
 
Example #4
Source Project: pushfish-android   Author: PushFish   File: DefaultProjectDependency.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
public DefaultProjectDependency(ProjectInternal dependencyProject, String configuration,
                                ProjectAccessListener projectAccessListener, boolean buildProjectDependencies) {
    super(configuration);
    this.dependencyProject = dependencyProject;
    this.projectAccessListener = projectAccessListener;
    this.buildProjectDependencies = buildProjectDependencies;
}
 
Example #5
DependencyFactory createDependencyFactory(Instantiator instantiator,
                                          ProjectAccessListener projectAccessListener,
                                          StartParameter startParameter,
                                          ClassPathRegistry classPathRegistry,
                                          FileLookup fileLookup) {
    DefaultProjectDependencyFactory factory = new DefaultProjectDependencyFactory(
            projectAccessListener, instantiator, startParameter.isBuildProjectDependencies());

    ProjectDependencyFactory projectDependencyFactory = new ProjectDependencyFactory(factory);

    return new DefaultDependencyFactory(
            DependencyNotationParser.parser(instantiator, factory, classPathRegistry, fileLookup),
            new ClientModuleNotationParserFactory(instantiator).create(),
            projectDependencyFactory);
}
 
Example #6
Source Project: Pushjet-Android   Author: Pushjet   File: DefaultProjectDependency.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
public DefaultProjectDependency(ProjectInternal dependencyProject, String configuration,
                                ProjectAccessListener projectAccessListener, boolean buildProjectDependencies) {
    super(configuration);
    this.dependencyProject = dependencyProject;
    this.projectAccessListener = projectAccessListener;
    this.buildProjectDependencies = buildProjectDependencies;
}
 
Example #7
DependencyFactory createDependencyFactory(Instantiator instantiator,
                                          ProjectAccessListener projectAccessListener,
                                          StartParameter startParameter,
                                          ClassPathRegistry classPathRegistry,
                                          FileLookup fileLookup) {
    DefaultProjectDependencyFactory factory = new DefaultProjectDependencyFactory(
            projectAccessListener, instantiator, startParameter.isBuildProjectDependencies());

    ProjectDependencyFactory projectDependencyFactory = new ProjectDependencyFactory(factory);
    DependencyProjectNotationParser projParser = new DependencyProjectNotationParser(factory);

    NotationParser<Object, ? extends Dependency> moduleMapParser = new DependencyMapNotationParser<DefaultExternalModuleDependency>(instantiator, DefaultExternalModuleDependency.class);
    NotationParser<Object, ? extends Dependency> moduleStringParser = new DependencyStringNotationParser<DefaultExternalModuleDependency>(instantiator, DefaultExternalModuleDependency.class);
    NotationParser<Object, ? extends Dependency> selfResolvingDependencyFactory = new DependencyFilesNotationParser(instantiator);

    List<NotationParser<Object, ? extends Dependency>> notationParsers = Arrays.asList(
            moduleStringParser,
            moduleMapParser,
            selfResolvingDependencyFactory,
            projParser,
            new DependencyClassPathNotationParser(instantiator, classPathRegistry, fileLookup.getFileResolver()));

    return new DefaultDependencyFactory(
            new DependencyNotationParser(notationParsers),
            new ClientModuleNotationParserFactory(instantiator).create(),
            projectDependencyFactory);
}
 
Example #8
Source Project: Pushjet-Android   Author: Pushjet   File: DefaultProjectDependency.java    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
public DefaultProjectDependency(ProjectInternal dependencyProject, String configuration,
                                ProjectAccessListener projectAccessListener, boolean buildProjectDependencies) {
    super(configuration);
    this.dependencyProject = dependencyProject;
    this.projectAccessListener = projectAccessListener;
    this.buildProjectDependencies = buildProjectDependencies;
}
 
Example #9
public DefaultProjectDependencyFactory(ProjectAccessListener projectAccessListener, Instantiator instantiator, boolean buildProjectDependencies) {
    this.projectAccessListener = projectAccessListener;
    this.instantiator = instantiator;
    this.buildProjectDependencies = buildProjectDependencies;
}
 
Example #10
Source Project: pushfish-android   Author: PushFish   File: DefaultTaskContainer.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultTaskContainer(ProjectInternal project, Instantiator instantiator, ITaskFactory taskFactory, ProjectAccessListener projectAccessListener) {
    super(Task.class, instantiator, project);
    this.taskFactory = taskFactory;
    this.projectAccessListener = projectAccessListener;
}
 
Example #11
Source Project: pushfish-android   Author: PushFish   File: DefaultTaskContainerFactory.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultTaskContainerFactory(Instantiator instantiator, ITaskFactory taskFactory, Project project, ProjectAccessListener projectAccessListener) {
    this.instantiator = instantiator;
    this.taskFactory = taskFactory;
    this.project = project;
    this.projectAccessListener = projectAccessListener;
}
 
Example #12
Source Project: pushfish-android   Author: PushFish   File: DefaultProjectDependency.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultProjectDependency(ProjectInternal dependencyProject, ProjectAccessListener projectAccessListener, boolean buildProjectDependencies) {
    this(dependencyProject, null, projectAccessListener, buildProjectDependencies);
}
 
Example #13
Source Project: pushfish-android   Author: PushFish   File: ProjectScopeServices.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
protected Factory<TaskContainerInternal> createTaskContainerInternal() {
    return new DefaultTaskContainerFactory(get(Instantiator.class), get(ITaskFactory.class), project, get(ProjectAccessListener.class));
}
 
Example #14
public DefaultProjectDependencyFactory(ProjectAccessListener projectAccessListener, Instantiator instantiator, boolean buildProjectDependencies) {
    this.projectAccessListener = projectAccessListener;
    this.instantiator = instantiator;
    this.buildProjectDependencies = buildProjectDependencies;
}
 
Example #15
Source Project: pushfish-android   Author: PushFish   File: DefaultTaskContainer.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultTaskContainer(ProjectInternal project, Instantiator instantiator, ITaskFactory taskFactory, ProjectAccessListener projectAccessListener) {
    super(Task.class, instantiator, project);
    this.taskFactory = taskFactory;
    this.projectAccessListener = projectAccessListener;
}
 
Example #16
Source Project: pushfish-android   Author: PushFish   File: DefaultTaskContainerFactory.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultTaskContainerFactory(Instantiator instantiator, ITaskFactory taskFactory, Project project, ProjectAccessListener projectAccessListener) {
    this.instantiator = instantiator;
    this.taskFactory = taskFactory;
    this.project = project;
    this.projectAccessListener = projectAccessListener;
}
 
Example #17
Source Project: pushfish-android   Author: PushFish   File: DefaultProjectDependency.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultProjectDependency(ProjectInternal dependencyProject, ProjectAccessListener projectAccessListener, boolean buildProjectDependencies) {
    this(dependencyProject, null, projectAccessListener, buildProjectDependencies);
}
 
Example #18
Source Project: pushfish-android   Author: PushFish   File: ProjectScopeServices.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
protected Factory<TaskContainerInternal> createTaskContainerInternal() {
    return new DefaultTaskContainerFactory(get(Instantiator.class), get(ITaskFactory.class), project, get(ProjectAccessListener.class));
}
 
Example #19
Source Project: thorntail   Author: thorntail   File: GradleDependencyResolutionHelper.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Resolve the given artifact specifications.
 *
 * @param project         the Gradle project reference.
 * @param specs           the specifications that need to be resolved.
 * @param transitive      should the artifacts be resolved transitively?
 * @param excludeDefaults should we skip resolving artifacts that belong to the Thorntail group?
 * @return collection of resolved artifact specifications.
 */
public static Set<ArtifactSpec> resolveArtifacts(Project project, Collection<ArtifactSpec> specs, boolean transitive,
                                                 boolean excludeDefaults) {
    if (project == null) {
        throw new IllegalArgumentException("Gradle project reference cannot be null.");
    }
    if (specs == null) {
        project.getLogger().warn("Artifact specification collection is null.");
        return Collections.emptySet();
    }

    // Early return if there is nothing to resolve.
    if (specs.isEmpty()) {
        return Collections.emptySet();
    }

    final Configuration config = project.getConfigurations().detachedConfiguration().setTransitive(transitive);
    final DependencySet dependencySet = config.getDependencies();
    final Map<String, Project> projectGAVCoordinates = getAllProjects(project);
    final ProjectAccessListener listener = new DefaultProjectAccessListener();

    Set<ArtifactSpec> result = new HashSet<>();
    specs.forEach(s -> {
        // 1. Do we need to resolve this entry?
        final String specGAV = String.format(GROUP_ARTIFACT_VERSION_FORMAT, s.groupId(), s.artifactId(), s.version());
        boolean resolved = s.file != null;
        boolean projectEntry = projectGAVCoordinates.containsKey(specGAV);

        // 2. Should we skip this spec?
        if (excludeDefaults && FractionDescriptor.THORNTAIL_GROUP_ID.equals(s.groupId()) && !projectEntry) {
            return;
        }

        // 3. Should this entry be resolved?
        if (!resolved || transitive) {
            // a.) Does this entry represent a project dependency?
            if (projectGAVCoordinates.containsKey(specGAV)) {
                dependencySet.add(new DefaultProjectDependency((ProjectInternal) projectGAVCoordinates.get(specGAV), listener, false));
            } else {
                DefaultExternalModuleDependency d = new DefaultExternalModuleDependency(s.groupId(), s.artifactId(), s.version());
                DefaultDependencyArtifact da = new DefaultDependencyArtifact(s.artifactId(), s.type(), s.type(), s.classifier(), null);
                d.addArtifact(da);
                dependencySet.add(d);
            }
        } else {
            // 4. Nothing else to do, just add the spec to the result.
            result.add(s);
        }
    });

    // 5. Are there any specs that need resolution?
    if (!dependencySet.isEmpty()) {
        config.getResolvedConfiguration().getResolvedArtifacts().stream()
                .map(ra -> asDescriptor("compile", ra).toArtifactSpec())
                .forEach(result::add);
    }
    return result;
}
 
Example #20
public DefaultProjectDependencyFactory(ProjectAccessListener projectAccessListener, Instantiator instantiator, boolean buildProjectDependencies) {
    this.projectAccessListener = projectAccessListener;
    this.instantiator = instantiator;
    this.buildProjectDependencies = buildProjectDependencies;
}
 
Example #21
Source Project: Pushjet-Android   Author: Pushjet   File: DefaultTaskContainer.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultTaskContainer(ProjectInternal project, Instantiator instantiator, ITaskFactory taskFactory, ProjectAccessListener projectAccessListener) {
    super(Task.class, instantiator, project);
    this.taskFactory = taskFactory;
    this.projectAccessListener = projectAccessListener;
}
 
Example #22
Source Project: Pushjet-Android   Author: Pushjet   File: DefaultTaskContainerFactory.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultTaskContainerFactory(Instantiator instantiator, ITaskFactory taskFactory, Project project, ProjectAccessListener projectAccessListener) {
    this.instantiator = instantiator;
    this.taskFactory = taskFactory;
    this.project = project;
    this.projectAccessListener = projectAccessListener;
}
 
Example #23
Source Project: Pushjet-Android   Author: Pushjet   File: DefaultProjectDependency.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultProjectDependency(ProjectInternal dependencyProject, ProjectAccessListener projectAccessListener, boolean buildProjectDependencies) {
    this(dependencyProject, null, projectAccessListener, buildProjectDependencies);
}
 
Example #24
Source Project: Pushjet-Android   Author: Pushjet   File: ProjectScopeServices.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
protected Factory<TaskContainerInternal> createTaskContainerInternal() {
    return new DefaultTaskContainerFactory(get(Instantiator.class), get(ITaskFactory.class), project, get(ProjectAccessListener.class));
}
 
Example #25
public DefaultProjectDependencyFactory(ProjectAccessListener projectAccessListener, Instantiator instantiator, boolean buildProjectDependencies) {
    this.projectAccessListener = projectAccessListener;
    this.instantiator = instantiator;
    this.buildProjectDependencies = buildProjectDependencies;
}
 
Example #26
Source Project: Pushjet-Android   Author: Pushjet   File: DefaultTaskContainer.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultTaskContainer(ProjectInternal project, Instantiator instantiator, ITaskFactory taskFactory, ProjectAccessListener projectAccessListener) {
    super(Task.class, instantiator, project);
    this.taskFactory = taskFactory;
    this.projectAccessListener = projectAccessListener;
}
 
Example #27
Source Project: Pushjet-Android   Author: Pushjet   File: DefaultTaskContainerFactory.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultTaskContainerFactory(Instantiator instantiator, ITaskFactory taskFactory, Project project, ProjectAccessListener projectAccessListener) {
    this.instantiator = instantiator;
    this.taskFactory = taskFactory;
    this.project = project;
    this.projectAccessListener = projectAccessListener;
}
 
Example #28
Source Project: Pushjet-Android   Author: Pushjet   File: DefaultProjectDependency.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultProjectDependency(ProjectInternal dependencyProject, ProjectAccessListener projectAccessListener, boolean buildProjectDependencies) {
    this(dependencyProject, null, projectAccessListener, buildProjectDependencies);
}
 
Example #29
Source Project: Pushjet-Android   Author: Pushjet   File: ProjectScopeServices.java    License: BSD 2-Clause "Simplified" License 4 votes vote down vote up
protected Factory<TaskContainerInternal> createTaskContainerInternal() {
    return new DefaultTaskContainerFactory(get(Instantiator.class), get(ITaskFactory.class), project, get(ProjectAccessListener.class));
}