Search in sources :

Example 1 with PublisherConfig

use of org.jfrog.gradle.plugin.artifactory.dsl.PublisherConfig in project build-info by JFrogDev.

the class ArtifactoryTask method projectEvaluated.

public void projectEvaluated() {
    Project project = getProject();
    if (isSkip()) {
        log.debug("artifactoryPublish task '{}' skipped for project '{}'.", this.getPath(), project.getName());
    } else {
        ArtifactoryPluginConvention convention = ArtifactoryPluginUtil.getPublisherConvention(project);
        if (convention != null) {
            ArtifactoryClientConfiguration acc = convention.getClientConfig();
            artifactSpecs.clear();
            artifactSpecs.addAll(acc.publisher.getArtifactSpecs());
            // Configure the task using the "defaults" closure (delegate to the task)
            PublisherConfig config = convention.getPublisherConfig();
            if (config != null) {
                Closure defaultsClosure = config.getDefaultsClosure();
                ConfigureUtil.configure(defaultsClosure, this);
            }
        }
        Task deployTask = project.getRootProject().getTasks().findByName(DEPLOY_TASK_NAME);
        if (deployTask == null) {
            throw new IllegalStateException(String.format("Could not find %s in the root project", DEPLOY_TASK_NAME));
        }
        finalizedBy(deployTask);
        // Depend on buildInfo task in sub-projects
        for (Project sub : project.getSubprojects()) {
            Task subArtifactoryTask = sub.getTasks().findByName(ARTIFACTORY_PUBLISH_TASK_NAME);
            if (subArtifactoryTask != null) {
                dependsOn(subArtifactoryTask);
            }
        }
        checkDependsOnArtifactsToPublish();
    }
}
Also used : ArtifactoryClientConfiguration(org.jfrog.build.extractor.clientConfiguration.ArtifactoryClientConfiguration) Project(org.gradle.api.Project) Task(org.gradle.api.Task) DefaultTask(org.gradle.api.DefaultTask) Closure(groovy.lang.Closure) ArtifactoryPluginConvention(org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention) PublisherConfig(org.jfrog.gradle.plugin.artifactory.dsl.PublisherConfig)

Aggregations

Closure (groovy.lang.Closure)1 DefaultTask (org.gradle.api.DefaultTask)1 Project (org.gradle.api.Project)1 Task (org.gradle.api.Task)1 ArtifactoryClientConfiguration (org.jfrog.build.extractor.clientConfiguration.ArtifactoryClientConfiguration)1 ArtifactoryPluginConvention (org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention)1 PublisherConfig (org.jfrog.gradle.plugin.artifactory.dsl.PublisherConfig)1