-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathbuild.gradle
More file actions
271 lines (244 loc) · 10.2 KB
/
Copy pathbuild.gradle
File metadata and controls
271 lines (244 loc) · 10.2 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
buildscript {
// Build-time only: the Shadow 8.1.1 Gradle plugin pulls vulnerable transitive deps onto
// the plugin (buildscript) classpath. These run only in the Gradle build JVM and are NOT
// part of the published artifact, but we still pin them to patched versions to clear the
// Dependabot alerts:
// - commons-io 2.11.0 -> CVE-2024-47554 (fixed in 2.14.0)
// - plexus-utils 3.5.1 -> CVE-2025-67030 (fixed in 3.6.1)
// - log4j 2.20.0 -> CVE-2026-49844 (fixed in 2.25.5)
configurations.classpath {
resolutionStrategy {
force 'commons-io:commons-io:2.18.0'
force 'org.codehaus.plexus:plexus-utils:3.6.1'
force 'org.apache.logging.log4j:log4j-api:2.25.5'
force 'org.apache.logging.log4j:log4j-core:2.25.5'
}
}
}
plugins {
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'java-library'
id 'maven-publish'
id 'signing'
id 'idea'
id "io.github.gradle-nexus.publish-plugin" version '1.1.0'
}
group = 'io.pinecone'
version = pineconeClientVersion // [pc:VERSION_NEXT]
description = 'The Pinecone.io Java Client'
sourceCompatibility = JavaVersion.VERSION_1_8
repositories {
mavenCentral()
jcenter()
}
sourceSets {
main {
java {
srcDirs 'build/generated/source/proto/main/grpc'
srcDirs 'build/generated/source/proto/main/java'
}
}
integrationTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/integration/java')
}
resources.srcDir file('src/integration/resources')
}
}
def grpcVersion = '1.60.2'
// Netty is pulled in transitively by grpc-netty (1.60.2 -> 4.1.100.Final, which is vulnerable
// to CVE-2025-24970). grpc-netty does not pin a patched Netty even in recent releases, so we
// pin Netty directly here. Bump alongside grpc when grpc itself ships a patched Netty.
// Stay on the 4.1.x line: grpc-netty 1.60.2 targets Netty 4.1 and 4.2 changed the buffer
// allocator and IoHandler APIs it depends on.
def nettyVersion = '4.1.136.Final'
dependencies {
api "io.grpc:grpc-protobuf:${grpcVersion}"
api "io.grpc:grpc-stub:${grpcVersion}"
api "io.grpc:grpc-netty:${grpcVersion}"
// Pin every Netty module that grpc-netty declares directly so the patched version wins
// transitive resolution for consumers too (Maven nearest-wins / Gradle highest-wins).
// Fixes CVE-2025-24970 (netty-handler/netty-common, HIGH) and pulls in the patched
// netty-codec-http (CVE-2024-29025) and netty-common (CVE-2025-25193).
api "io.netty:netty-codec-http2:${nettyVersion}"
api "io.netty:netty-handler-proxy:${nettyVersion}"
api "io.netty:netty-transport-native-unix-common:${nettyVersion}"
runtimeOnly 'io.netty:netty-tcnative-boringssl-static:2.0.77.Final'
implementation 'org.slf4j:slf4j-api:2.0.5'
implementation 'com.google.api.grpc:proto-google-common-protos:2.14.3'
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.21.5'
implementation 'com.fasterxml.jackson.core:jackson-core:2.21.5'
implementation 'com.google.code.gson:gson:2.9.1'
implementation 'io.gsonfire:gson-fire:1.8.5'
implementation 'org.openapitools:jackson-databind-nullable:0.2.6'
implementation 'com.google.protobuf:protobuf-java:4.29.3'
compileOnly "org.apache.tomcat:annotations-api:6.0.53" // necessary for Java 9+
testImplementation("com.squareup.okhttp3:mockwebserver:4.12.0")
testImplementation "io.grpc:grpc-testing:${grpcVersion}"
testImplementation "org.hamcrest:hamcrest:2.2"
testImplementation 'org.mockito:mockito-inline:4.8.0'
testImplementation 'org.slf4j:slf4j-simple:2.0.5'
testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.21.5'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.0'
testImplementation 'org.junit.platform:junit-platform-launcher:1.8.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.0'
}
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
tasks.withType(Test) {
systemProperty "net.bytebuddy.experimental", "true"
testLogging {
// set options for log level LIFECYCLE
events TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_OUT
exceptionFormat TestExceptionFormat.FULL
showExceptions true
showCauses true
showStackTraces true
// set options for log level DEBUG and INFO
debug {
events TestLogEvent.STARTED,
TestLogEvent.FAILED,
TestLogEvent.PASSED,
TestLogEvent.SKIPPED,
TestLogEvent.STANDARD_ERROR,
TestLogEvent.STANDARD_OUT
exceptionFormat TestExceptionFormat.FULL
}
info.events = debug.events
info.exceptionFormat = debug.exceptionFormat
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} passed, ${result.failedTestCount} failed, ${result.skippedTestCount} skipped)"
def startItem = '| ', endItem = ' |'
def repeatLength = startItem.length() + output.length() + endItem.length()
println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength))
}
}
}
}
javadoc {
options.tags = [ "http.response.details:a:Http Response Details" ]
options.addStringOption('Xdoclint:none', '-quiet')
}
tasks.register('generateJavadoc', Javadoc) {
source = sourceSets.main.allJava
classpath += configurations.runtimeClasspath
options.addStringOption('tag', 'http.response.details:a:Http Response Details')
options.memberLevel = JavadocMemberLevel.PUBLIC
destinationDir = file("${projectDir}/docs")
}
configurations {
integrationTestImplementation.extendsFrom testImplementation
integrationTestRuntimeOnly.extendsFrom testRuntimeOnly
}
java {
withSourcesJar()
withJavadocJar()
}
tasks.named('jar') {
manifest {
attributes('Implementation-Title': project.name,
'Implementation-Version': project.version)
}
}
tasks.named('build') {
dependsOn('shadowJar')
}
test {
useJUnitPlatform()
}
task integrationTest(type: Test) {
useJUnitPlatform()
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
outputs.upToDateWhen { false }
}
// Configure Shadow JAR with relocations and transformers
import com.github.jengelman.gradle.plugins.shadow.transformers.ServiceFileTransformer
shadowJar {
// jackson-core (2.15+) is a multi-release JAR that bundles Java 21 (class-file major 65)
// variants under META-INF/versions/21. The Shadow 8.1.1 plugin relocates com.fasterxml
// and its ASM cannot read major version 65, so it fails with
// "Unsupported class file major version 65". These are JDK-21-only optimizations; dropping
// them is safe because the base (Java 8) classes remain and multi-release fallback applies.
exclude 'META-INF/versions/21/**'
relocate 'io.grpc', 'io.pinecone.shadow.io.grpc'
relocate 'com.google', 'io.pinecone.shadow.com.google'
relocate 'org.slf4j', 'io.pinecone.shadow.org.slf4j'
relocate 'okhttp3', 'io.pinecone.shadow.okhttp3'
relocate 'okio', 'io.pinecone.shadow.okio'
relocate 'com.fasterxml', 'io.pinecone.shadow.com.fasterxml'
relocate 'com.google.gson', 'io.pinecone.shadow.com.google.gson'
relocate 'io.gsonfire', 'io.pinecone.shadow.io.gsonfire'
relocate 'org.openapitools', 'io.pinecone.shadow.org.openapitools'
relocate 'com.google.protobuf', 'io.pinecone.shadow.com.google.protobuf'
relocate 'org.apache.tomcat', 'io.pinecone.shadow.org.apache.tomcat'
transform(ServiceFileTransformer)
}
publishing {
publications {
pineconeClientMaven(MavenPublication) {
from components.java
pom {
artifactId = 'pinecone-client'
name = 'pinecone-client'
description = 'The Pinecone.io Java Client'
url = 'https://github.com/pinecone-io/pinecone-java-client'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
developers {
developer {
id = 'pinecone-ops'
name = 'Pinecone.io Ops'
email = 'ops@pinecone.io'
}
}
scm {
connection = 'scm:git:git://github.com/pinecone-io/pinecone-java-client.git'
developerConnection = 'scm:git:ssh://github.com/pinecone-io/pinecone-java-client.git'
url = 'http://github.com/pinecone-io/pinecone-java-client'
}
}
}
}
publications {
mavenJava(MavenPublication) {
from components.java
pom {
artifactId = 'pinecone-client'
name = 'pinecone-client'
description = 'The Pinecone.io Java Client'
}
}
}
repositories {
mavenLocal()
}
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
}
}
}
signing {
def signingKeyId = findProperty("signingKeyId")
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
sign publishing.publications.pineconeClientMaven
}