diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 81f193b..79925d8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,5 +30,5 @@ jobs: restore-keys: | ${{ runner.os }}-gradle- - - name: Build Debug APK - run: ./gradlew clean check assembleRelease --no-daemon + - name: Run Gradle + run: ./gradlew clean license check assembleRelease --no-daemon diff --git a/LICENSE_HEADER b/LICENSE_HEADER new file mode 100644 index 0000000..574f4c6 --- /dev/null +++ b/LICENSE_HEADER @@ -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 . + diff --git a/build.gradle.kts b/build.gradle.kts index 952b930..29c076e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,4 +3,23 @@ plugins { alias(libs.plugins.android.application) apply false alias(libs.plugins.kotlin.android) apply false alias(libs.plugins.kotlin.compose) apply false -} \ No newline at end of file + 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") diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index bb984f0..195ae06 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,7 @@ [versions] agp = "8.9.2" kotlin = "2.1.0" +license = "0.16.1" coreKtx = "1.16.0" junit = "4.13.2" 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" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } +license = { id = "com.github.hierynomus.license", version.ref = "license" }