|
| 1 | + |
| 2 | +buildscript { |
| 3 | + repositories { |
| 4 | + mavenCentral() |
| 5 | + mavenLocal() |
| 6 | + } |
| 7 | +} |
| 8 | + |
| 9 | +plugins { |
| 10 | + id "java" |
| 11 | + id "java-library" |
| 12 | + id "checkstyle" |
| 13 | + id "jacoco" |
| 14 | + id "signing" |
| 15 | + id "maven-publish" |
| 16 | + id "io.github.gradle-nexus.publish-plugin" version "1.3.0" |
| 17 | + id "idea" |
| 18 | +} |
| 19 | + |
| 20 | +configurations.all { |
| 21 | + // check for updates every build for dependencies with: 'changing: true' |
| 22 | + resolutionStrategy.cacheChangingModulesFor 0, 'seconds' |
| 23 | +} |
| 24 | + |
| 25 | +repositories { |
| 26 | + mavenLocal() |
| 27 | + // Before LaunchDarkly release artifacts get synced to Maven Central they are here along with snapshots: |
| 28 | + maven { url "https://oss.sonatype.org/content/groups/public/" } |
| 29 | + mavenCentral() |
| 30 | +} |
| 31 | + |
| 32 | +allprojects { |
| 33 | + group = 'com.launchdarkly' |
| 34 | + version = "${version}" |
| 35 | + archivesBaseName = 'launchdarkly-java-server-sdk-ai' |
| 36 | + sourceCompatibility = 1.8 |
| 37 | + targetCompatibility = 1.8 |
| 38 | +} |
| 39 | + |
| 40 | +ext { |
| 41 | + sdkBasePackage = "com.launchdarkly.sdk.server.ai" |
| 42 | +} |
| 43 | + |
| 44 | +ext.versions = [ |
| 45 | + // The *lowest* version of the base SDK we are compatible with. LDClientInterface |
| 46 | + // appears in this library's public signature, so it is exposed as an `api` dependency. |
| 47 | + "sdk": "7.14.0" |
| 48 | + // NOTE: a Mustache templating dependency (for AI Config message/instruction interpolation) |
| 49 | + // will be added in a later step once it has been fully audited (license / maintenance / |
| 50 | + // transitive deps). See AIC-2662. |
| 51 | +] |
| 52 | + |
| 53 | +ext.libraries = [:] |
| 54 | + |
| 55 | +dependencies { |
| 56 | + // Exposed on the public API surface (LDClientInterface), therefore `api` not `implementation`. |
| 57 | + api "com.launchdarkly:launchdarkly-java-server-sdk:${versions.sdk}" |
| 58 | + |
| 59 | + testImplementation "org.hamcrest:hamcrest-all:1.3" |
| 60 | + testImplementation "junit:junit:4.13.2" |
| 61 | + testImplementation "org.mockito:mockito-core:3.12.4" |
| 62 | +} |
| 63 | + |
| 64 | +// Non-public implementation detail lives in `com.launchdarkly.sdk.server.ai.internal` and its |
| 65 | +// subpackages. We deliberately exclude it from the published Javadoc and sources jars so it is |
| 66 | +// not part of the supported, documented surface. See package-info / README for the convention. |
| 67 | +def internalPackageGlob = "**/com/launchdarkly/sdk/server/ai/internal/**" |
| 68 | + |
| 69 | +java { |
| 70 | + withJavadocJar() |
| 71 | + withSourcesJar() |
| 72 | +} |
| 73 | + |
| 74 | +javadoc { |
| 75 | + // exclude internal implementation classes from the published API documentation |
| 76 | + exclude internalPackageGlob |
| 77 | + // The foundation module (AIC-2661) intentionally ships no public types yet, only |
| 78 | + // package-info.java. The javadoc tool reports "No public or protected classes found to |
| 79 | + // document" in that state, so we tolerate it here. TODO(AIC-2662): set failOnError = true |
| 80 | + // once the data-model public types land. |
| 81 | + failOnError = false |
| 82 | + options { |
| 83 | + // suppress noisy "no comment" warnings; checkstyle enforces Javadoc on the public surface |
| 84 | + addStringOption('Xdoclint:all,-missing', '-quiet') |
| 85 | + } |
| 86 | +} |
| 87 | + |
| 88 | +tasks.named('sourcesJar') { |
| 89 | + // keep internal implementation classes out of the published sources jar |
| 90 | + exclude internalPackageGlob |
| 91 | +} |
| 92 | + |
| 93 | +test { |
| 94 | + testLogging { |
| 95 | + events "passed", "skipped", "failed", "standardOut", "standardError" |
| 96 | + showStandardStreams = true |
| 97 | + exceptionFormat = 'full' |
| 98 | + } |
| 99 | +} |
| 100 | + |
| 101 | +jacoco { |
| 102 | + toolVersion = "0.8.11" |
| 103 | +} |
| 104 | + |
| 105 | +jacocoTestReport { |
| 106 | + reports { |
| 107 | + xml.required = true |
| 108 | + html.required = true |
| 109 | + } |
| 110 | +} |
| 111 | + |
| 112 | +checkstyle { |
| 113 | + toolVersion = "9.3" |
| 114 | + configFile = file("${project.rootDir}/checkstyle.xml") |
| 115 | +} |
| 116 | + |
| 117 | +idea { |
| 118 | + module { |
| 119 | + downloadJavadoc = true |
| 120 | + downloadSources = true |
| 121 | + } |
| 122 | +} |
| 123 | + |
| 124 | +publishing { |
| 125 | + publications { |
| 126 | + mavenJava(MavenPublication) { |
| 127 | + from components.java |
| 128 | + |
| 129 | + groupId = 'com.launchdarkly' |
| 130 | + artifactId = project.archivesBaseName |
| 131 | + |
| 132 | + pom { |
| 133 | + name = project.archivesBaseName |
| 134 | + description = 'LaunchDarkly Server-Side AI SDK for Java' |
| 135 | + url = 'https://github.com/launchdarkly/java-core' |
| 136 | + licenses { |
| 137 | + license { |
| 138 | + name = 'The Apache License, Version 2.0' |
| 139 | + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' |
| 140 | + } |
| 141 | + } |
| 142 | + developers { |
| 143 | + developer { |
| 144 | + name = 'LaunchDarkly' |
| 145 | + email = 'team@launchdarkly.com' |
| 146 | + } |
| 147 | + } |
| 148 | + scm { |
| 149 | + connection = 'scm:git:git://github.com/launchdarkly/java-core.git' |
| 150 | + developerConnection = 'scm:git:ssh:git@github.com:launchdarkly/java-core.git' |
| 151 | + url = 'https://github.com/launchdarkly/java-core' |
| 152 | + } |
| 153 | + } |
| 154 | + } |
| 155 | + } |
| 156 | + repositories { |
| 157 | + mavenLocal() |
| 158 | + } |
| 159 | +} |
| 160 | + |
| 161 | +nexusPublishing { |
| 162 | + clientTimeout = java.time.Duration.ofMinutes(2) // we've seen extremely long delays in creating repositories |
| 163 | + repositories { |
| 164 | + sonatype { |
| 165 | + nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/")) |
| 166 | + snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/")) |
| 167 | + } |
| 168 | + } |
| 169 | +} |
| 170 | + |
| 171 | +signing { |
| 172 | + sign publishing.publications.mavenJava |
| 173 | +} |
| 174 | + |
| 175 | +tasks.withType(Sign) { |
| 176 | + onlyIf { !"1".equals(project.findProperty("LD_SKIP_SIGNING")) } // so we can build jars for testing in CI |
| 177 | +} |
0 commit comments