diff --git a/graal/graal.bzl b/graal/graal.bzl index d9f0c5da..4d3fac92 100644 --- a/graal/graal.bzl +++ b/graal/graal.bzl @@ -52,6 +52,7 @@ def native_image( include_resources = None, reflection_configuration = None, jni_configuration = None, + serialization_configuration = None, initialize_at_build_time = [], initialize_at_run_time = [], native_features = [], @@ -79,6 +80,7 @@ def native_image( The special string `%target%`, if present, is replaced with `name`. include_resources: Glob to pass to `IncludeResources`. No default; optional. reflection_configuration: Reflection configuration file. No default; optional. + serialization_configuration: Serialization configuration file. No default; optional. jni_configuration: JNI configuration file. No default; optional. initialize_at_build_time: Classes or patterns to pass to `--initialize-at-build-time`. No default; optional. initialize_at_run_time: Classes or patterns to pass to `--initialize-at-run-time`. No default; optional. @@ -108,6 +110,7 @@ def native_image( include_resources = include_resources, reflection_configuration = reflection_configuration, jni_configuration = jni_configuration, + serialization_configuration = serialization_configuration, initialize_at_build_time = initialize_at_build_time, initialize_at_run_time = initialize_at_run_time, native_features = native_features, @@ -136,6 +139,7 @@ def graal_binary( include_resources = None, reflection_configuration = None, jni_configuration = None, + serialization_configuration = None, initialize_at_build_time = [], initialize_at_run_time = [], native_features = [], @@ -163,6 +167,7 @@ def graal_binary( The special string `%target%`, if present, is replaced with `name`. include_resources: Glob to pass to `IncludeResources`. No default; optional. reflection_configuration: Reflection configuration file. No default; optional. + serialization_configuration: Serialization configuration file. No default; optional. jni_configuration: JNI configuration file. No default; optional. initialize_at_build_time: Classes or patterns to pass to `--initialize-at-build-time`. No default; optional. initialize_at_run_time: Classes or patterns to pass to `--initialize-at-run-time`. No default; optional. @@ -192,6 +197,7 @@ def graal_binary( include_resources = include_resources, reflection_configuration = reflection_configuration, jni_configuration = jni_configuration, + serialization_configuration = serialization_configuration, initialize_at_build_time = initialize_at_build_time, initialize_at_run_time = initialize_at_run_time, native_features = native_features, diff --git a/internal/native_image/builder.bzl b/internal/native_image/builder.bzl index fc3225b5..098e9399 100644 --- a/internal/native_image/builder.bzl +++ b/internal/native_image/builder.bzl @@ -125,6 +125,10 @@ def _configure_reflection(ctx, args, direct_inputs): direct_inputs.append(ctx.file.jni_configuration) args.add("-H:+JNI") + if ctx.attr.serialization_configuration != None: + args.add(ctx.file.serialization_configuration, format = "-H:SerializationConfigurationFiles=%s") + direct_inputs.append(ctx.file.serialization_configuration) + def _configure_native_compiler(ctx, args, c_compiler_path, gvm_toolchain): """Configure native compiler and linker flags for a Native Image build. diff --git a/internal/native_image/common.bzl b/internal/native_image/common.bzl index c4868306..dc6e3f7d 100644 --- a/internal/native_image/common.bzl +++ b/internal/native_image/common.bzl @@ -65,6 +65,10 @@ _NATIVE_IMAGE_ATTRS = { mandatory = False, allow_single_file = True, ), + "serialization_configuration": attr.label( + mandatory = False, + allow_single_file = True, + ), "debug": attr.bool( mandatory = False, default = False,