Skip to content

Commit

Permalink
Add javac_option to pass release flag to javac
Browse files Browse the repository at this point in the history
  • Loading branch information
cheister committed Oct 31, 2023
1 parent cfe427b commit 547a623
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion kotlin/internal/jvm/compile.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ def _run_kt_java_builder_actions(
# If there is Java source or KAPT generated Java source compile that Java and fold it into
# the final ABI jar. Otherwise just use the KT ABI jar as final ABI jar.
if srcs.java or generated_kapt_src_jars or srcs.src_jars:
javac_opts = javac_options_to_flags(toolchains.kt.javac_options)
javac_opts = javac_options_to_flags(ctx.attr.javac_opts[JavacOptions] if ctx.attr.javac_opts else toolchains.kt.javac_options)

# Kotlin takes care of annotation processing. Note that JavaBuilder "discovers"
# annotation processors in `deps` also.
Expand Down
15 changes: 15 additions & 0 deletions src/main/starlark/core/options/opts.javac.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,21 @@ _JOPTS = {
"report": None,
},
),
"release": struct(
args = dict(
default = "default",
doc = "Compile for the specified Java SE release",
values = ["default", "8", "11", "17", "21"],
),
type = attr.string,
value_to_flag = {
"8": ["--release 8"],
"11": ["--release 11"],
"17": ["--release 17"],
"21": ["--release 21"],
"default": None,
},
),
"x_ep_disable_all_checks": struct(
args = dict(
default = False,
Expand Down

0 comments on commit 547a623

Please sign in to comment.