Coder Social home page Coder Social logo

gradle-checksum's Introduction

gradle-checksum

A Gradle plugin for creating checksums for files in your build.

Requirements

  • Version 1.4.0 requires Gradle 5.4 or above
  • Version 1.3.0 requires Gradle 5.0 or above

Usage

plugins {
    id 'org.gradle.crypto.checksum' version '1.4.0'
}

import org.gradle.crypto.checksum.Checksum

task generateFiles {
  // Generates some files.
}

task createChecksums(type: Checksum, dependsOn: 'generateFiles') {
  inputFiles.setFrom(generateFiles.outputs.files)
  outputDirectory.set(layout.buildDirectory.dir("foo/checksums"))
  checksumAlgorithm.set(Checksum.Algorithm.SHA512)
  appendFileNameToChecksum.set(true)
}

When the createChecksums task is finished, there will be a file ending in .sha512 for each of the files output by the generateFiles task.

Currently, only SHA256 (default), SHA384, SHA512, and MD5 are supported. Please file an issue or make a pull request if you need support for some other hashing algorithm.

If you want to append the filename to the checksum value, set appendFileNameToChecksum to true (false by default). This makes it easier to automate the checksum verification with the md5sum, sha256sum, sha384sum or sha512sum tools:

> sha512sum -c ../build/checksums/foo.txt.sha512
foo.txt: OK

By default, the outputDirectory will be set to project.buildDir + "checksums".

The task is incremental at the file level, and will only alter files in the output directory which end with file extensions managed by this task (e.g. .sha256 or .sha512). However, for optimal caching of other tasks it is still advisable to try and use independent output directories for each task in your build.

gradle-checksum's People

Contributors

bamboo avatar jprinet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gradle-checksum's Issues

Checksum Summary Files

First of all, thank you so much for this plugin, it is already saving me a lot of effort. I was hoping though that the plugin could be extended to produce a checksum summary file similar to how the checksum-maven-plugin does (see here).

To give some background on my use case, I am on a project that has these checksum summary files/reports as a part of our process; checksums for .java, .class and .js are included in the report. In the past we've used the checksum-maven-plugin to accomplish this step, but we'd like to move away from maven and have a holistic Gradle build, without having to reimplement this process in our code. Having this as a part of Gradle is good for controllability/predictability of the process.

I am happy to help contribute to this solution if it is a feasible enhancement to the plugin. I wanted to get feedback before I started on anything.

Example of Generate Files

task generateFiles {
// Generates some files.
}

Can you please provide an example on what will be in Generate Files task ?

Plugin should not delete all files that have a checksum extension

So this is my use case. I'm using the distribution plugin and outputting a tar file and a zip file in the standard "distributions" directory.

Then I have 2 tasks to generate a checksum for these 2 distributions. The problem here is that one deletes the other
This is happening at Checksum.java#L98

Is this the intended behavior? Should we be deleting all files that have any checksum extension? Should we not instead delete all files named .?

Feature: One checksum for all input files

Dear gradle team,

would it be feasible to implement a feature/flag that allows to create just one checksum for all input files instead of creating a checksum for each file?
This would avoid a workaround that we currently use where we zip all files first and create a checksum of that zip.

Let me know your opinion on this one. Do you think it would also be useful for others?

Cheers,
Hans

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.