mirror of https://github.com/apache/lucene.git
LUCENE-9382: update gradle to 6.4.1. (#1549)
* LUCENE-9382: update gradle to 6.4.1. Requires minor changes around log call validation by restructuring the code around switches to a series of ifs. Piggybacking: apply log validation to :solr modules. Add inputs declaration so that task is not re-run on unmodified files.
This commit is contained in:
parent
502f62cc9c
commit
3e8e5d8cf6
|
@ -22,7 +22,7 @@ import org.gradle.util.GradleVersion
|
|||
|
||||
configure(rootProject) {
|
||||
ext {
|
||||
expectedGradleVersion = '6.0.1'
|
||||
expectedGradleVersion = '6.4.1'
|
||||
minJavaVersion = JavaVersion.VERSION_11
|
||||
}
|
||||
|
||||
|
|
|
@ -34,11 +34,13 @@ import org.apache.tools.ant.BuildException
|
|||
|
||||
// See the associated help task "gradlew helpValidateLogCalls"
|
||||
|
||||
allprojects {
|
||||
configure(subprojects.findAll { it.path.startsWith(':solr') }) {
|
||||
plugins.withType(JavaPlugin) {
|
||||
task validateLogCalls(type: ValidateLogCallsTask) {
|
||||
description "Checks that log calls are either validated or conform to efficient patterns."
|
||||
group "verification"
|
||||
|
||||
sourceFiles = files(sourceSets*.java)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,6 +55,7 @@ class ValidateLogCallsTask extends DefaultTask {
|
|||
violations.add(System.lineSeparator + msg);
|
||||
errsFound++;
|
||||
}
|
||||
|
||||
// We have a log.something line, check for patterns we're not fond of.
|
||||
def checkLine(File file, String line, int lineNumber, String previous) {
|
||||
boolean violation = false
|
||||
|
@ -204,31 +207,35 @@ class ValidateLogCallsTask extends DefaultTask {
|
|||
reportViolation("Bad state, should be 0-1 in the switch statement") // make people aware the code sucks
|
||||
break
|
||||
}
|
||||
switch (state) { // It's just easier to do this here rather than read another line in the switch above.
|
||||
case 0: // Not collcting a log line
|
||||
|
||||
// It's just easier to do this here rather than read another line in the switch above.
|
||||
if (state == 0) {
|
||||
// Not collecting a log line
|
||||
prevLine = line.toLowerCase();
|
||||
break;
|
||||
case 1: // collecting a logging line.
|
||||
break;
|
||||
case 2: // We've collected the complete log line.
|
||||
} else if (state == 1) {
|
||||
// collecting a logging line.
|
||||
} else if (state == 2) {
|
||||
// We've collected the complete log line.
|
||||
checkLine(file, sb.toString(), lineNumber, prevLine)
|
||||
state = 0
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
} else {
|
||||
assert false
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@InputFiles
|
||||
FileCollection sourceFiles
|
||||
|
||||
ValidateLogCallsTask() {
|
||||
// No explicit outputs (outputs always up to date).
|
||||
outputs.upToDateWhen { true }
|
||||
}
|
||||
|
||||
@TaskAction
|
||||
def checkLogLines() {
|
||||
|
||||
project.sourceSets.each { srcSet ->
|
||||
srcSet.java.each { f ->
|
||||
checkFile(f)
|
||||
}
|
||||
}
|
||||
sourceFiles.each { checkFile(it) }
|
||||
logger.warn("Checked: ${sourceFiles.files.size()}")
|
||||
|
||||
if (errsFound > 0) {
|
||||
throw new BuildException(String.format(Locale.ENGLISH, 'Found %d violations in source files (%s).',
|
||||
|
|
Binary file not shown.
|
@ -1 +1 @@
|
|||
28b330c20a9a73881dfe9702df78d4d78bf72368e8906c70080ab6932462fe9e
|
||||
70239e6ca1f0d5e3b2808ef6d82390cf9ad58d3a3a0d271677a51d1b89475857
|
|
@ -1 +1 @@
|
|||
6.0.1
|
||||
6.4.1
|
|
@ -1,5 +1,5 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-all.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
|
Loading…
Reference in New Issue