Generating checksums on upload?

Given the new support for not downloading duplicate artifacts based on SHA1 sums, I expected Gradle to automatically produce .sha1 files for everything it uploaded to a repository - but it doesn’t. Is there an option I’m missing to cause Gradle to produce the .sha1 files?

This is GRADLE-2145 : we’ll try our best to get this fixed for 1.0.

Figured out a workaround for this. 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
    }
  }

Does Gradle provide for creating sha1 files for artifacts handled by uploadArchives?

This reply was created from a merged topic originally titled Auto-Generated SHA1 files?.