bit.collectDescriptorsAndArtifactsForUpload();
allDeployDetails.addAll(bit.deployDetails);
}
}
ArtifactoryBuildInfoClient client =
new ArtifactoryBuildInfoClient(contextUrl, username, password, new GradleClientLogger(log));
try {
if (isPublishArtifacts(acc)) {
log.debug("Uploading artifacts to Artifactory at '{}'", contextUrl);
/**
* if the {@link org.jfrog.build.client.ClientProperties#PROP_PUBLISH_ARTIFACT} is set the true,
* The uploadArchives task will be triggered ONLY at the end, ensuring that the artifacts will be
* published only after a successful build. This is done before the build-info is sent.
*/
IncludeExcludePatterns patterns = new IncludeExcludePatterns(
acc.publisher.getIncludePatterns(),
acc.publisher.getExcludePatterns());
configureProxy(acc, client);
deployArtifacts(allDeployDetails, client, patterns);
}
//Extract build info and update the clientConf info accordingly (build name, num, etc.)
GradleBuildInfoExtractor gbie = new GradleBuildInfoExtractor(acc, allDeployDetails);
Build build = gbie.extract(getProject().getRootProject());
/**
* The build-info will be always written to a file in its JSON form.
*/
exportBuildInfo(build, getExportFile(acc));
if (isPublishBuildInfo(acc)) {
log.debug("Publishing build info to artifactory at: '{}'", contextUrl);
/**
* After all the artifacts were uploaded successfully the next task is to send the build-info
* object.
*/
// If export property set always save the file before sending it to artifactory
exportBuildInfo(build, getExportFile(acc));
client.sendBuildInfo(build);
}
} finally {
client.shutdown();
}
}