forked from YumiProject/yumi-gradle-licenser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
116 lines (94 loc) · 2.73 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
plugins {
id("dev.yumi.gradle.licenser").version("1.1.+")
id("com.gradle.plugin-publish").version("1.2.0")
id("maven-publish")
id("signing")
}
group = "dev.yumi"
version = "1.1.2"
val javaVersion = 17
repositories {
mavenCentral()
}
// Add a source set for the functional test suite.
val functionalTest: SourceSet by sourceSets.creating
dependencies {
compileOnly(libs.jetbrains.annotations)
api(libs.jgit)
// Use JUnit Jupiter for testing.
testImplementation(libs.junit.jupiter)
testRuntimeOnly(libs.junit.launcher)
}
gradlePlugin {
website = "https://github.com/YumiProject/yumi-gradle-licenser"
vcsUrl = "https://github.com/YumiProject/yumi-gradle-licenser"
// Define the plugin.
plugins {
create("yumi_gradle_licenser") {
id = "dev.yumi.gradle.licenser"
displayName = "Yumi Gradle Licenser"
description = "A plugin to automatically manage license headers in project files, designed to be flexible to easily support many use cases like having different header kinds for different files."
tags = listOf("licenser", "licensing", "licenses", "license-header")
implementationClass = "dev.yumi.gradle.licenser.YumiLicenserGradlePlugin"
}
}
testSourceSets(functionalTest)
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(javaVersion))
}
withSourcesJar()
withJavadocJar()
testResultsDir.set(layout.buildDirectory.dir("junit-xml"))
}
tasks.withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
options.isDeprecation = true
options.release.set(javaVersion)
}
tasks.withType<Javadoc>().configureEach {
options {
this as StandardJavadocDocletOptions
addStringOption("Xdoclint:all,-missing", "-quiet")
}
}
tasks.jar {
from("LICENSE") {
rename { "${it}_${base.archivesName.get()}" }
}
}
license {
rule(file("codeformat/HEADER"))
exclude("scenarios/**")
}
signing {
val signingKeyId: String? by project
val signingKey: String? by project
val signingPassword: String? by project
isRequired = signingKeyId != null && signingKey != null && signingPassword != null
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
}
configurations["functionalTestImplementation"].extendsFrom(configurations.testImplementation.get())
val functionalTestTask = tasks.register<Test>("functionalTest") {
group = "verification"
testClassesDirs = functionalTest.output.classesDirs
classpath = functionalTest.runtimeClasspath
}
tasks.check {
// Run the functional tests as part of `check`.
dependsOn(functionalTestTask)
}
tasks.withType<Test>().configureEach {
// Using JUnitPlatform for running tests
useJUnitPlatform()
systemProperty("yumi.gradle.licenser.debug", System.getProperty("yumi.gradle.licenser.debug"))
testLogging {
events("passed")
}
}
publishing {
repositories {
mavenLocal()
}
}