|
1
|
1 |
package com.geekorum.build
|
|
|
2 |
|
|
|
3 |
import com.hierynomus.gradle.license.LicenseBasePlugin
|
|
|
4 |
import com.hierynomus.gradle.license.tasks.LicenseCheck
|
|
|
5 |
import com.hierynomus.gradle.license.tasks.LicenseFormat
|
|
|
6 |
import nl.javadude.gradle.plugins.license.LicenseExtension
|
|
|
7 |
import nl.javadude.gradle.plugins.license.LicensePlugin
|
|
|
8 |
import org.gradle.api.Project
|
|
|
9 |
import org.gradle.api.Task
|
|
|
10 |
import org.gradle.kotlin.dsl.apply
|
|
|
11 |
import org.gradle.kotlin.dsl.configure
|
|
|
12 |
import org.gradle.kotlin.dsl.invoke
|
|
|
13 |
import org.gradle.kotlin.dsl.named
|
|
|
14 |
|
|
|
15 |
internal fun Project.configureSourceLicenseChecker(): Unit {
|
|
|
16 |
apply<LicensePlugin>()
|
|
|
17 |
|
|
|
18 |
configure<LicenseExtension> {
|
|
|
19 |
header = file("$rootDir/config/license/header.txt")
|
|
|
20 |
// ignore failures for now until we set the final license
|
|
|
21 |
ignoreFailures = true
|
|
|
22 |
|
|
|
23 |
excludes(listOf("**/*.webp", "**/*.png"))
|
|
|
24 |
}
|
|
|
25 |
|
|
|
26 |
tasks {
|
|
|
27 |
val checkKotlinFilesLicenseTask = register("checkKotlinFilesLicense", LicenseCheck::class.java) {
|
|
|
28 |
source = fileTree("src").apply {
|
|
|
29 |
include("**/*.kt")
|
|
|
30 |
}
|
|
|
31 |
}
|
|
|
32 |
|
|
|
33 |
val formatKotlinFilesLicenseTask = register("formatKotlinFilesLicense", LicenseFormat::class.java) {
|
|
|
34 |
source = fileTree("src").apply {
|
|
|
35 |
include("**/*.kt")
|
|
|
36 |
}
|
|
|
37 |
}
|
|
|
38 |
|
|
|
39 |
named<Task>(LicenseBasePlugin.getLICENSE_TASK_BASE_NAME()) {
|
|
|
40 |
dependsOn(checkKotlinFilesLicenseTask)
|
|
|
41 |
}
|
|
|
42 |
|
|
|
43 |
named<Task>(LicenseBasePlugin.getFORMAT_TASK_BASE_NAME()) {
|
|
|
44 |
dependsOn(formatKotlinFilesLicenseTask)
|
|
|
45 |
}
|
|
|
46 |
}
|
|
|
47 |
}
|