Ensure that all kotlin files have a license header

This commit is contained in:
Pierre-Yves Nicolas
2025-06-06 08:27:32 +02:00
parent e9f5ec2cf0
commit 6388e96cc7
4 changed files with 37 additions and 3 deletions

View File

@@ -30,5 +30,5 @@ jobs:
restore-keys: | restore-keys: |
${{ runner.os }}-gradle- ${{ runner.os }}-gradle-
- name: Build Debug APK - name: Run Gradle
run: ./gradlew clean check assembleRelease --no-daemon run: ./gradlew clean license check assembleRelease --no-daemon

13
LICENSE_HEADER Normal file
View File

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

View File

@@ -3,4 +3,23 @@ plugins {
alias(libs.plugins.android.application) apply false alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.android) apply false alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.compose) apply false alias(libs.plugins.kotlin.compose) apply false
} alias(libs.plugins.license)
}
license {
header = rootProject.file("LICENSE_HEADER")
exclude("**/*.xml")
//strictCheck = true
mapping("java", "SLASHSTAR_STYLE")
mapping("kt", "SLASHSTAR_STYLE")
}
// See https://github.com/hierynomus/license-gradle-plugin/issues/155
tasks.register("licenseCheckForKotlin", com.hierynomus.gradle.license.tasks.LicenseCheck::class) {
source = fileTree(project.projectDir) { include("**/*.kt") }
}
tasks["license"].dependsOn("licenseCheckForKotlin")
tasks.register("licenseFormatForKotlin", com.hierynomus.gradle.license.tasks.LicenseFormat::class) {
source = fileTree(project.projectDir) { include("**/*.kt") }
}
tasks["licenseFormat"].dependsOn("licenseFormatForKotlin")

View File

@@ -1,6 +1,7 @@
[versions] [versions]
agp = "8.9.2" agp = "8.9.2"
kotlin = "2.1.0" kotlin = "2.1.0"
license = "0.16.1"
coreKtx = "1.16.0" coreKtx = "1.16.0"
junit = "4.13.2" junit = "4.13.2"
junitVersion = "1.2.1" junitVersion = "1.2.1"
@@ -50,4 +51,5 @@ assertj = { group="org.assertj", name="assertj-core", version.ref = "assertj" }
android-application = { id = "com.android.application", version.ref = "agp" } android-application = { id = "com.android.application", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
license = { id = "com.github.hierynomus.license", version.ref = "license" }