From df8b95e1243fab2ce3cfdfcee1975e5b5415ccb4 Mon Sep 17 00:00:00 2001 From: Nigel Jones Date: Mon, 6 Feb 2023 17:33:10 +0000 Subject: [PATCH] Fix #6992 Add SPDX checking for copyright/license (java) Signed-off-by: Nigel Jones --- build.gradle | 12 ++++++++++++ config/checkstyle/checkstyle.xml | 17 +++++++++++++++++ config/checkstyle/java.header | 2 ++ 3 files changed, 31 insertions(+) create mode 100644 config/checkstyle/checkstyle.xml create mode 100644 config/checkstyle/java.header diff --git a/build.gradle b/build.gradle index 138e9c7bc1e..21bf020d731 100644 --- a/build.gradle +++ b/build.gradle @@ -16,6 +16,7 @@ plugins { id 'dev.jacomet.logging-capabilities' version "0.11.0" // This plugin helps resolve jakarta/javax dev.jacomet.logging-capabilities id 'org.gradlex.java-ecosystem-capabilities' version "1.1" + id 'checkstyle' } @@ -29,6 +30,7 @@ allprojects { version = '4.0-SNAPSHOT' // Mostly java, so default to this for now + apply plugin: 'checkstyle' apply plugin: 'java' apply plugin: 'jacoco' apply plugin: 'org.gradlex.java-ecosystem-capabilities' @@ -423,6 +425,14 @@ allprojects { task printSubDependencies(type: DependencyReportTask) {} task findDependency(type: DependencyInsightReportTask) {} + // Checking of headers etc + checkstyle { + toolVersion = '10.7.0' + // Whilst initially adding, soft warnings only, as there are fixes needed + ignoreFailures = true + showViolations = true + } + } // end of allProjects // Whilst all modules have their own javadoc, we only build @@ -524,5 +534,7 @@ dependencyAnalysis { } } + + // Always run dependency check for every regular build build.dependsOn("buildHealth") diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml new file mode 100644 index 00000000000..d62486c64b5 --- /dev/null +++ b/config/checkstyle/checkstyle.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + diff --git a/config/checkstyle/java.header b/config/checkstyle/java.header new file mode 100644 index 00000000000..2ce66e092c2 --- /dev/null +++ b/config/checkstyle/java.header @@ -0,0 +1,2 @@ + ^/* SPDX-License-Identifier: Apache-2.0 */$ + ^/* Copyright Contributors to the ODPi Egeria project. */$