Skip to content

Conversation

ddobrin
Copy link
Collaborator

@ddobrin ddobrin commented Oct 7, 2025

This commit contains the native image configuration work for the java-genai library: tracks 1.21.0-SNAPSHOT

• Native Image Reflection Configuration

  • Added comprehensive reflection metadata for all 346 type classes in com.google.genai.types package
  • Registered all AutoValue generated classes and their Builders
  • Added reflection support for 43 main package classes including Models, ResponseStream, and other core API classes
  • Total: ~10,242 lines of reflection configuration

• Test Infrastructure

  • Created NativeImageReflectionTest.java to exercise builder types and ensure reflection metadata capture
  • Added test methods for AutoValue builders and JSON deserialization

• Build Configuration

  • Updated pom.xml with native-maven-plugin and native-tests profile
  • Configured agent for native-image metadata generation
  • Added agentlib configuration for test execution

• Native Image Metadata Files

  • reflect-config.json - Comprehensive reflection metadata with allDeclaredMethods for all types
  • jni-config.json - JNI access configuration
  • proxy-config.json - Dynamic proxy configuration
  • resource-config.json - Resource inclusion patterns
  • serialization-config.json - Serialization support

• Scripts & Tooling

  • Created shell scripts for generating reflection configurations automatically

This commit enables the java-genai library to work correctly in GraalVM native image applications by providing all necessary reflection, JNI, and resource metadata.

Test app to use the native image:
https://github.com/ddobrin/ai-native

@nireekshak nireekshak self-assigned this Oct 21, 2025
@nireekshak
Copy link

Hi @ddobrin,
Thanks for your contributions!
We noticed that the checks have failed. Could you please review and update the PR so we can proceed further?
Appreciate your support on this.

@nireekshak nireekshak added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. status:awaiting user response labels Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:awaiting user response type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants