From b52e5e944853271e29b2c5fdef4c9c2d8dffeb09 Mon Sep 17 00:00:00 2001 From: Corbin McNeely-Smith Date: Fri, 3 Nov 2023 14:59:39 -0500 Subject: [PATCH 1/2] [options] Add exports and fix readme --- README.md | 14 +++++++------- src/main/starlark/core/options/opts.javac.bzl | 10 ++++++++++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 15f7ab913..7853aeb1d 100644 --- a/README.md +++ b/README.md @@ -203,13 +203,13 @@ load("@rules_kotlin//kotlin:core.bzl", "kt_kotlinc_options", "kt_javac_options", kt_kotlinc_options( name = "kt_kotlinc_options", - kotlinc_opts = ["-Xno-param-assertions"], + x_no_param_assertions = True, jvm_target = "1.8", ) kt_javac_options( name = "kt_javac_options", - javac_opts = ["-nowarn"], + warn = "off", ) define_kt_toolchain( @@ -230,16 +230,16 @@ load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") kt_kotlinc_options( name = "kt_kotlinc_options_for_package_name", - kotlinc_opts = [ - "-Xno-param-assertions", - "-Xopt-in=kotlin.Experimental", - "-Xopt-in=kotlin.ExperimentalStdlibApi", + x_no_param_assertions = True, + x_optin = [ + "kotlin.Experimental", + "kotlin.ExperimentalStdlibApi", ], ) kt_javac_options( name = "kt_javac_options_for_package_name", - javac_opts = ["-nowarn"], + warn = "off" ) kt_jvm_library( diff --git a/src/main/starlark/core/options/opts.javac.bzl b/src/main/starlark/core/options/opts.javac.bzl index 782ddad46..a6c852b91 100644 --- a/src/main/starlark/core/options/opts.javac.bzl +++ b/src/main/starlark/core/options/opts.javac.bzl @@ -87,6 +87,16 @@ _JOPTS = { "strict": ["-Xexplicit-api=strict"], }, ), + "add_exports": struct( + args = dict( + default = [], + doc = "Export internal jdk apis ", + ), + type = attr.string_list, + value_to_flag = { + derive.info: derive.repeated_values_for("--add-exports="), + }, + ), } def _javac_options_impl(ctx): From 0bd641e5f5d4ce7daf998e46861579db984bcaeb Mon Sep 17 00:00:00 2001 From: Corbin McNeely-Smith Date: Fri, 10 Nov 2023 15:21:05 -0600 Subject: [PATCH 2/2] Update docs --- docs/kotlin.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/kotlin.md b/docs/kotlin.md index 814e52dec..aaa1b9ba7 100755 --- a/docs/kotlin.md +++ b/docs/kotlin.md @@ -48,8 +48,8 @@ kt_js_library(name, name, release, warn, x_ep_disable_all_checks, x_explicit_api_mode, x_lint, - xd_suppress_notes) +kt_javac_options(name, add_exports, release, warn, x_ep_disable_all_checks, x_explicit_api_mode, + x_lint, xd_suppress_notes) Define java compiler options for `kt_jvm_*` rules with java sources. @@ -61,6 +61,7 @@ kt_javac_options(name, name | A unique name for this target. | Name | required | | +|add_exports | Export internal jdk apis | List of strings | optional | [] | |release | Compile for the specified Java SE release | String | optional | "default" | |warn | Control warning behaviour. | String | optional | "report" | |x_ep_disable_all_checks | See javac -XepDisableAllChecks documentation | Boolean | optional | False | @@ -369,8 +370,8 @@ kt_compiler_plugin(name, name, release, warn, x_ep_disable_all_checks, x_explicit_api_mode, x_lint, - xd_suppress_notes) +kt_javac_options(name, add_exports, release, warn, x_ep_disable_all_checks, x_explicit_api_mode, + x_lint, xd_suppress_notes) Define java compiler options for `kt_jvm_*` rules with java sources. @@ -382,6 +383,7 @@ kt_javac_options(name, name | A unique name for this target. | Name | required | | +|add_exports | Export internal jdk apis | List of strings | optional | [] | |release | Compile for the specified Java SE release | String | optional | "default" | |warn | Control warning behaviour. | String | optional | "report" | |x_ep_disable_all_checks | See javac -XepDisableAllChecks documentation | Boolean | optional | False |