-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle.kts
129 lines (103 loc) · 3 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
117
118
119
120
121
122
123
124
125
126
127
128
129
plugins {
id("dev.yumi.gradle.licenser") version "2.0.+"
id("com.gradle.plugin-publish") version "1.2.0"
kotlin("jvm") version "2.0.0"
`maven-publish`
signing
}
group = "dev.yumi"
version = "2.1.0"
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)
"functionalTestImplementation"(libs.junit.jupiter)
"functionalTestRuntimeOnly"(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"))
}
kotlin {
// Require explicit visibility/type definitions for public types, among other things
explicitApi()
}
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 {
val archivesName = base.archivesName.get()
from("LICENSE") {
rename { "${it}_${archivesName}" }
}
}
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()
}
}