Skip to content

Commit

Permalink
[options] Add exports and fix readme (#1068)
Browse files Browse the repository at this point in the history
* [options] Add exports and fix readme

* Update docs
  • Loading branch information
restingbull authored Nov 10, 2023
1 parent b7a2484 commit bc90033
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand Down
10 changes: 6 additions & 4 deletions docs/kotlin.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ kt_js_library(<a href="#kt_js_library-name">name</a>, <a href="#kt_js_library-kw

## kt_javac_options

kt_javac_options(<a href="#kt_javac_options-name">name</a>, <a href="#kt_javac_options-release">release</a>, <a href="#kt_javac_options-warn">warn</a>, <a href="#kt_javac_options-x_ep_disable_all_checks">x_ep_disable_all_checks</a>, <a href="#kt_javac_options-x_explicit_api_mode">x_explicit_api_mode</a>, <a href="#kt_javac_options-x_lint">x_lint</a>,
<a href="#kt_javac_options-xd_suppress_notes">xd_suppress_notes</a>)
kt_javac_options(<a href="#kt_javac_options-name">name</a>, <a href="#kt_javac_options-add_exports">add_exports</a>, <a href="#kt_javac_options-release">release</a>, <a href="#kt_javac_options-warn">warn</a>, <a href="#kt_javac_options-x_ep_disable_all_checks">x_ep_disable_all_checks</a>, <a href="#kt_javac_options-x_explicit_api_mode">x_explicit_api_mode</a>,
<a href="#kt_javac_options-x_lint">x_lint</a>, <a href="#kt_javac_options-xd_suppress_notes">xd_suppress_notes</a>)

Define java compiler options for `kt_jvm_*` rules with java sources.
Expand All @@ -61,6 +61,7 @@ kt_javac_options(<a href="#kt_javac_options-name">name</a>, <a href="#kt_javac_o
| Name | Description | Type | Mandatory | Default |
| :------------- | :------------- | :------------- | :------------- | :------------- |
|<a id="kt_javac_options-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
|<a id="kt_javac_options-add_exports"></a>add_exports | Export internal jdk apis | List of strings | optional | [] |
|<a id="kt_javac_options-release"></a>release | Compile for the specified Java SE release | String | optional | "default" |
|<a id="kt_javac_options-warn"></a>warn | Control warning behaviour. | String | optional | "report" |
|<a id="kt_javac_options-x_ep_disable_all_checks"></a>x_ep_disable_all_checks | See javac -XepDisableAllChecks documentation | Boolean | optional | False |
Expand Down Expand Up @@ -369,8 +370,8 @@ kt_compiler_plugin(<a href="#kt_compiler_plugin-name">name</a>, <a href="#kt_com

## kt_javac_options

kt_javac_options(<a href="#kt_javac_options-name">name</a>, <a href="#kt_javac_options-release">release</a>, <a href="#kt_javac_options-warn">warn</a>, <a href="#kt_javac_options-x_ep_disable_all_checks">x_ep_disable_all_checks</a>, <a href="#kt_javac_options-x_explicit_api_mode">x_explicit_api_mode</a>, <a href="#kt_javac_options-x_lint">x_lint</a>,
<a href="#kt_javac_options-xd_suppress_notes">xd_suppress_notes</a>)
kt_javac_options(<a href="#kt_javac_options-name">name</a>, <a href="#kt_javac_options-add_exports">add_exports</a>, <a href="#kt_javac_options-release">release</a>, <a href="#kt_javac_options-warn">warn</a>, <a href="#kt_javac_options-x_ep_disable_all_checks">x_ep_disable_all_checks</a>, <a href="#kt_javac_options-x_explicit_api_mode">x_explicit_api_mode</a>,
<a href="#kt_javac_options-x_lint">x_lint</a>, <a href="#kt_javac_options-xd_suppress_notes">xd_suppress_notes</a>)

Define java compiler options for `kt_jvm_*` rules with java sources.
Expand All @@ -382,6 +383,7 @@ kt_javac_options(<a href="#kt_javac_options-name">name</a>, <a href="#kt_javac_o
| Name | Description | Type | Mandatory | Default |
| :------------- | :------------- | :------------- | :------------- | :------------- |
|<a id="kt_javac_options-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
|<a id="kt_javac_options-add_exports"></a>add_exports | Export internal jdk apis | List of strings | optional | [] |
|<a id="kt_javac_options-release"></a>release | Compile for the specified Java SE release | String | optional | "default" |
|<a id="kt_javac_options-warn"></a>warn | Control warning behaviour. | String | optional | "report" |
|<a id="kt_javac_options-x_ep_disable_all_checks"></a>x_ep_disable_all_checks | See javac -XepDisableAllChecks documentation | Boolean | optional | False |
Expand Down
10 changes: 10 additions & 0 deletions src/main/starlark/core/options/opts.javac.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit bc90033

Please sign in to comment.