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();
}
Aggregations