|
1 | 1 | plugins { |
2 | 2 | id 'java-library' |
3 | 3 | id 'maven-publish' |
| 4 | + id 'signing' |
4 | 5 | id 'com.diffplug.spotless' version '6.25.0' |
5 | 6 | id 'io.freefair.lombok' version '9.0.0-rc2' |
| 7 | + id 'com.vanniktech.maven.publish' version '0.28.0' |
6 | 8 | id 'idea' |
7 | 9 | id 'eclipse' |
8 | 10 | } |
|
29 | 31 | languageVersion = JavaLanguageVersion.of(17) |
30 | 32 | vendor = JvmVendorSpec.ADOPTIUM // eclipse JVM |
31 | 33 | } |
32 | | - withJavadocJar() |
33 | | - withSourcesJar() |
34 | 34 | } |
35 | 35 |
|
36 | 36 | tasks.withType(JavaCompile).configureEach { |
@@ -224,32 +224,59 @@ jar { |
224 | 224 | } |
225 | 225 | } |
226 | 226 |
|
227 | | -publishing { |
228 | | - publications { |
229 | | - maven(MavenPublication) { |
230 | | - from components.java |
231 | | - |
232 | | - pom { |
233 | | - name = 'Braintrust Java SDK' |
234 | | - description = 'OpenTelemetry-based Braintrust SDK for Java' |
235 | | - url = 'https://github.com/braintrustdata/braintrust-x-java' |
236 | | - |
237 | | - licenses { |
238 | | - license { |
239 | | - name = 'MIT License' |
240 | | - url = 'https://opensource.org/licenses/MIT' |
241 | | - } |
242 | | - } |
243 | | - |
244 | | - developers { |
245 | | - developer { |
246 | | - id = 'braintrust' |
247 | | - name = 'Braintrust Team' |
248 | | - email = 'support@braintrust.dev' |
249 | | - } |
250 | | - } |
| 227 | +import com.vanniktech.maven.publish.JavadocJar |
| 228 | +import com.vanniktech.maven.publish.JavaLibrary |
| 229 | +import com.vanniktech.maven.publish.SonatypeHost |
| 230 | + |
| 231 | +def signingKey = System.getenv("GPG_SIGNING_KEY") |
| 232 | +def signingKeyId = System.getenv("GPG_SIGNING_KEY_ID") |
| 233 | +def signingPassword = System.getenv("GPG_SIGNING_PASSWORD") |
| 234 | + |
| 235 | +if (signingKey != null && signingKeyId != null && signingPassword != null) { |
| 236 | + ext["signingInMemoryKey"] = signingKey |
| 237 | + ext["signingInMemoryKeyId"] = signingKeyId |
| 238 | + ext["signingInMemoryKeyPassword"] = signingPassword |
| 239 | +} |
| 240 | + |
| 241 | +mavenPublishing { |
| 242 | + if (signingKey != null && signingKeyId != null && signingPassword != null) { |
| 243 | + signAllPublications() |
| 244 | + } |
| 245 | + publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL) |
| 246 | + |
| 247 | + coordinates(group.toString(), 'braintrust-sdk-java', version.toString()) |
| 248 | + configure( |
| 249 | + new JavaLibrary( |
| 250 | + new JavadocJar.Javadoc(), |
| 251 | + true |
| 252 | + ) |
| 253 | + ) |
| 254 | + |
| 255 | + pom { |
| 256 | + name = 'Braintrust Java SDK' |
| 257 | + description = 'Braintrust SDK for logs and evals in Java' |
| 258 | + url = 'https://github.com/braintrustdata/braintrust-sdk-java' |
| 259 | + |
| 260 | + licenses { |
| 261 | + license { |
| 262 | + name = 'MIT License' |
| 263 | + url = 'https://opensource.org/licenses/MIT' |
251 | 264 | } |
252 | 265 | } |
| 266 | + |
| 267 | + developers { |
| 268 | + developer { |
| 269 | + id = 'braintrust' |
| 270 | + name = 'Braintrust Team' |
| 271 | + email = 'info@braintrust.dev' |
| 272 | + } |
| 273 | + } |
| 274 | + |
| 275 | + scm { |
| 276 | + connection = 'scm:git:git://github.com/braintrustdata/braintrust-sdk-java.git' |
| 277 | + developerConnection = 'scm:git:git://github.com/braintrustdata/braintrust-sdk-java.git' |
| 278 | + url = 'https://github.com/braintrustdata/braintrust-sdk-java' |
| 279 | + } |
253 | 280 | } |
254 | 281 | } |
255 | 282 |
|
|
0 commit comments