Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOLR-14301: Remove external commons-codec usage in gradle validateJarChecksums #2309

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 4 additions & 13 deletions gradle/validation/jar-checks.gradle
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