Skip to content

Commit dbb11b9

Browse files
committed
Fixup license headers
1 parent fce7417 commit dbb11b9

File tree

64 files changed

+293
-58
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+293
-58
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ tests/tck-build-logic/* @vjovanov
44
tests/tck-build-logic/src/main/resources/allowed-docker-images/* @matneu
55
library-and-framework-list.json @fniephaus
66
.github/* @vjovanov
7-
docs/* @vjovanov @ban-mi
8-
README.md @vjovanov @ban-mi
7+
docs/* @vjovanov
8+
README.md @vjovanov
99
gradle/* @vjovanov
1010
/* @vjovanov

.github/workflows/checkstyle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ jobs:
2424
distribution: 'graalvm'
2525
java-version: '21'
2626

27-
- run: ./gradlew checkstyle
27+
- run: ./gradlew spotlessCheck checkstyle

build.gradle

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/*
2+
* Copyright and related rights waived via CC0
3+
*
4+
* You should have received a copy of the CC0 legalcode along with this
5+
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
6+
*/
17
import java.util.concurrent.Executors
28
import java.util.concurrent.TimeUnit
39

@@ -40,6 +46,46 @@ spotless {
4046
.sortByKeys()
4147
.version("2.9.0")
4248
}
49+
java {
50+
target('**/*.java')
51+
targetExclude(
52+
'metadata/**', // only JSON there
53+
'**/build/**',
54+
'gradle/header.java')
55+
// Place header before package/import/module
56+
licenseHeaderFile("$rootDir/gradle/header.java", "package |import |module ")
57+
}
58+
groovy {
59+
target('**/*.groovy')
60+
targetExclude(
61+
'metadata/**', // only JSON there
62+
'**/build/**')
63+
// Place header before package/import
64+
licenseHeaderFile("$rootDir/gradle/header.java", "package |import ")
65+
}
66+
groovyGradle {
67+
// Build scripts (*.gradle)
68+
target('**/*.gradle')
69+
targetExclude(
70+
'metadata/**', // only JSON there
71+
'**/build/**', 'gradle/wrapper/**', 'tests/**')
72+
// Insert header at file start (works for any Gradle script layout)
73+
licenseHeaderFile("$rootDir/gradle/header.java", "(?m)^(import\\b|plugins\\b|buildscript\\b|apply\\b|rootProject\\b|pluginManagement\\b|dependencyResolutionManagement\\b)")
74+
}
75+
format('shell') {
76+
target('**/*.sh')
77+
targetExclude('metadata/**', '**/build/**')
78+
// Ensure header appears after shebang if present, else at the very top.
79+
def shHeader = file("$rootDir/gradle/header.sh").text
80+
// If file starts with a shebang and is missing the header, insert it after the shebang
81+
replaceRegex('insert-license-after-shebang',
82+
'(?s)\\A(#!.*\\n)(?!# Copyright and related rights waived via CC0\\n)',
83+
'$1' + shHeader + "\n")
84+
// If file has no shebang and is missing the header, insert it at the start
85+
replaceRegex('insert-license-at-start',
86+
'(?s)\\A(?!#!)(?!# Copyright and related rights waived via CC0\\n)',
87+
shHeader + "\n")
88+
}
4389
}
4490

4591
// gradle package

docs/DEVELOPING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ Tip: When debugging locally, add `--stacktrace` for better error output.
3838
```console
3939
./gradlew spotlessCheck
4040
```
41+
3. Auto-fix license headers and formatting locally:
42+
```console
43+
./gradlew spotlessApply
44+
```
45+
Spotless enforces the CC0 license header on Java, Groovy, Gradle build scripts, and shell scripts. The metadata/** directory is excluded from header checks.
4146

4247
### Testing one library locally
4348

@@ -128,6 +133,7 @@ These tasks support the scheduled workflow that checks newer upstream library ve
128133

129134
- Style: `./gradlew checkstyle`
130135
- Format check: `./gradlew spotlessCheck`
136+
- Format apply: `./gradlew spotlessApply`
131137
- Pull images (single lib): `./gradlew pullAllowedDockerImages -Pcoordinates=[group:artifact:version|k/n|all]`
132138
- Check metadata (single lib): `./gradlew checkMetadataFiles -Pcoordinates=[group:artifact:version|k/n|all]`
133139
- Test (single lib): `./gradlew test -Pcoordinates=[group:artifact:version|k/n|all]`

gradle/header.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/*
2+
* Copyright and related rights waived via CC0
3+
*
4+
* You should have received a copy of the CC0 legalcode along with this
5+
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
6+
*/

gradle/header.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright and related rights waived via CC0
2+
#
3+
# You should have received a copy of the CC0 legalcode along with this
4+
# work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.

settings.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/*
2+
* Copyright and related rights waived via CC0
3+
*
4+
* You should have received a copy of the CC0 legalcode along with this
5+
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
6+
*/
17
pluginManagement {
28
includeBuild("tests/tck-build-logic")
39
}

tests/src/com.zaxxer/HikariCP/5.0.1/src/test/java/com/zaxxer/hikaricp/test/HikariCPTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* You should have received a copy of the CC0 legalcode along with this
55
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
66
*/
7-
87
package com.zaxxer.hikaricp.test;
98

109
import com.zaxxer.hikari.HikariConfig;

tests/src/com.zaxxer/HikariCP/5.0.1/src/test/java/com/zaxxer/hikaricp/test/driver/CustomConnection.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* You should have received a copy of the CC0 legalcode along with this
55
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
66
*/
7-
87
package com.zaxxer.hikaricp.test.driver;
98

109
import java.sql.Array;

tests/src/com.zaxxer/HikariCP/5.0.1/src/test/java/com/zaxxer/hikaricp/test/driver/CustomDriver.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* You should have received a copy of the CC0 legalcode along with this
55
* work. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
66
*/
7-
87
package com.zaxxer.hikaricp.test.driver;
98

109
import java.sql.Connection;

0 commit comments

Comments
 (0)