Repository navigation
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
144 lines (124 loc) · 4.02 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
144 lines (124 loc) · 4.02 KB
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
plugins {
java
`java-library`
checkstyle
id("org.openapi.generator") version "7.26.0" apply false
id("com.vanniktech.maven.publish") version "0.37.0" apply false
}
allprojects {
group = "com.godaddy.ans"
version = "0.2.1" // x-release-please-version
}
// Modules to publish (excludes examples)
val publishableModules = setOf(
"ans-sdk-api",
"ans-sdk-core",
"ans-sdk-crypto",
"ans-sdk-registration",
"ans-sdk-discovery",
"ans-sdk-agent-client",
"ans-sdk-transparency",
"ans-sdk-pop",
"ans-sdk-pop-spring",
"ans-sdk-spring-boot-starter"
)
subprojects {
apply(plugin = "java-library")
apply(plugin = "checkstyle")
apply(plugin = "jacoco")
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
}
repositories {
mavenCentral()
}
dependencies {
// Required for Gradle 9.x JUnit Platform support
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
checkstyle {
toolVersion = "10.12.5"
configFile = rootProject.file("config/checkstyle/checkstyle.xml")
maxWarnings = 0
}
tasks.withType<Test> {
useJUnitPlatform()
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
}
tasks.withType<org.gradle.jvm.tasks.Jar>().configureEach {
from(rootProject.files("LICENSE", "NOTICE")) {
into("META-INF")
}
from(rootProject.file("LICENSES")) {
into("META-INF/LICENSES")
}
}
// Run javadoc as part of check/build so doc errors surface locally and in CI,
// not only when the release job generates the javadoc jar for Maven Central.
tasks.named("check") {
dependsOn(tasks.named("javadoc"))
}
tasks.withType<Test> {
finalizedBy(tasks.withType<JacocoReport>())
}
tasks.withType<JacocoReport> {
dependsOn(tasks.withType<Test>())
reports {
xml.required.set(true)
html.required.set(true)
}
}
// Only enforce 90% coverage on publishable modules (not examples)
if (publishableModules.contains(project.name)) {
tasks.withType<JacocoCoverageVerification> {
violationRules {
rule {
limit {
minimum = "0.90".toBigDecimal()
}
}
}
}
}
// Apply publishing only to publishable modules
if (name in publishableModules) {
apply(plugin = "com.vanniktech.maven.publish")
configure<com.vanniktech.maven.publish.MavenPublishBaseExtension> {
publishToMavenCentral(automaticRelease = true)
signAllPublications()
pom {
name.set(project.name)
description.set("ANS SDK - ${project.name}")
url.set("https://github.com/godaddy/ans-sdk-java")
licenses {
license {
name.set("Apache License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0")
comments.set("Applies to new original contributions.")
}
license {
name.set("MIT License")
url.set("https://opensource.org/licenses/MIT")
comments.set("Applies to legacy MIT-licensed material.")
}
}
developers {
developer {
id.set("godaddy")
name.set("GoDaddy")
email.set("oswg@godaddy.com")
}
}
scm {
connection.set("scm:git:git://github.com/godaddy/ans-sdk-java.git")
developerConnection.set("scm:git:ssh://github.com/godaddy/ans-sdk-java.git")
url.set("https://github.com/godaddy/ans-sdk-java")
}
}
}
}
}