Skip to content

Commit

Permalink
GEODE-5883: Add Nebula dependency linter as gradle utility (apache#2939)
Browse files Browse the repository at this point in the history
* Introduce Nebula lint plugin, version 10.1.0
* Update Nebula project plugin version 4.0.1 -> 5.1.0
* Update gradle-git plugin version 1.3.2 -> 1.7.2

* The lint plugin is intentionally not yet run as part of the project :check.
Early introduction will be required by some subprojects,
so that they may reference the plugin configuration.
  • Loading branch information
PurelyApplied authored Dec 6, 2018
1 parent 8ba2b34 commit 3611f1b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 4 deletions.
14 changes: 10 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}

Expand Down Expand Up @@ -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 {
Expand All @@ -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()
Expand Down
29 changes: 29 additions & 0 deletions gradle/lint.gradle
Original file line number Diff line number Diff line change
@@ -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')
}

0 comments on commit 3611f1b

Please sign in to comment.