Skip to content

Commit

Permalink
Add warning as error to the warn option.
Browse files Browse the repository at this point in the history
Matches Gradle's equivalent option (AllWarningsAsErrors).
  • Loading branch information
Kernald authored Nov 17, 2020
1 parent 4811a43 commit b7f5832
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
8 changes: 6 additions & 2 deletions kotlin/internal/jvm/compile.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,10 @@ def _kotlinc_options_provider_to_flags(opts):
if not opts:
return ""
flags = []
if not opts.warn:
if opts.warn == "off":
flags.append("-nowarn")
elif opts.warn == "error":
flags.append("-Werror")
if opts.x_use_experimental:
flags.append("-Xuse-experimental=kotlin.Experimental")
if opts.x_use_ir:
Expand All @@ -354,8 +356,10 @@ def _javac_options_provider_to_flags(opts):
if not opts:
return ""
flags = []
if not opts.warn:
if opts.warn == "off":
flags.append("-nowarn")
elif opts.warn == "error":
flags.append("-Werror")
if opts.x_ep_disable_all_checks:
flags.append("-XepDisableAllChecks")
if opts.x_lint:
Expand Down
14 changes: 8 additions & 6 deletions kotlin/internal/opts.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
_KOPTS = {
"warn": struct(
args = dict(
default = True,
doc = "Enable or disable compiler warnings.",
default = "report",
doc = "Control warning behaviour.",
values = ["off", "report", "error"],
),
type = attr.bool,
type = attr.string,
),
"x_use_experimental": struct(
args = dict(
Expand Down Expand Up @@ -77,10 +78,11 @@ kt_kotlinc_options = rule(
_JOPTS = {
"warn": struct(
args = dict(
default = True,
doc = "Enable or disable compiler warnings.",
default = "report",
doc = "Control warning behaviour.",
values = ["off", "report", "error"],
),
type = attr.bool,
type = attr.string,
),
"x_ep_disable_all_checks": struct(
args = dict(
Expand Down

0 comments on commit b7f5832

Please sign in to comment.