diff --git a/build.gradle b/build.gradle index 0c6012f76a7d..49997a5332ae 100755 --- a/build.gradle +++ b/build.gradle @@ -24,13 +24,18 @@ buildscript { } dependencies { - classpath "org.ajoberstar:gradle-git:1.3.2" + // Newer versions of the nebula plugins require gradle-info-plugin 4.0.2 or higher, which in + // depends on JGit 5.0. Conversely, gradle-git relies of JGit 4.0. + // Be mindful of potential classpath issues when updating any of these three dependencies. + classpath "com.netflix.nebula:nebula-project-plugin:5.1.0" + classpath "com.netflix.nebula:gradle-lint-plugin:10.1.0" + classpath "org.ajoberstar:gradle-git:1.7.2" + classpath "gradle.plugin.org.nosphere.apache:creadur-rat-gradle:0.3.1" classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.2' classpath "com.diffplug.spotless:spotless-plugin-gradle:3.10.0" classpath "me.champeau.gradle:jmh-gradle-plugin:0.4.7" classpath 'com.github.ben-manes:gradle-versions-plugin:0.17.0' - classpath "com.netflix.nebula:nebula-project-plugin:4.0.1" } } @@ -75,6 +80,7 @@ apply from: "${scriptDir}/sonar.gradle" apply from: "${scriptDir}/rat.gradle" apply from: "${scriptDir}/docker.gradle" apply from: "${scriptDir}/spotless.gradle" +apply from: "${scriptDir}/lint.gradle" apply from: "${scriptDir}/resolve-dependencies.gradle" subprojects { @@ -99,9 +105,9 @@ ext.readScmInfo = { proj -> def git = org.ajoberstar.grgit.Grgit.open(currentDir: project(proj).projectDir) try { return [ - 'Source-Repository': git.branch.getCurrent().name, + 'Source-Repository': git.branch.current.name, 'Source-Revision' : git.head().id, - 'Source-Date' : git.head().getDate().format('yyyy-MM-dd HH:mm:ss Z') + 'Source-Date' : git.head().date.format('yyyy-MM-dd HH:mm:ss Z') ] as Properties } finally { git.close() diff --git a/gradle/lint.gradle b/gradle/lint.gradle new file mode 100644 index 000000000000..9d91f5ad2ca2 --- /dev/null +++ b/gradle/lint.gradle @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +allprojects { + apply plugin: 'nebula.lint' + gradleLint.rules = [] + gradleLint.rules += 'overridden-dependency-version' + gradleLint.rules += 'unused-dependency' + gradleLint.rules += 'unused-exclude-by-dep' + gradleLint.rules += 'unused-exclude-by-conf' + + gradleLint.alwaysRun = false + fixGradleLint.mustRunAfter(':combineReports') + lintGradle.mustRunAfter(':combineReports') +}