Search in sources :

Example 1 with ArtifactoryPluginConvention

use of org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention 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)

Example 2 with ArtifactoryPluginConvention

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

the class ArtifactoryPluginUtil method getResolverHandler.

public static ArtifactoryClientConfiguration.ResolverHandler getResolverHandler(Project project) {
    while (project != null) {
        ArtifactoryPluginConvention acc = project.getConvention().findPlugin(ArtifactoryPluginConvention.class);
        if (acc != null) {
            ArtifactoryClientConfiguration.ResolverHandler resolver = acc.getClientConfig().resolver;
            if (resolver.getContextUrl() != null && resolver.getRepoKey() != null) {
                return resolver;
            }
        }
        project = project.getParent();
    }
    return null;
}
Also used : ArtifactoryClientConfiguration(org.jfrog.build.extractor.clientConfiguration.ArtifactoryClientConfiguration) ArtifactoryPluginConvention(org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention)

Example 3 with ArtifactoryPluginConvention

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

the class ArtifactoryPluginUtil method getPublisherConvention.

public static ArtifactoryPluginConvention getPublisherConvention(Project project) {
    while (project != null) {
        ArtifactoryPluginConvention acc = project.getConvention().findPlugin(ArtifactoryPluginConvention.class);
        if (acc != null) {
            ArtifactoryClientConfiguration.PublisherHandler publisher = acc.getClientConfig().publisher;
            if (publisher.getContextUrl() != null && publisher.getRepoKey() != null) {
                return acc;
            }
        }
        project = project.getParent();
    }
    return null;
}
Also used : ArtifactoryClientConfiguration(org.jfrog.build.extractor.clientConfiguration.ArtifactoryClientConfiguration) ArtifactoryPluginConvention(org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention)

Aggregations

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