-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathbuild.gradle
233 lines (203 loc) · 7.54 KB
/
build.gradle
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
plugins {
id 'com.github.johnrengelman.shadow' version '6.1.0'
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'
dependencies {
api "io.grpc:grpc-protobuf:${grpcVersion}"
api "io.grpc:grpc-stub:${grpcVersion}"
api "io.grpc:grpc-netty:${grpcVersion}"
runtimeOnly 'io.netty:netty-tcnative-boringssl-static:2.0.61.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.14.2'
implementation 'com.fasterxml.jackson.core:jackson-core:2.14.2'
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.14.2'
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) {
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 Auto Relocation
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
task relocateShadowJar(type: ConfigureShadowRelocation) {
target = tasks.shadowJar
prefix = "io.pinecone.shadow" // Default value is "shadow"
}
tasks.shadowJar.dependsOn tasks.relocateShadowJar
// Shadow META-INF directory
import com.github.jengelman.gradle.plugins.shadow.transformers.ServiceFileTransformer
shadowJar {
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 = '[email protected]'
}
}
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://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}
signing {
def signingKeyId = findProperty("signingKeyId")
def signingKey = findProperty("signingKey")
def signingPassword = findProperty("signingPassword")
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
sign publishing.publications.pineconeClientMaven
}