-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
121 lines (103 loc) · 3.14 KB
/
build.gradle.kts
File metadata and controls
121 lines (103 loc) · 3.14 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
plugins {
java
`java-library`
checkstyle
id("org.openapi.generator") version "7.21.0" apply false
id("com.vanniktech.maven.publish") version "0.36.0" apply false
}
allprojects {
group = "com.godaddy.ans"
version = "0.1.6" // 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-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<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("MIT License")
url.set("https://opensource.org/licenses/MIT")
}
}
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")
}
}
}
}
}