Skip to content

Commit 7959ac3

Browse files
EdbertChanted-xie
authored andcommitted
Adding support for debuggable flag to override default Bazel behavior. See bazelbuild/bazel#13801
1 parent 27109e7 commit 7959ac3

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
@@ -90,12 +90,7 @@ def native_bool_flag_macro(name, description):
9090
)
9191

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

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

rules/resources.bzl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,7 @@ def _package(
735735
resource_files_zip = ctx.actions.declare_file(
736736
"_migrated/" + ctx.label.name + "_files/resource_files.zip",
737737
)
738+
debug = utils.get_bool(manifest_values["debuggable"]) if "debuggable" in manifest_values else None
738739
_busybox.package(
739740
ctx,
740741
out_file = resource_apk,
@@ -773,7 +774,7 @@ def _package(
773774
aapt = aapt,
774775
busybox = busybox,
775776
host_javabase = host_javabase,
776-
debug = compilation_mode != _compilation_mode.OPT,
777+
debug = compilation_mode != _compilation_mode.OPT if debug == None else debug,
777778
should_throw_on_conflict = should_throw_on_conflict,
778779
)
779780

rules/utils.bzl

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

443+
def _get_bool(v):
444+
v = v.lower()
445+
if v == "true":
446+
return True
447+
if v == "false":
448+
return False
449+
fail("Unknown bool: " + v)
450+
443451
compilation_mode = struct(
444452
DBG = "dbg",
445453
FASTBUILD = "fastbuild",
@@ -465,6 +473,7 @@ utils = struct(
465473
list_or_depset_to_list = _list_or_depset_to_list,
466474
add_cls_prefix = _add_cls_prefix,
467475
get_cls = _get_cls,
476+
get_bool = _get_bool
468477
)
469478

470479
log = struct(

0 commit comments

Comments
 (0)