Search in sources :

Example 6 with IncludeExcludePatterns

use of org.jfrog.build.extractor.clientConfiguration.IncludeExcludePatterns in project build-info by JFrogDev.

the class GradleBuildInfoExtractor method extractModule.

public Module extractModule(Project project) {
    String artifactName = project.getName();
    ArtifactoryTask task = getBuildInfoTask(project);
    if (task != null) {
        artifactName = project.getName();
    }
    ModuleBuilder builder = new ModuleBuilder().id(getModuleIdString(project.getGroup().toString(), artifactName, project.getVersion().toString()));
    try {
        ArtifactoryClientConfiguration.PublisherHandler publisher = ArtifactoryPluginUtil.getPublisherHandler(project);
        if (publisher != null) {
            boolean excludeArtifactsFromBuild = publisher.isFilterExcludedArtifactsFromBuild();
            IncludeExcludePatterns patterns = new IncludeExcludePatterns(publisher.getIncludePatterns(), publisher.getExcludePatterns());
            Iterable<GradleDeployDetails> deployExcludeDetails = null;
            Iterable<GradleDeployDetails> deployIncludeDetails = null;
            if (excludeArtifactsFromBuild) {
                deployIncludeDetails = Iterables.filter(gradleDeployDetails, new IncludeExcludePredicate(project, patterns, true));
                deployExcludeDetails = Iterables.filter(gradleDeployDetails, new IncludeExcludePredicate(project, patterns, false));
            } else {
                deployIncludeDetails = Iterables.filter(gradleDeployDetails, new ProjectPredicate(project));
                deployExcludeDetails = new ArrayList<GradleDeployDetails>();
            }
            builder.artifacts(calculateArtifacts(deployIncludeDetails)).excludedArtifacts(calculateArtifacts(deployExcludeDetails)).dependencies(calculateDependencies(project));
        } else {
            log.warn("No publisher config found for project: " + project.getName());
        }
    } catch (Exception e) {
        log.error("Error during extraction: ", e);
    }
    return builder.build();
}
Also used : ArtifactoryClientConfiguration(org.jfrog.build.extractor.clientConfiguration.ArtifactoryClientConfiguration) IncludeExcludePatterns(org.jfrog.build.extractor.clientConfiguration.IncludeExcludePatterns) BuildInfoExtractorUtils.getModuleIdString(org.jfrog.build.extractor.BuildInfoExtractorUtils.getModuleIdString) BuildInfoExtractorUtils.getTypeString(org.jfrog.build.extractor.BuildInfoExtractorUtils.getTypeString) ParseException(java.text.ParseException) ArtifactoryTask(org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask)

Aggregations

IncludeExcludePatterns (org.jfrog.build.extractor.clientConfiguration.IncludeExcludePatterns)6 ArtifactoryClientConfiguration (org.jfrog.build.extractor.clientConfiguration.ArtifactoryClientConfiguration)5 BuildInfoExtractorUtils.getModuleIdString (org.jfrog.build.extractor.BuildInfoExtractorUtils.getModuleIdString)3 BuildInfoExtractorUtils.getTypeString (org.jfrog.build.extractor.BuildInfoExtractorUtils.getTypeString)3 File (java.io.File)2 IOException (java.io.IOException)2 ArtifactBuilder (org.jfrog.build.api.builder.ArtifactBuilder)2 DeployDetails (org.jfrog.build.client.DeployDetails)2 ArtifactoryBuildInfoClient (org.jfrog.build.extractor.clientConfiguration.client.ArtifactoryBuildInfoClient)2 ParseException (java.text.ParseException)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Properties (java.util.Properties)1 EndArtifactPublishEvent (org.apache.ivy.core.event.publish.EndArtifactPublishEvent)1 PublishEvent (org.apache.ivy.core.event.publish.PublishEvent)1 ModuleRevisionId (org.apache.ivy.core.module.id.ModuleRevisionId)1 Artifact (org.apache.maven.artifact.Artifact)1 DefaultArtifact (org.apache.maven.artifact.DefaultArtifact)1 Project (org.apache.tools.ant.Project)1 Artifact (org.jfrog.build.api.Artifact)1