diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/DependencyLicensesTask.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/DependencyLicensesTask.groovy index 0f6a6f006a0..e2f10100269 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/DependencyLicensesTask.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/DependencyLicensesTask.groovy @@ -69,7 +69,7 @@ import java.util.regex.Pattern * */ public class DependencyLicensesTask extends DefaultTask { - private static final String SHA_EXTENSION = '.sha1' + static final String SHA_EXTENSION = '.sha1' // TODO: we should be able to default this to eg compile deps, but we need to move the licenses // check from distribution to core (ie this should only be run on java projects) diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/UpdateShasTask.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/UpdateShasTask.groovy index d0c73e6ad76..4a174688aa1 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/UpdateShasTask.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/UpdateShasTask.groovy @@ -35,6 +35,7 @@ public class UpdateShasTask extends DefaultTask { public UpdateShasTask() { description = 'Updates the sha files for the dependencyLicenses check' + onlyIf { parentTask.licensesDir.exists() } } @TaskAction @@ -42,13 +43,13 @@ public class UpdateShasTask extends DefaultTask { Set shaFiles = new HashSet() parentTask.licensesDir.eachFile { String name = it.getName() - if (name.endsWith(SHA_EXTENSION)) { + if (name.endsWith(DependencyLicensesTask.SHA_EXTENSION)) { shaFiles.add(it) } } for (File dependency : parentTask.dependencies) { String jarName = dependency.getName() - File shaFile = new File(parentTask.licensesDir, jarName + SHA_EXTENSION) + File shaFile = new File(parentTask.licensesDir, jarName + DependencyLicensesTask.SHA_EXTENSION) if (shaFile.exists() == false) { logger.lifecycle("Adding sha for ${jarName}") String sha = MessageDigest.getInstance("SHA-1").digest(dependency.getBytes()).encodeHex().toString()