Skip to content

Commit dcfef21

Browse files
authored
Add x_suppress_warning to kotlinc options (#1306)
1 parent f446484 commit dcfef21

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

docs/kotlin.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,8 @@ kt_kotlinc_options(<a href="#kt_kotlinc_options-name">name</a>, <a href="#kt_kot
387387
<a href="#kt_kotlinc_options-x_lambdas">x_lambdas</a>, <a href="#kt_kotlinc_options-x_multi_platform">x_multi_platform</a>, <a href="#kt_kotlinc_options-x_no_call_assertions">x_no_call_assertions</a>, <a href="#kt_kotlinc_options-x_no_optimize">x_no_optimize</a>,
388388
<a href="#kt_kotlinc_options-x_no_param_assertions">x_no_param_assertions</a>, <a href="#kt_kotlinc_options-x_no_receiver_assertions">x_no_receiver_assertions</a>, <a href="#kt_kotlinc_options-x_no_source_debug_extension">x_no_source_debug_extension</a>,
389389
<a href="#kt_kotlinc_options-x_optin">x_optin</a>, <a href="#kt_kotlinc_options-x_report_perf">x_report_perf</a>, <a href="#kt_kotlinc_options-x_sam_conversions">x_sam_conversions</a>, <a href="#kt_kotlinc_options-x_skip_prerelease_check">x_skip_prerelease_check</a>,
390-
<a href="#kt_kotlinc_options-x_suppress_version_warnings">x_suppress_version_warnings</a>, <a href="#kt_kotlinc_options-x_type_enhancement_improvements_strict_mode">x_type_enhancement_improvements_strict_mode</a>,
391-
<a href="#kt_kotlinc_options-x_use_fir_lt">x_use_fir_lt</a>, <a href="#kt_kotlinc_options-x_use_k2">x_use_k2</a>)
390+
<a href="#kt_kotlinc_options-x_suppress_version_warnings">x_suppress_version_warnings</a>, <a href="#kt_kotlinc_options-x_suppress_warning">x_suppress_warning</a>,
391+
<a href="#kt_kotlinc_options-x_type_enhancement_improvements_strict_mode">x_type_enhancement_improvements_strict_mode</a>, <a href="#kt_kotlinc_options-x_use_fir_lt">x_use_fir_lt</a>, <a href="#kt_kotlinc_options-x_use_k2">x_use_k2</a>)
392392
</pre>
393393

394394
Define kotlin compiler options.
@@ -427,6 +427,7 @@ Define kotlin compiler options.
427427
| <a id="kt_kotlinc_options-x_sam_conversions"></a>x_sam_conversions | Change codegen behavior of SAM/functional interfaces | String | optional | `"class"` |
428428
| <a id="kt_kotlinc_options-x_skip_prerelease_check"></a>x_skip_prerelease_check | Suppress errors thrown when using pre-release classes. | Boolean | optional | `False` |
429429
| <a id="kt_kotlinc_options-x_suppress_version_warnings"></a>x_suppress_version_warnings | Suppress warnings about outdated, inconsistent, or experimental language or API versions. | Boolean | optional | `False` |
430+
| <a id="kt_kotlinc_options-x_suppress_warning"></a>x_suppress_warning | Suppress specific warnings globally | List of strings | optional | `[]` |
430431
| <a id="kt_kotlinc_options-x_type_enhancement_improvements_strict_mode"></a>x_type_enhancement_improvements_strict_mode | Enables strict mode for type enhancement improvements, enforcing stricter type checking and enhancements. | Boolean | optional | `False` |
431432
| <a id="kt_kotlinc_options-x_use_fir_lt"></a>x_use_fir_lt | Compile using LightTree parser with Front-end IR. Warning: this feature is far from being production-ready | Boolean | optional | `False` |
432433
| <a id="kt_kotlinc_options-x_use_k2"></a>x_use_k2 | Compile using experimental K2. K2 is a new compiler pipeline, no compatibility guarantees are yet provided | Boolean | optional | `False` |

src/main/starlark/core/options/opts.javac.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ _JOPTS = {
9090
"add_exports": struct(
9191
args = dict(
9292
default = [],
93-
doc = "Export internal jdk apis ",
93+
doc = "Export internal jdk apis",
9494
),
9595
type = attr.string_list,
9696
value_to_flag = {

src/main/starlark/core/options/opts.kotlinc.bzl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
load("@com_github_jetbrains_kotlin//:capabilities.bzl", _KOTLIN_OPTS = "KOTLIN_OPTS")
1616
load("//src/main/starlark/core/options:convert.bzl", "convert")
17+
load("//src/main/starlark/core/options:derive.bzl", "derive")
1718

1819
def _map_optin_class_to_flag(values):
1920
return ["-opt-in=%s" % v for v in values]
@@ -429,6 +430,16 @@ _KOPTS_ALL = {
429430
value_to_flag = None,
430431
map_value_to_flag = _map_jdk_release_to_flag,
431432
),
433+
"x_suppress_warning": struct(
434+
args = dict(
435+
default = [],
436+
doc = "Suppress specific warnings globally",
437+
),
438+
type = attr.string_list,
439+
value_to_flag = {
440+
derive.info: derive.repeated_values_for("-Xsuppress-warning="),
441+
},
442+
),
432443
}
433444

434445
def _merge(key, rule_defined):

0 commit comments

Comments
 (0)