mirror of
https://github.com/hanzoai/java-sdk.git
synced 2026-10-30 15:07:36 +00:00
119 lines
4.9 KiB
Groovy
119 lines
4.9 KiB
Groovy
// The published artifact: ai.hanzo:hanzo-java-cloud.
|
|
//
|
|
// src/main/java/ai/hanzo/cloud is generated in full from the API document and
|
|
// is replaced wholesale on every regeneration — never edit it, and never add a
|
|
// file to it. Everything else in the module is the repo's: this build file, and
|
|
// ai/hanzo/Hanzo.java beside the generated package.
|
|
|
|
apply plugin: 'java-library'
|
|
apply plugin: 'maven-publish'
|
|
apply plugin: 'signing'
|
|
|
|
group = 'ai.hanzo'
|
|
// The artifact's own number, not the document's: the document versions itself
|
|
// `v1` and says nothing about a client. It moves when this client changes —
|
|
// 8.0.1 is the projection of the document that declares its bearer scheme.
|
|
// What a version NAMES is a tag; `git ls-remote --tags` is the authority on
|
|
// which numbers are taken, and this repo has none, so nothing is claimed twice.
|
|
version = '8.5.640'
|
|
|
|
dependencies {
|
|
// What the generated sources actually import — see the java row in
|
|
// hanzoai/openapi sdks.yaml for why the okhttp-gson library and not
|
|
// `native`.
|
|
//
|
|
// okhttp and gson are `api`, not `implementation`: ApiClient hands back an
|
|
// OkHttpClient and JSON hands back a Gson, and every model has a public
|
|
// validateJsonElement(JsonElement). They are in the signatures, so they are
|
|
// part of the surface whether or not this file says so.
|
|
api 'com.squareup.okhttp3:okhttp:4.12.0'
|
|
api 'com.google.code.gson:gson:2.9.1'
|
|
implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0'
|
|
implementation 'io.gsonfire:gson-fire:1.9.0'
|
|
// JsonNullable, in 191 models — private equals/hashCode helpers, so it
|
|
// stays off the public surface.
|
|
implementation 'org.openapitools:jackson-databind-nullable:0.2.6'
|
|
// @javax.annotation.Nullable and @Nonnull, written fully qualified in 2611
|
|
// sources.
|
|
implementation 'com.google.code.findbugs:jsr305:3.0.2'
|
|
// @javax.annotation.Generated, on every generated type. The 1.x line still
|
|
// publishes the javax namespace — jakarta.annotation.* only arrives in 2.0,
|
|
// where this stops compiling.
|
|
implementation 'jakarta.annotation:jakarta.annotation-api:1.3.5'
|
|
}
|
|
|
|
// Maven Central requires -sources and -javadoc beside the jar.
|
|
java {
|
|
withSourcesJar()
|
|
withJavadocJar()
|
|
}
|
|
|
|
javadoc {
|
|
options.encoding = 'UTF-8'
|
|
// The prose is the spec's, transcribed by the generator. Doclint would
|
|
// reject a route description for HTML it never claimed to be.
|
|
options.addStringOption('Xdoclint:none', '-quiet')
|
|
}
|
|
|
|
publishing {
|
|
publications {
|
|
maven(MavenPublication) {
|
|
from components.java
|
|
pom {
|
|
name = 'Hanzo Cloud Java SDK'
|
|
description = 'Java client for the Hanzo Cloud unified API, generated from hanzoai/openapi.'
|
|
url = 'https://github.com/hanzoai/java-sdk'
|
|
licenses {
|
|
license {
|
|
name = 'Apache License 2.0'
|
|
url = 'https://www.apache.org/licenses/LICENSE-2.0'
|
|
}
|
|
}
|
|
developers {
|
|
developer {
|
|
id = 'hanzoai'
|
|
name = 'Hanzo AI'
|
|
email = '[email protected]'
|
|
}
|
|
}
|
|
scm {
|
|
connection = 'scm:git:https://github.com/hanzoai/java-sdk.git'
|
|
developerConnection = 'scm:git:ssh://[email protected]/hanzoai/java-sdk.git'
|
|
url = 'https://github.com/hanzoai/java-sdk'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
repositories {
|
|
maven {
|
|
name = 'central'
|
|
url = 'https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/'
|
|
credentials {
|
|
username = System.getenv('MAVEN_CENTRAL_USERNAME')
|
|
password = System.getenv('MAVEN_CENTRAL_PASSWORD')
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
signing {
|
|
// The signature follows the DESTINATION, not whether a key happens to be in
|
|
// the environment. Central rejects an unsigned artifact; `~/.m2` has no use
|
|
// for a signature — so a Central publish with no key fails right here, and
|
|
// a local install still runs without one.
|
|
//
|
|
// Keying it off the key instead is a silent-success trap: with the key
|
|
// unset, `sign` was never called, the publish graph held no signing task at
|
|
// all, and the upload went out unsigned with BUILD SUCCESSFUL. Central then
|
|
// refuses the deployment out of band, hours later, nowhere near the cause.
|
|
//
|
|
// The key is an ASCII-armoured private key in KMS (kms.hanzo.ai), read by
|
|
// .hanzo/workflows/release.yml. Never on disk, never in this repo.
|
|
required = { gradle.taskGraph.hasTask(':hanzo-java-cloud:publishMavenPublicationToCentralRepository') }
|
|
def key = System.getenv('MAVEN_GPG_PRIVATE_KEY')
|
|
if (key) {
|
|
useInMemoryPgpKeys(key, System.getenv('MAVEN_GPG_PASSPHRASE'))
|
|
}
|
|
sign publishing.publications.maven
|
|
}
|