Skip to content

Commit b9974f4

Browse files
ctawiahcursoragent
andcommitted
feat: scaffold LaunchDarkly Java AI SDK module foundation (AIC-2661)
Stand up the new lib/java-server-sdk-ai Gradle module with the same build, quality-gate, and release machinery as sibling modules, so later steps land on a CI-enforced base. No SDK behavior yet. - java-library module, Java 8 source/target, checkstyle + jacoco quality gates - api dependency on launchdarkly-java-server-sdk; jmustache for interpolation - internal package excluded from published Javadoc/sources jars - CI workflow over JDK 8/11/17 matrix via shared composite action - registered in release-please manifest/config at 0.1.0 jmustache audit: com.samskivert:jmustache:1.16, BSD 2-Clause, no transitive runtime deps, actively maintained -> approved. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 2eefa47 commit b9974f4

16 files changed

Lines changed: 657 additions & 0 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: java-server-sdk-ai
2+
3+
on:
4+
push:
5+
branches: [main, 'feat/**']
6+
paths-ignore:
7+
- '**.md' #Do not need to run CI for markdown changes.
8+
pull_request:
9+
branches: [main, 'feat/**']
10+
paths-ignore:
11+
- '**.md'
12+
13+
jobs:
14+
build-test-java-server-sdk-ai:
15+
strategy:
16+
matrix:
17+
java-version: [8, 11, 17]
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v3
21+
22+
- name: Shared CI Steps
23+
uses: ./.github/actions/ci
24+
with:
25+
workspace_path: 'lib/java-server-sdk-ai'
26+
java_version: ${{ matrix.java-version }}

.release-please-manifest.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"lib/java-server-sdk-ai": "0.1.0",
23
"lib/java-server-sdk-otel": "0.2.0",
34
"lib/java-server-sdk-redis-store": "3.1.1",
45
"lib/shared/common": "2.4.0",
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#
2+
# https://help.github.com/articles/dealing-with-line-endings/
3+
#
4+
# Linux start script should use lf
5+
/gradlew text eol=lf
6+
7+
# These are Windows script files and should use crlf
8+
*.bat text eol=crlf
9+

