Skip to content

feature: [172] Implement native image build#178

Open
crazyrokr wants to merge 18 commits into
developfrom
feature/172-implement-native-build
Open

feature: [172] Implement native image build#178
crazyrokr wants to merge 18 commits into
developfrom
feature/172-implement-native-build

Conversation

@crazyrokr

@crazyrokr crazyrokr commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

Issue

#172

Description

This PR introduces GraalVM native image build support for the MQTT Broker, enabling it to be compiled into a standalone native executable. The changes rework resource loading throughout the codebase to use InputStream-based APIs instead of direct filesystem Path access, which is essential for native images where resources must be resolved from the embedding classpath rather than the filesystem.

Changes

GraalVM Native Build Setup

  • Created a dedicated native-image module that depends on application and hosts native image configuration, metadata
  • Configured AOT processing with all feature flags enabled (file credentials, basic auth, external TLS)
  • Added reachability-metadata.json: provides GraalVM with reflection, resource, and serialization configuration needed for the native binary

Resource Loading Refactoring

  • ClassPathResourceResolver: Resolves URIs to InputStream, supporting both classpath: scheme and file: URIs. Falls back from direct filesystem access to ClassLoader.getResourceAsStream() for classpath resources - bridging the gap between JVM and native image resource resolution
  • UriLoaderAuthorizationService: Replaced Path-based loading with InputStream-based loading via ClassPathResourceResolver, adds try-with-resources for proper stream lifecycle

@crazyrokr crazyrokr self-assigned this Jun 20, 2026
@crazyrokr crazyrokr added the enhancement New feature or request label Jun 20, 2026
@crazyrokr crazyrokr linked an issue Jun 20, 2026 that may be closed by this pull request
@github-actions

github-actions Bot commented Jun 20, 2026

Copy link
Copy Markdown

Test Coverage Report

Overall Project 85.59% -0.1% 🍏
Files changed 85.56% 🍏

File Coverage
AclRulesLoader.groovy 100% 🍏
AclRulesLoader.java 100% 🍏
FileCredentialsSource.java 93.33% 🍏
UriLoaderAuthorizationService.java 88.71% -11.29%
ClassPathResourceResolver.java 88.24% -11.76% 🍏
TlsMqttConnection.java 83.77% 🍏

@crazyrokr crazyrokr marked this pull request as ready for review June 20, 2026 17:41
@crazyrokr crazyrokr changed the title Feature/172 implement native build feature: [172] Implement native image build Jun 21, 2026
@crazyrokr crazyrokr requested a review from JavaSaBr June 21, 2026 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Native Build

1 participant