Java 类org.gradle.api.component.SoftwareComponent 实例源码

项目:Reer    文件:DefaultMavenPublication.java   
public void from(SoftwareComponent component) {
    if (this.component != null) {
        throw new InvalidUserDataException(String.format("Maven publication '%s' cannot include multiple components", name));
    }
    this.component = (SoftwareComponentInternal) component;

    for (Usage usage : this.component.getUsages()) {
        // TODO Need a smarter way to map usage to artifact classifier
        for (PublishArtifact publishArtifact : usage.getArtifacts()) {
            artifact(publishArtifact);
        }

        // TODO Need a smarter way to map usage to scope
        for (ModuleDependency dependency : usage.getDependencies()) {
            if (dependency instanceof ProjectDependency) {
                addProjectDependency((ProjectDependency) dependency);
            } else {
                addModuleDependency(dependency);
            }
        }
    }
}
项目:xmvn    文件:XMvnInstallTask.java   
@TaskAction
protected void deployProject()
{
    Set<PublishArtifact> seenArtifacts = new HashSet<>();

    for ( SoftwareComponent component : getProject().getComponents() )
    {
        SoftwareComponentInternal internalComponent = (SoftwareComponentInternal) component;

        for ( UsageContext usage : internalComponent.getUsages() )
        {
            Set<? extends ModuleDependency> dependencies = usage.getDependencies();

            for ( PublishArtifact artifact : usage.getArtifacts() )
            {
                if ( seenArtifacts.add( artifact ) )
                {
                    deploy( artifact, dependencies );
                }
            }
        }
    }
}
项目:Pushjet-Android    文件:DefaultMavenPublication.java   
public void from(SoftwareComponent component) {
    if (this.component != null) {
        throw new InvalidUserDataException(String.format("Maven publication '%s' cannot include multiple components", name));
    }
    this.component = (SoftwareComponentInternal) component;

    for (Usage usage : this.component.getUsages()) {
        // TODO Need a smarter way to map usage to artifact classifier
        for (PublishArtifact publishArtifact : usage.getArtifacts()) {
            artifact(publishArtifact);
        }

        // TODO Need a smarter way to map usage to scope
        for (ModuleDependency dependency : usage.getDependencies()) {
            if (dependency instanceof ProjectDependency) {
                addProjectDependency((ProjectDependency) dependency);
            } else {
                addModuleDependency(dependency);
            }
        }
    }
}
项目:Pushjet-Android    文件:DefaultMavenPublication.java   
public void from(SoftwareComponent component) {
    if (this.component != null) {
        throw new InvalidUserDataException(String.format("Maven publication '%s' cannot include multiple components", name));
    }
    this.component = (SoftwareComponentInternal) component;

    for (Usage usage : this.component.getUsages()) {
        // TODO Need a smarter way to map usage to artifact classifier
        for (PublishArtifact publishArtifact : usage.getArtifacts()) {
            artifact(publishArtifact);
        }

        // TODO Need a smarter way to map usage to scope
        for (ModuleDependency dependency : usage.getDependencies()) {
            if (dependency instanceof ProjectDependency) {
                addProjectDependency((ProjectDependency) dependency);
            } else {
                addModuleDependency(dependency);
            }
        }
    }
}
项目:Reer    文件:MavenPluginPublishingRules.java   
@Mutate
public void addMainPublication(PublishingExtension publishing, GradlePluginDevelopmentExtension pluginDevelopment, ServiceRegistry services) {
    if (!pluginDevelopment.isAutomatedPublishing()) {
        return;
    }
    SoftwareComponentContainer componentContainer = services.get(SoftwareComponentContainer.class);
    SoftwareComponent component = componentContainer.getByName("java");

    PublicationContainer publications = publishing.getPublications();
    createMavenPluginPublication(component, publications);
}
项目:Reer    文件:IvyPluginPublishingRules.java   
@Mutate
public void addMainPublication(PublishingExtension publishing, GradlePluginDevelopmentExtension pluginDevelopment, ServiceRegistry services) {
    if (!pluginDevelopment.isAutomatedPublishing()) {
        return;
    }
    SoftwareComponentContainer componentContainer = services.get(SoftwareComponentContainer.class);
    SoftwareComponent component = componentContainer.getByName("java");

    PublicationContainer publications = publishing.getPublications();
    createIvyPluginPublication(component, publications);
}
项目:Reer    文件:DefaultIvyPublication.java   
public void from(SoftwareComponent component) {
    if (this.component != null) {
        throw new InvalidUserDataException(String.format("Ivy publication '%s' cannot include multiple components", name));
    }
    this.component = (SoftwareComponentInternal) component;

    configurations.maybeCreate("default");

    for (Usage usage : this.component.getUsages()) {
        String conf = usage.getName();
        configurations.maybeCreate(conf);
        configurations.getByName("default").extend(conf);

        for (PublishArtifact publishArtifact : usage.getArtifacts()) {
            artifact(publishArtifact).setConf(conf);
        }

        for (ModuleDependency dependency : usage.getDependencies()) {
            // TODO: When we support multiple components or configurable dependencies, we'll need to merge the confs of multiple dependencies with same id.
            String confMapping = String.format("%s->%s", conf, dependency.getTargetConfiguration() == null ? Dependency.DEFAULT_CONFIGURATION : dependency.getTargetConfiguration());
            if (dependency instanceof ProjectDependency) {
                addProjectDependency((ProjectDependency) dependency, confMapping);
            } else {
                addModuleDependency(dependency, confMapping);
            }
        }
    }
}
项目:Pushjet-Android    文件:DefaultIvyPublication.java   
public void from(SoftwareComponent component) {
    if (this.component != null) {
        throw new InvalidUserDataException(String.format("Ivy publication '%s' cannot include multiple components", name));
    }
    this.component = (SoftwareComponentInternal) component;

    configurations.maybeCreate("default");

    for (Usage usage : this.component.getUsages()) {
        String conf = usage.getName();
        configurations.maybeCreate(conf);
        configurations.getByName("default").extend(conf);

        for (PublishArtifact publishArtifact : usage.getArtifacts()) {
            artifact(publishArtifact).setConf(conf);
        }

        for (ModuleDependency dependency : usage.getDependencies()) {
            // TODO: When we support multiple components or configurable dependencies, we'll need to merge the confs of multiple dependencies with same id.
            String confMapping = String.format("%s->%s", conf, dependency.getConfiguration());
            if (dependency instanceof ProjectDependency) {
                addProjectDependency((ProjectDependency) dependency, confMapping);
            } else {
                addModuleDependency(dependency, confMapping);
            }
        }
    }
}
项目:Pushjet-Android    文件:DefaultIvyPublication.java   
public void from(SoftwareComponent component) {
    if (this.component != null) {
        throw new InvalidUserDataException(String.format("Ivy publication '%s' cannot include multiple components", name));
    }
    this.component = (SoftwareComponentInternal) component;

    configurations.maybeCreate("default");

    for (Usage usage : this.component.getUsages()) {
        String conf = usage.getName();
        configurations.maybeCreate(conf);
        configurations.getByName("default").extend(conf);

        for (PublishArtifact publishArtifact : usage.getArtifacts()) {
            artifact(publishArtifact).setConf(conf);
        }

        for (ModuleDependency dependency : usage.getDependencies()) {
            // TODO: When we support multiple components or configurable dependencies, we'll need to merge the confs of multiple dependencies with same id.
            String confMapping = String.format("%s->%s", conf, dependency.getConfiguration());
            if (dependency instanceof ProjectDependency) {
                addProjectDependency((ProjectDependency) dependency, confMapping);
            } else {
                addModuleDependency(dependency, confMapping);
            }
        }
    }
}
项目:Reer    文件:MavenPluginPublishingRules.java   
private void createMavenPluginPublication(SoftwareComponent component, PublicationContainer publications) {
    MavenPublication publication = publications.create("pluginMaven", MavenPublication.class);
    publication.from(component);
}
项目:Reer    文件:IvyPluginPublishingRules.java   
private void createIvyPluginPublication(SoftwareComponent component, PublicationContainer publications) {
    IvyPublication publication = publications.create("pluginIvy", IvyPublication.class);
    publication.from(component);
}
项目:gradle-plugins    文件:MavenPublishBasePlugin.java   
public SoftwareComponent getSoftwareComponent() {
    return getProject().getComponents().getByName(getComponentName());
}
项目:gradle-plugins    文件:MavenPublishBasePlugin.java   
public SoftwareComponent getSoftwareComponent() {
    return getProject().getComponents().getByName(getComponentName());
}
项目:Reer    文件:MavenPublication.java   
/**
 * Provides the software component that should be published.
 *
 * <ul>
 *     <li>Any artifacts declared by the component will be included in the publication.</li>
 *     <li>The dependencies declared by the component will be included in the published meta-data.</li>
 * </ul>
 *
 * Currently 2 types of component are supported: 'components.java' (added by the JavaPlugin) and 'components.web' (added by the WarPlugin).
 * For any individual MavenPublication, only a single component can be provided in this way.
 *
 * The following example demonstrates how to publish the 'java' component to a Maven repository.
 * <pre autoTested="true">
 * apply plugin: "java"
 * apply plugin: "maven-publish"
 *
 * publishing {
 *   publications {
 *     maven(MavenPublication) {
 *       from components.java
 *     }
 *   }
 * }
 * </pre>
 *
 * @param component The software component to publish.
 */
