You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by da...@apache.org on 2022/04/21 10:04:53 UTC

[flink-training] 02/03: [FLINK-27322][gradle] add spotless license header checks for *.md, *.gradle, and Java files

This is an automated email from the ASF dual-hosted git repository.

danderson pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink-training.git

commit bc18cea87ef713fb8e103751c588b0703b08ee22
Author: Nico Kruber <ni...@ververica.com>
AuthorDate: Wed Apr 20 12:24:39 2022 +0200

    [FLINK-27322][gradle] add spotless license header checks for *.md, *.gradle, and Java files
---
 build.gradle | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 63 insertions(+), 2 deletions(-)

diff --git a/build.gradle b/build.gradle
index 8df5493..aea9c9f 100644
--- a/build.gradle
+++ b/build.gradle
@@ -30,14 +30,57 @@ allprojects {
 
     spotless {
         format 'misc', {
-            // define the files to apply `misc` to
             target '*.gradle', '*.md', '.gitignore'
 
-            // define the steps to apply to those files
             trimTrailingWhitespace()
             indentWithSpaces(4)
             endWithNewline()
         }
+
+        format 'markdown', {
+            target '*.md'
+
+            licenseHeader '<!--\n' +
+                    'Licensed to the Apache Software Foundation (ASF) under one\n' +
+                    'or more contributor license agreements.  See the NOTICE file\n' +
+                    'distributed with this work for additional information\n' +
+                    'regarding copyright ownership.  The ASF licenses this file\n' +
+                    'to you under the Apache License, Version 2.0 (the\n' +
+                    '"License"); you may not use this file except in compliance\n' +
+                    'with the License.  You may obtain a copy of the License at\n' +
+                    '\n' +
+                    '  http://www.apache.org/licenses/LICENSE-2.0\n' +
+                    '\n' +
+                    'Unless required by applicable law or agreed to in writing,\n' +
+                    'software distributed under the License is distributed on an\n' +
+                    '"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n' +
+                    'KIND, either express or implied.  See the License for the\n' +
+                    'specific language governing permissions and limitations\n' +
+                    'under the License.\n' +
+                    '-->\n\n', '# '
+
+        }
+
+        format 'gradle', {
+            target '*.gradle'
+
+            licenseHeader '/*\n' +
+                    ' * Licensed to the Apache Software Foundation (ASF) under one or more\n' +
+                    ' * contributor license agreements.  See the NOTICE file distributed with\n' +
+                    ' * this work for additional information regarding copyright ownership.\n' +
+                    ' * The ASF licenses this file to You under the Apache License, Version 2.0\n' +
+                    ' * (the "License"); you may not use this file except in compliance with\n' +
+                    ' * the License.  You may obtain a copy of the License at\n' +
+                    ' *\n' +
+                    ' *      http://www.apache.org/licenses/LICENSE-2.0\n' +
+                    ' *\n' +
+                    ' * Unless required by applicable law or agreed to in writing, software\n' +
+                    ' * distributed under the License is distributed on an "AS IS" BASIS,\n' +
+                    ' * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n' +
+                    ' * See the License for the specific language governing permissions and\n' +
+                    ' * limitations under the License.\n' +
+                    ' */\n\n', '(.*\\{)|(.* = .*)|(apply plugin:)'
+        }
     }
 }
 
@@ -138,6 +181,24 @@ subprojects {
             removeUnusedImports()
 
             targetExclude("**/generated*/*.java")
+
+            licenseHeader '/*\n' +
+                    ' * Licensed to the Apache Software Foundation (ASF) under one\n' +
+                    ' * or more contributor license agreements.  See the NOTICE file\n' +
+                    ' * distributed with this work for additional information\n' +
+                    ' * regarding copyright ownership.  The ASF licenses this file\n' +
+                    ' * to you under the Apache License, Version 2.0 (the\n' +
+                    ' * "License"); you may not use this file except in compliance\n' +
+                    ' * with the License.  You may obtain a copy of the License at\n' +
+                    ' *\n' +
+                    ' *     http://www.apache.org/licenses/LICENSE-2.0\n' +
+                    ' *\n' +
+                    ' * Unless required by applicable law or agreed to in writing, software\n' +
+                    ' * distributed under the License is distributed on an "AS IS" BASIS,\n' +
+                    ' * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n' +
+                    ' * See the License for the specific language governing permissions and\n' +
+                    ' * limitations under the License.\n' +
+                    ' */\n\n'
         }
     }