private DeployDetails.Builder createBuilder(Set<String> processedFiles, File file, String publicationName) {
if (processedFiles.contains(file.getAbsolutePath())) {
return null;
}
if (!file.exists()) {
throw new GradleException("File '" + file.getAbsolutePath() + "'" +
" does not exists, and need to be published from publication " + publicationName);
}
processedFiles.add(file.getAbsolutePath());
DeployDetails.Builder artifactBuilder = new DeployDetails.Builder().file(file);
try {
Map<String, String> checksums =
FileChecksumCalculator.calculateChecksums(file, "MD5", "SHA1");
artifactBuilder.md5(checksums.get("MD5")).sha1(checksums.get("SHA1"));
} catch (Exception e) {
throw new GradleException(
"Failed to calculate checksums for artifact: " + file.getAbsolutePath(), e);
}
return artifactBuilder;
}