-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle.kts
119 lines (105 loc) · 3.6 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
import com.diffplug.gradle.spotless.SpotlessExtension
import io.spring.gradle.dependencymanagement.internal.dsl.StandardDependencyManagementExtension
import org.jetbrains.kotlin.com.github.gundy.semver4j.SemVer
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.net.URI
plugins {
id("io.spring.dependency-management") version "1.1.7" apply false
kotlin("jvm") version "2.1.0" apply false
kotlin("plugin.spring") version "2.1.0" apply false
id("org.sonarqube") version "6.0.1.5171"
id("com.diffplug.spotless") version("6.25.0")
}
sonar {
properties {
property("sonar.host.url", "https://sonarcloud.io")
property("sonar.projectKey", "OSGP_gxf-java-utilities")
property("sonar.organization", "gxf")
}
}
group = "com.gxf.utilities"
version = System.getenv("GITHUB_REF_NAME")
?.replace("/", "-")
?.lowercase()
?.let { if (SemVer.valid(it)) it.removePrefix("v") else "${it}-SNAPSHOT" }
?: "develop"
subprojects {
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "org.jetbrains.kotlin.plugin.spring")
apply(plugin = "io.spring.dependency-management")
apply(plugin = "org.gradle.maven-publish")
apply(plugin = "jacoco")
apply(plugin = "jacoco-report-aggregation")
apply(plugin = "com.diffplug.spotless")
group = rootProject.group
version = rootProject.version
repositories {
mavenCentral()
}
extensions.configure<StandardDependencyManagementExtension> {
imports {
mavenBom("org.springframework.boot:spring-boot-dependencies:3.4.1")
}
}
extensions.configure<JavaPluginExtension> {
withJavadocJar()
withSourcesJar()
}
extensions.configure<KotlinJvmProjectExtension> {
jvmToolchain {
languageVersion = JavaLanguageVersion.of(21)
}
compilerOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
}
}
extensions.configure<SpotlessExtension> {
kotlin {
// by default the target is every '.kt' and '.kts' file in the java source sets
ktfmt().dropboxStyle().configure {
it.setMaxWidth(120)
}
licenseHeaderFile(
"${project.rootDir}/license-template.kt",
"package")
.updateYearWithLatest(false)
}
}
extensions.configure<PublishingExtension> {
repositories {
mavenLocal()
maven {
name = "GitHubPackages"
url = URI("https://maven.pkg.github.com/osgp/gxf-java-utilities")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
publications {
create<MavenPublication>("java") {
from(components.getByName("java"))
}
}
}
tasks.register<DependencyReportTask>("dependenciesAll"){
description = "Displays all dependencies declared in all sub projects"
group = "help"
}
tasks.withType<Test> {
useJUnitPlatform()
}
tasks.register<Copy>("updateGitHooks") {
description = "Copies the pre-commit Git Hook to the .git/hooks folder."
group = "verification"
from("${project.rootDir}/scripts/pre-commit")
into("${project.rootDir}/.git/hooks")
}
tasks.withType<KotlinCompile> {
dependsOn(
tasks.named("updateGitHooks")
)
}
}