Skip to content

Commit 1c26e2b

Browse files
committed
Adding support for debuggable flag to override default Bazel behavior. See bazelbuild/bazel#13801
1 parent 9da5f1e commit 1c26e2b

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

rules/flags/flags.bzl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,7 @@ def native_bool_flag_macro(name, description):
9191
)
9292

9393
def _get_bool(v):
94-
v = v.lower()
95-
if v == "true":
96-
return True
97-
if v == "false":
98-
return False
99-
fail("Unknown bool: " + v)
94+
return utils.get_bool(v)
10095

10196
def _bool_impl(ctx):
10297
if ctx.label.name in ctx.var:

rules/resources.bzl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,7 @@ def _package(
747747
resource_files_zip = ctx.actions.declare_file(
748748
"_migrated/" + ctx.label.name + "_files/resource_files.zip",
749749
)
750+
debug = utils.get_bool(manifest_values["debuggable"]) if "debuggable" in manifest_values else None
750751
_busybox.package(
751752
ctx,
752753
out_file = resource_apk,
@@ -785,7 +786,7 @@ def _package(
785786
aapt = aapt,
786787
busybox = busybox,
787788
host_javabase = host_javabase,
788-
debug = compilation_mode != _compilation_mode.OPT,
789+
debug = compilation_mode != _compilation_mode.OPT if debug == None else debug,
789790
should_throw_on_conflict = should_throw_on_conflict,
790791
)
791792

rules/utils.bzl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,14 @@ def _get_compilation_mode(ctx):
441441
"""
442442
return ctx.var["COMPILATION_MODE"]
443443

444+
def _get_bool(v):
445+
v = v.lower()
446+
if v == "true":
447+
return True
448+
if v == "false":
449+
return False
450+
fail("Unknown bool: " + v)
451+
444452
compilation_mode = struct(
445453
DBG = "dbg",
446454
FASTBUILD = "fastbuild",
@@ -466,6 +474,7 @@ utils = struct(
466474
list_or_depset_to_list = _list_or_depset_to_list,
467475
add_cls_prefix = _add_cls_prefix,
468476
get_cls = _get_cls,
477+
get_bool = _get_bool
469478
)
470479

471480
log = struct(

0 commit comments

Comments
 (0)