Package org.gradle.api.publish

Examples of org.gradle.api.publish.PublishingExtension


public class ProjectDependencyPublicationResolver {
    public ModuleVersionIdentifier resolve(ProjectDependency dependency) {
        Project dependencyProject = dependency.getDependencyProject();
        ((ProjectInternal) dependencyProject).evaluate();

        PublishingExtension publishing = dependencyProject.getExtensions().findByType(PublishingExtension.class);

        if (publishing == null || publishing.getPublications().withType(PublicationInternal.class).isEmpty()) {
            // Project does not apply publishing (or has no publications): simply use the project name in place of the dependency name
            return new DefaultModuleVersionIdentifier(dependency.getGroup(), dependencyProject.getName(), dependency.getVersion());
        }

        // See if all publications have the same identifier
        Set<? extends PublicationInternal> publications = publishing.getPublications().withType(PublicationInternal.class);
        Iterator<? extends PublicationInternal> iterator = publications.iterator();
        ModuleVersionIdentifier candidate = iterator.next().getCoordinates();
        while (iterator.hasNext()) {
            ModuleVersionIdentifier alternative = iterator.next().getCoordinates();
            if (!candidate.equals(alternative)) {
View Full Code Here

TOP

Related Classes of org.gradle.api.publish.PublishingExtension

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.