Skip to content

Commit 64b7dd0

Browse files
committed
Ensure that all kotlin files have a license header
1 parent e9f5ec2 commit 64b7dd0

File tree

4 files changed

+37
-2
lines changed

4 files changed

+37
-2
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ jobs:
3131
${{ runner.os }}-gradle-
3232
3333
- name: Build Debug APK
34-
run: ./gradlew clean check assembleRelease --no-daemon
34+
run: ./gradlew clean license check assembleRelease --no-daemon

LICENSE_HEADER

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright 2025 Pierre-Yves Nicolas
3+
*
4+
* This program is free software: you can redistribute it and/or modify it
5+
* under the terms of the GNU General Public License as published by the Free
6+
* Software Foundation, either version 3 of the License, or (at your option)
7+
* any later version.
8+
* This program is distributed in the hope that it will be useful, but WITHOUT
9+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11+
* more details.
12+
* You should have received a copy of the GNU General Public License along with
13+
* this program. If not, see <https://www.gnu.org/licenses/>.
14+
*/

build.gradle.kts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,23 @@ plugins {
33
alias(libs.plugins.android.application) apply false
44
alias(libs.plugins.kotlin.android) apply false
55
alias(libs.plugins.kotlin.compose) apply false
6-
}
6+
alias(libs.plugins.license)
7+
}
8+
9+
license {
10+
header = rootProject.file("LICENSE_HEADER")
11+
exclude("**/*.xml")
12+
//strictCheck = true
13+
mapping("java", "SLASHSTAR_STYLE")
14+
mapping("kt", "SLASHSTAR_STYLE")
15+
}
16+
17+
// See https://github.com/hierynomus/license-gradle-plugin/issues/155
18+
tasks.register("licenseCheckForKotlin", com.hierynomus.gradle.license.tasks.LicenseCheck::class) {
19+
source = fileTree(project.projectDir) { include("**/*.kt") }
20+
}
21+
tasks["license"].dependsOn("licenseCheckForKotlin")
22+
tasks.register("licenseFormatForKotlin", com.hierynomus.gradle.license.tasks.LicenseFormat::class) {
23+
source = fileTree(project.projectDir) { include("**/*.kt") }
24+
}
25+
tasks["licenseFormat"].dependsOn("licenseFormatForKotlin")

gradle/libs.versions.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[versions]
22
agp = "8.9.2"
33
kotlin = "2.1.0"
4+
license = "0.16.1"
45
coreKtx = "1.16.0"
56
junit = "4.13.2"
67
junitVersion = "1.2.1"
@@ -50,4 +51,5 @@ assertj = { group="org.assertj", name="assertj-core", version.ref = "assertj" }
5051
android-application = { id = "com.android.application", version.ref = "agp" }
5152
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
5253
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
54+
license = { id = "com.github.hierynomus.license", version.ref = "license" }
5355

0 commit comments

Comments
 (0)