void from(SoftwareComponent component);
项目:Reer    文件:IvyPublication.java   
/**
 * Provides the software component that should be published.
 *
 * <ul>
 *     <li>Any artifacts declared by the component will be included in the publication.</li>
 *     <li>The dependencies declared by the component will be included in the published meta-data.</li>
 * </ul>
 *
 * Currently 2 types of component are supported: 'components.java' (added by the JavaPlugin) and 'components.web' (added by the WarPlugin).
 * For any individual IvyPublication, only a single component can be provided in this way.
 *
 * The following example demonstrates how to publish the 'java' component to a ivy repository.
 * <pre autoTested="true">
 * apply plugin: "java"
 * apply plugin: "ivy-publish"
 *
 * publishing {
 *   publications {
 *     ivy(IvyPublication) {
 *       from components.java
 *     }
 *   }
 * }
 * </pre>
 *
 * @param component The software component to publish.
 */
void from(SoftwareComponent component);
项目:Pushjet-Android    文件:MavenPublication.java   
/**
 * Provides the software component that should be published.
 *
 * <ul>
 *     <li>Any artifacts declared by the component will be included in the publication.</li>
 *     <li>The dependencies declared by the component will be included in the published meta-data.</li>
 * </ul>
 *
 * Currently 2 types of component are supported: 'components.java' (added by the JavaPlugin) and 'components.web' (added by the WarPlugin).
 * For any individual MavenPublication, only a single component can be provided in this way.
 *
 * The following example demonstrates how to publish the 'java' component to a Maven repository.
 * <pre autoTested="true">
 * apply plugin: "java"
 * apply plugin: "maven-publish"
 *
 * publishing {
 *   publications {
 *     maven(MavenPublication) {
 *       from components.java
 *     }
 *   }
 * }
 * </pre>
 *
 * @param component The software component to publish.
 */
