Does Gradle provide for creating sha1 files for artifacts handled by uploadArchives?
Apparently gradle does not yet do this for you as evident by this thread here:
http://forums.gradle.org/gradle/topics/generating_checksums_on_upload
I figured out a workaround, though, for the interim. Hope this helps somebody:
project.task("checkSums") << {
List<CheckSum> checksums = []
project.configurations.getByName("archives").artifacts.each { artifact ->
project.ant.checksum(file: artifact.file, algorithm: "sha1", todir: "$project.buildDir/libs")
project.ant.checksum(file: artifact.file, algorithm: "md5", todir: "$project.buildDir/libs")
checksums.add(new CheckSum(artifact.name, "${artifact.extension}.sha1", artifact.type, new File("$project.buildDir/libs/${artifact.file.name}.sha1")))
checksums.add(new CheckSum(artifact.name, "${artifact.extension}.md5", artifact.type, new File("$project.buildDir/libs/${artifact.file.name}.md5")))
}
checksums.each { checksum ->
project.artifacts.add("archives", checksum)
}
}
class CheckSum implements PublishArtifact {
String name;
String extension;
String type;
File file;
CheckSum(String name, String extension, String type, File file) {
this.name = name
this.extension = extension
this.type = type
this.file = file
}
@Override
String getName() {
return name
}
@Override
String getExtension() {
return extension
}
@Override
String getType() {
return type
}
@Override
String getClassifier() {
return null
}
@Override
File getFile() {
return file
}
@Override
Date getDate() {
return new Date()
}
@Override
TaskDependency getBuildDependencies() {
return null
}
}