-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
130 lines (112 loc) · 3.41 KB
/
build.gradle.kts
File metadata and controls
130 lines (112 loc) · 3.41 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
plugins {
`java-library`
`maven-publish`
signing
id("com.diffplug.spotless") version "7.0.2"
}
group = "dev.peekapi"
version = "0.1.0"
java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
withJavadocJar()
withSourcesJar()
}
repositories {
mavenCentral()
}
dependencies {
compileOnly("jakarta.servlet:jakarta.servlet-api:6.0.0")
compileOnly("org.springframework.boot:spring-boot-autoconfigure:3.2.0")
compileOnly("org.springframework:spring-web:6.1.0")
testImplementation(platform("org.junit:junit-bom:5.11.4"))
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("org.mockito:mockito-core:5.14.2")
testImplementation("jakarta.servlet:jakarta.servlet-api:6.0.0")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
tasks.test {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
}
tasks.jar {
manifest {
attributes(
"Implementation-Title" to "PeekAPI Java SDK",
"Implementation-Version" to project.version,
)
}
}
tasks.javadoc {
(options as StandardJavadocDocletOptions).apply {
addStringOption("Xdoclint:none", "-quiet")
}
}
spotless {
java {
googleJavaFormat("1.25.2")
removeUnusedImports()
}
}
publishing {
publications {
create<MavenPublication>("mavenJava") {
from(components["java"])
pom {
name = "PeekAPI Java SDK"
description = "Zero-dependency Java SDK for PeekAPI — Jakarta Servlet Filter and Spring Boot auto-configuration for API analytics"
url = "https://github.com/peekapi-dev/sdk-java"
inceptionYear = "2025"
licenses {
license {
name = "MIT License"
url = "https://opensource.org/licenses/MIT"
}
}
developers {
developer {
name = "PeekAPI"
email = "support@peekapi.dev"
url = "https://peekapi.dev"
}
}
scm {
url = "https://github.com/peekapi-dev/sdk-java"
connection = "scm:git:git://github.com/peekapi-dev/sdk-java.git"
developerConnection = "scm:git:ssh://github.com:peekapi-dev/sdk-java.git"
}
issueManagement {
system = "GitHub"
url = "https://github.com/peekapi-dev/community/issues"
}
}
}
}
repositories {
maven {
name = "staging"
url = uri(layout.buildDirectory.dir("staging-deploy"))
}
}
}
signing {
// CI: in-memory PGP key via ORG_GRADLE_PROJECT_signingKey / ORG_GRADLE_PROJECT_signingPassword
// Local: gpg command (uses gpg agent)
val signingKey: String? by project
val signingPassword: String? by project
if (signingKey != null) {
useInMemoryPgpKeys(signingKey, signingPassword ?: "")
} else {
useGpgCmd()
}
sign(publishing.publications["mavenJava"])
}
// Only require signing when publishing (not during tests)
tasks.withType<Sign>().configureEach {
onlyIf {
gradle.taskGraph.allTasks.any { it.name.startsWith("publish") }
}
}