void from(SoftwareComponent component);
项目:Pushjet-Android    文件:IvyPublication.java   
/**
 * Provides the software component that should be published.
 *
 * <ul>
 *     <li>Any artifacts declared by the component will be included in the publication.</li>
 *     <li>The dependencies declared by the component will be included in the published meta-data.</li>
 * </ul>
 *
 * Currently 2 types of component are supported: 'components.java' (added by the JavaPlugin) and 'components.web' (added by the WarPlugin).
 * For any individual IvyPublication, only a single component can be provided in this way.
 *
 * The following example demonstrates how to publish the 'java' component to a ivy repository.
 * <pre autoTested="true">
 * apply plugin: "java"
 * apply plugin: "ivy-publish"
 *
 * publishing {
 *   publications {
 *     ivy(IvyPublication) {
 *       from components.java
 *     }
 *   }
 * }
 * </pre>
 *
 * @param component The software component to publish.
 */
void from(SoftwareComponent component);
项目:Pushjet-Android    文件:MavenPublication.java   
/**
 * Provides the software component that should be published.
 *
 * <ul>
 *     <li>Any artifacts declared by the component will be included in the publication.</li>
 *     <li>The dependencies declared by the component will be included in the published meta-data.</li>
 * </ul>
 *
 * Currently 2 types of component are supported: 'components.java' (added by the JavaPlugin) and 'components.web' (added by the WarPlugin).
 * For any individual MavenPublication, only a single component can be provided in this way.
 *
 * The following example demonstrates how to publish the 'java' component to a Maven repository.
 * <pre autoTested="true">
 * apply plugin: "java"
 * apply plugin: "maven-publish"
 *
 * publishing {
 *   publications {
 *     maven(MavenPublication) {
 *       from components.java
 *     }
 *   }
 * }
 * </pre>
 *
 * @param component The software component to publish.
 */
void from(SoftwareComponent component);
项目:Pushjet-Android    文件:IvyPublication.java   
/**
 * Provides the software component that should be published.
 *
 * <ul>
 *     <li>Any artifacts declared by the component will be included in the publication.</li>
 *     <li>The dependencies declared by the component will be included in the published meta-data.</li>
 * </ul>
 *
 * Currently 2 types of component are supported: 'components.java' (added by the JavaPlugin) and 'components.web' (added by the WarPlugin).
 * For any individual IvyPublication, only a single component can be provided in this way.
 *
 * The following example demonstrates how to publish the 'java' component to a ivy repository.
 * <pre autoTested="true">
 * apply plugin: "java"
 * apply plugin: "ivy-publish"
 *
 * publishing {
 *   publications {
 *     ivy(IvyPublication) {
 *       from components.java
 *     }
 *   }
 * }
 * </pre>
 *
 * @param component The software component to publish.
 */
void from(SoftwareComponent component);