You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@grails.apache.org by ja...@apache.org on 2025/06/09 23:03:08 UTC
(grails-core) branch add-license-raw-groovy-java created (now 667a033e2c)
This is an automated email from the ASF dual-hosted git repository.
jamesfredley pushed a change to branch add-license-raw-groovy-java
in repository https://gitbox.apache.org/repos/asf/grails-core.git
at 667a033e2c Add add-license scripts for .raw, .java and .groovy
This branch includes the following new commits:
new 667a033e2c Add add-license scripts for .raw, .java and .groovy
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(grails-core) 01/01: Add add-license scripts for .raw, .java and .groovy
Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jamesfredley pushed a commit to branch add-license-raw-groovy-java
in repository https://gitbox.apache.org/repos/asf/grails-core.git
commit 667a033e2c549c0649940444b4e9addd3215c753
Author: James Fredley <ja...@users.noreply.github.com>
AuthorDate: Mon Jun 9 19:02:53 2025 -0400
Add add-license scripts for .raw, .java and .groovy
---
etc/bin/add-license-groovy-java.groovy | 62 ++++++++++++++++++++++++++++++++++
etc/bin/add-license-raw.groovy | 60 ++++++++++++++++++++++++++++++++
2 files changed, 122 insertions(+)
diff --git a/etc/bin/add-license-groovy-java.groovy b/etc/bin/add-license-groovy-java.groovy
new file mode 100644
index 0000000000..ef2dccbca6
--- /dev/null
+++ b/etc/bin/add-license-groovy-java.groovy
@@ -0,0 +1,62 @@
+#!/usr/bin/env groovy
+/*
+ * 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
+ *
+ * https://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.
+ */
+import java.nio.file.*
+
+def ASF_MARKER = "Licensed to the Apache Software Foundation (ASF) under one"
+def ASF_MARKER2 = "Licensed under the Apache License, Version 2.0 (the \"License\");"
+
+def HEADER = '''/*
+ * 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
+ *
+ * https://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.
+ */
+
+'''
+
+def root = Paths.get(".").toRealPath()
+
+Files.walk(root)
+ .filter { path -> Files.isRegularFile(path) && (path.toString().endsWith(".groovy") || path.toString().endsWith(".java")) }
+ .each { path ->
+ def text = path.toFile().getText("UTF-8")
+ if (!text.contains(ASF_MARKER) && !text.contains(ASF_MARKER2)) {
+ println "📄 Adding ASF header to ${path}"
+ // Prepend header + existing content
+ path.toFile().withWriter("UTF-8") { writer ->
+ writer << HEADER
+ writer << text
+ }
+ }
+ }
+
+println "✅ Done."
diff --git a/etc/bin/add-license-raw.groovy b/etc/bin/add-license-raw.groovy
new file mode 100644
index 0000000000..61f5f06658
--- /dev/null
+++ b/etc/bin/add-license-raw.groovy
@@ -0,0 +1,60 @@
+#!/usr/bin/env groovy
+/*
+ * 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
+ *
+ * https://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.
+ */
+import java.nio.file.*
+
+def ASF_MARKER = "Licensed to the Apache Software Foundation (ASF) under one"
+def HEADER = '''@*
+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
+
+https://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.
+*@
+
+'''
+
+def root = Paths.get(".").toRealPath()
+
+Files.walk(root)
+ .filter { path -> Files.isRegularFile(path) && path.toString().endsWith(".raw") }
+ .each { path ->
+ def text = path.toFile().getText("UTF-8")
+ if (!text.contains(ASF_MARKER)) {
+ println "📄 Adding ASF header to ${path}"
+ // Prepend header + existing content
+ path.toFile().withWriter("UTF-8") { writer ->
+ writer << HEADER
+ writer << text
+ }
+ }
+ }
+
+println "✅ Done."