From 4dc08d40a596082a341c07a4c930e5b32c50a31a Mon Sep 17 00:00:00 2001 From: Usman Saleem Date: Wed, 1 May 2024 08:56:56 +1000 Subject: [PATCH] build - Preparing spotless license header option and adding license templates (#7015) Preparing spotless license header option and adding license templates Signed-off-by: Usman Saleem --- build.gradle | 6 ++++++ .../exception/UnsupportedForkException.java | 1 - gradle/spotless/java.current.license | 14 ++++++++++++++ gradle/spotless/java.former.date.license | 14 ++++++++++++++ gradle/spotless/java.former.license | 14 ++++++++++++++ 5 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 gradle/spotless/java.current.license create mode 100644 gradle/spotless/java.former.date.license create mode 100644 gradle/spotless/java.former.license diff --git a/build.gradle b/build.gradle index 31eec61f21..3e408573d6 100644 --- a/build.gradle +++ b/build.gradle @@ -207,6 +207,12 @@ allprojects { importOrder 'org.hyperledger', 'java', '' trimTrailingWhitespace() endWithNewline() + // apply appropriate license header files. + // TODO: Remove checkSpdxLicense task and buildSrc when all files are formatted and updated via multiple PRs + // TODO: Uncomment following when all files are formatted and updated via multiple PRs + // licenseHeaderFile("${rootDir}/gradle/spotless/java.former.license").named("older").onlyIfContentMatches("^/\\*\\r?\\n.*Copyright ConsenSys AG\\.") + licenseHeaderFile("${rootDir}/gradle/spotless/java.former.date.license").named("older.year").onlyIfContentMatches("^/\\*\\r?\\n.* Copyright \\d{4} ConsenSys AG\\.") + // licenseHeaderFile("${rootDir}/gradle/spotless/java.current.license").named("current").onlyIfContentMatches("^(?!/\\*\\r?\\n \\*.*ConsenSys AG\\.)") } groovyGradle { target '*.gradle' diff --git a/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/exception/UnsupportedForkException.java b/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/exception/UnsupportedForkException.java index 284fe89090..9620968985 100644 --- a/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/exception/UnsupportedForkException.java +++ b/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/exception/UnsupportedForkException.java @@ -11,7 +11,6 @@ * specific language governing permissions and limitations under the License. * * SPDX-License-Identifier: Apache-2.0 - * */ package org.hyperledger.besu.evmtool.exception; diff --git a/gradle/spotless/java.current.license b/gradle/spotless/java.current.license new file mode 100644 index 0000000000..fb92e548e2 --- /dev/null +++ b/gradle/spotless/java.current.license @@ -0,0 +1,14 @@ +/* + * Copyright contributors to Hyperledger Besu. + * + * Licensed 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. + * + * SPDX-License-Identifier: Apache-2.0 + */ \ No newline at end of file diff --git a/gradle/spotless/java.former.date.license b/gradle/spotless/java.former.date.license new file mode 100644 index 0000000000..cc53a42a8c --- /dev/null +++ b/gradle/spotless/java.former.date.license @@ -0,0 +1,14 @@ +/* + * Copyright $YEAR ConsenSys AG. + * + * Licensed 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. + * + * SPDX-License-Identifier: Apache-2.0 + */ \ No newline at end of file diff --git a/gradle/spotless/java.former.license b/gradle/spotless/java.former.license new file mode 100644 index 0000000000..c936fcf470 --- /dev/null +++ b/gradle/spotless/java.former.license @@ -0,0 +1,14 @@ +/* + * Copyright ConsenSys AG. + * + * Licensed 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. + * + * SPDX-License-Identifier: Apache-2.0 + */ \ No newline at end of file