lib/java-server-sdk-ai/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Ignore Gradle project-specific cache directory
2+
.gradle
3+
4+
# Ignore Gradle build output directory
5+
build
6+
bin
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Change log
2+
3+
All notable changes to the LaunchDarkly Server-Side AI SDK for Java will be documented in this file.
4+
This project adheres to [Semantic Versioning](http://semver.org).

lib/java-server-sdk-ai/README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# LaunchDarkly Server-Side AI SDK for Java
2+
3+
[![Circle CI](https://img.shields.io/badge/status-in%20development-orange)](https://github.com/launchdarkly/java-core)
4+
5+
> **Status:** In active development toward `v1.0.0`. APIs are not yet stable.
6+
7+
This library provides LaunchDarkly AI Config support for the LaunchDarkly Server-Side SDK for Java.
8+
It is built on top of [`launchdarkly-java-server-sdk`](https://github.com/launchdarkly/java-core/tree/main/lib/sdk/server)
9+
and lets you retrieve, interpolate, and track AI Configs (models, providers, messages, agents, and judges)
10+
managed in the LaunchDarkly dashboard.
11+
12+
## Supported Java versions
13+
14+
This library has a minimum Java version of 8.
15+
16+
## Getting started
17+
18+
This module is part of the [`java-core`](https://github.com/launchdarkly/java-core) monorepo and is
19+
published to Maven Central as `com.launchdarkly:launchdarkly-java-server-sdk-ai`.
20+
21+
Full usage documentation, including AI Config retrieval, tracking, and manual judge evaluation, will be
22+
added as the SDK is built out (see epic AIC-2629).
23+
24+
## Internal API convention
25+
26+
Public, supported types live directly under `com.launchdarkly.sdk.server.ai` (and its documented
27+
subpackages). Anything under `com.launchdarkly.sdk.server.ai.internal` is implementation detail: it is
28+
**not** part of the supported API, is excluded from the published Javadoc and sources jars, and may
29+
change without notice.
30+
31+
## Contributing
32+
33+
We encourage pull requests and other contributions from the community. Check out our
34+
[contributing guidelines](../../CONTRIBUTING.md) for instructions on how to contribute.
35+
36+
## About LaunchDarkly
37+
38+
LaunchDarkly is a feature management platform that serves trillions of feature flags daily to help teams
39+
build better software, faster. [Get started](https://launchdarkly.com) using LaunchDarkly today!
Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
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+
// jmustache: lightweight Mustache implementation used for AI Config message/instruction
49+
// interpolation. Dependency audit (AIC-2661): BSD 2-Clause license, actively maintained,
50+
// ships as a single self-contained jar with no transitive runtime dependencies.
51+
"jmustache": "1.16"
52+
]
53+
54+
ext.libraries = [:]
55+
56+
dependencies {
57+
// Exposed on the public API surface (LDClientInterface), therefore `api` not `implementation`.
58+
api "com.launchdarkly:launchdarkly-java-server-sdk:${versions.sdk}"
59+
60+
// Templating engine for Mustache interpolation. Kept as `implementation` so it is not
61+
// leaked onto consumers' compile classpath.
62+
implementation "com.samskivert:jmustache:${versions.jmustache}"
63+
64+
testImplementation "org.hamcrest:hamcrest-all:1.3"
65+
testImplementation "junit:junit:4.13.2"
66+
testImplementation "org.mockito:mockito-core:3.12.4"
67+
}
68+
69+
// Non-public implementation detail lives in `com.launchdarkly.sdk.server.ai.internal` and its
70+
// subpackages. We deliberately exclude it from the published Javadoc and sources jars so it is
71+
// not part of the supported, documented surface. See package-info / README for the convention.
72+
def internalPackageGlob = "**/com/launchdarkly/sdk/server/ai/internal/**"
73+
74+
java {
75+
withJavadocJar()
76+
withSourcesJar()
77+
}
78+
79+
javadoc {
80+
// exclude internal implementation classes from the published API documentation
81+
exclude internalPackageGlob
82+
// The foundation module (AIC-2661) intentionally ships no public types yet, only
83+
// package-info.java. The javadoc tool reports "No public or protected classes found to
84+
// document" in that state, so we tolerate it here. TODO(AIC-2662): set failOnError = true
85+
// once the data-model public types land.
86+
failOnError = false
87+
options {
88+
// suppress noisy "no comment" warnings; checkstyle enforces Javadoc on the public surface
89+
addStringOption('Xdoclint:all,-missing', '-quiet')
90+
}
91+
}
92+
93+
tasks.named('sourcesJar') {
94+
// keep internal implementation classes out of the published sources jar
95+
exclude internalPackageGlob
96+
}
97+
98+
test {
99+
testLogging {
100+
events "passed", "skipped", "failed", "standardOut", "standardError"
101+
showStandardStreams = true
102+
exceptionFormat = 'full'
103+
}
104+
}
105+
106+
jacoco {
107+
toolVersion = "0.8.11"
108+
}
109+
110+
jacocoTestReport {
111+
reports {
112+
xml.required = true
113+
html.required = true
114+
}
115+
}
116+
117+
checkstyle {
118+
toolVersion = "9.3"
119+
configFile = file("${project.rootDir}/checkstyle.xml")
120+
}
121+
122+
idea {
123+
module {
124+
downloadJavadoc = true
125+
downloadSources = true
126+
}
127+
}
128+
129+
publishing {
130+
publications {
131+
mavenJava(MavenPublication) {
132+
from components.java
133+
134+
groupId = 'com.launchdarkly'
135+
artifactId = project.archivesBaseName
136+
137+
pom {
138+
name = project.archivesBaseName
139+
description = 'LaunchDarkly Server-Side AI SDK for Java'
140+
url = 'https://github.com/launchdarkly/java-core'
141+
licenses {
142+
license {
143+
name = 'The Apache License, Version 2.0'
144+
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
145+
}
146+
}
147+
developers {
148+
developer {
149+
name = 'LaunchDarkly'
150+
email = 'team@launchdarkly.com'
151+
}
152+
}
153+
scm {
154+
connection = 'scm:git:git://github.com/launchdarkly/java-core.git'
155+
developerConnection = 'scm:git:ssh:git@github.com:launchdarkly/java-core.git'
156+
url = 'https://github.com/launchdarkly/java-core'
157+
}
158+
}
159+
}
160+
}
161+
repositories {
162+
mavenLocal()
163+
}
164+
}
165+
166+
nexusPublishing {
167+
clientTimeout = java.time.Duration.ofMinutes(2) // we've seen extremely long delays in creating repositories
168+
repositories {
169+
sonatype {
170+
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
171+
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
172+
}
173+
}
174+
}
175+
176+
signing {
177+
sign publishing.publications.mavenJava
178+
}
179+
180+
tasks.withType(Sign) {
181+
onlyIf { !"1".equals(project.findProperty("LD_SKIP_SIGNING")) } // so we can build jars for testing in CI
182+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0"?>
2+
<!DOCTYPE module PUBLIC
3+
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
4+
"https://checkstyle.org/dtds/configuration_1_3.dtd">
5+
<module name="Checker">
6+
<module name="TreeWalker">
7+
<module name="JavadocMethod">
8+
<property name="accessModifiers" value="public"/>
9+
</module>
10+
<module name="JavadocType">
11+
<property name="scope" value="public"/>
12+
</module>
13+
</module>
14+
</module>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#x-release-please-start-version
2+
version=0.1.0
3+
#x-release-please-end
4+
5+
# The following empty ossrh properties are used by LaunchDarkly's internal integration testing framework
6+
# and should not be needed for typical development purposes (including by third-party developers).
7+
sonatypeUsername=
8+
sonatypePassword=
60.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)