From bab9c1d1110a1472675f06ed5e13e8154dcb462d Mon Sep 17 00:00:00 2001 From: Fabio Di Fabio Date: Thu, 24 Aug 2023 15:52:33 +0200 Subject: [PATCH] Make checkSpdxHeader task cross platform (#5794) Signed-off-by: Fabio Di Fabio --- build.gradle | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index 5a24037154f..05f32e6c2e6 100644 --- a/build.gradle +++ b/build.gradle @@ -18,6 +18,7 @@ import groovy.transform.Memoized import net.ltgt.gradle.errorprone.CheckSeverity import java.text.SimpleDateFormat +import java.util.regex.Pattern plugins { id 'com.diffplug.spotless' version '6.12.0' @@ -900,6 +901,8 @@ task manifestDockerRelease { } } +def sep = Pattern.quote(File.separator) + task checkSpdxHeader(type: CheckSpdxHeader) { apply plugin: 'groovy' @@ -907,16 +910,16 @@ task checkSpdxHeader(type: CheckSpdxHeader) { spdxHeader = "* SPDX-License-Identifier: Apache-2.0" filesRegex = "(.*.java)|(.*.groovy)" excludeRegex = [ - "(.*/generalstate/GeneralStateRegressionReferenceTest.*)", - "(.*/generalstate/GeneralStateReferenceTest.*)", - "(.*/generalstate/LegacyGeneralStateReferenceTest.*)", - "(.*/blockchain/BlockchainReferenceTest.*)", - "(.*/blockchain/LegacyBlockchainReferenceTest.*)", - "(.*/.gradle/.*)", - "(.*/.idea/.*)", - "(.*/out/.*)", - "(.*/build/.*)", - "(.*/src/[^/]+/generated/.*)" + "(.*${sep}generalstate${sep}GeneralStateRegressionReferenceTest.*)", + "(.*${sep}generalstate${sep}GeneralStateReferenceTest.*)", + "(.*${sep}generalstate${sep}LegacyGeneralStateReferenceTest.*)", + "(.*${sep}blockchain${sep}BlockchainReferenceTest.*)", + "(.*${sep}blockchain${sep}LegacyBlockchainReferenceTest.*)", + "(.*${sep}.gradle${sep}.*)", + "(.*${sep}.idea${sep}.*)", + "(.*${sep}out${sep}.*)", + "(.*${sep}build${sep}.*)", + "(.*${sep}src${sep}[^${sep}]+${sep}generated${sep}.*)" ].join("|") }