Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions gradle/validation/jar-checks.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,12 @@
// 2) notice file
// 3) checksum validation/ generation.

import org.apache.commons.codec.digest.DigestUtils
import java.nio.file.Files
import java.security.MessageDigest

// This should be false only for debugging.
def failOnError = true

// We're using commons-codec for computing checksums.
buildscript {
repositories {
mavenCentral()
}

dependencies {
classpath "commons-codec:commons-codec:${scriptDepVersions['commons-codec']}"
}
}

// Configure license checksum folder for top-level projects.
// (The file("licenses") inside the configure scope resolves
// relative to the current project so they're not the same).
Expand Down Expand Up @@ -151,7 +141,8 @@ subprojects {
jarName : file.toPath().getFileName().toString(),
path : file,
module : resolvedArtifact.moduleVersion,
checksum : provider { new DigestUtils(DigestUtils.sha1Digest).digestAsHex(file).trim() },
checksum : provider { String.format("%040x", new BigInteger(1 ,MessageDigest.getInstance("SHA-1").digest(Files.readAllBytes(file.toPath())))) },

// We keep track of the files referenced by this dependency (sha, license, notice, etc.)
// so that we can determine unused dangling files later on.
referencedFiles: []
Expand Down