Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds the proxy configuration file flag #309

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions graalvm/nativeimage/rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def native_image(
native_image_tool = None, # uses toolchains by default
native_image_settings = [_DEFAULT_NATIVE_IMAGE_SETTINGS],
resource_configuration = None,
proxy_configuration = None,
profiles = [],
**kwargs):
"""Generates and compiles a GraalVM native image from a Java library target.
Expand Down Expand Up @@ -117,6 +118,7 @@ def native_image(
native_image_settings: Suite(s) of Native Image build settings to use.
profiles: Profiles to use for profile-guided optimization (PGO) and obtained from a native image compiled with `--pgo-instrument`.
resource_configuration: Resource configuration file. No default; optional.
proxy_configuration: Proxy configuration file. No default; optional.
**kwargs: Extra keyword arguments are passed to the underlying `native_image` rule.
"""

Expand Down Expand Up @@ -144,5 +146,6 @@ def native_image(
native_image_settings = native_image_settings,
profiles = profiles,
resource_configuration = resource_configuration,
proxy_configuration = proxy_configuration,
**kwargs
)
16 changes: 16 additions & 0 deletions internal/native_image/builder.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@ def _configure_optimization_mode(ctx, args):
format = "-O%s",
)

def _configure_proxy(ctx, args, direct_inputs):
"""Configure proxy settings for a Native Image build.

Args:
ctx: Context of the Native Image rule implementation.
args: Args builder for the Native Image build.
direct_inputs: Direct Native Image build action inputs.

"""
if ctx.attr.proxy_configuration != None:
args.add(ctx.file.proxy_configuration, format = "-H:DynamicProxyConfigurationFiles=%s")
direct_inputs.append(ctx.file.proxy_configuration)

def _configure_resources(ctx, args, direct_inputs):
"""Configure resource settings for a Native Image build.

Expand Down Expand Up @@ -221,6 +234,9 @@ def assemble_native_build_options(
# configure resources
_configure_resources(ctx, args, direct_inputs)

# configure proxy
_configure_proxy(ctx, args, direct_inputs)

# if a static build is being performed against hermetic zlib, configure it
if ctx.attr.static_zlib != None:
_configure_static_zlib_compile(
Expand Down
4 changes: 4 additions & 0 deletions internal/native_image/common.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ _NATIVE_IMAGE_ATTRS = {
mandatory = False,
allow_single_file = True,
),
"proxy_configuration": attr.label(
mandatory = False,
allow_single_file = True,
),
"_cc_toolchain": attr.label(
default = Label(_BAZEL_CURRENT_CPP_TOOLCHAIN),
),
Expand Down
Loading