Skip to content

Commit

Permalink
Adding support for debuggable flag to override default Bazel behavior…
Browse files Browse the repository at this point in the history
  • Loading branch information
EdbertChan authored and ted-xie committed Jan 27, 2025
1 parent 27109e7 commit 7959ac3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
7 changes: 1 addition & 6 deletions rules/flags/flags.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,7 @@ def native_bool_flag_macro(name, description):
)

def _get_bool(v):
v = v.lower()
if v == "true":
return True
if v == "false":
return False
fail("Unknown bool: " + v)
return utils.get_bool(v)

def _bool_impl(ctx):
if ctx.label.name in ctx.var:
Expand Down
3 changes: 2 additions & 1 deletion rules/resources.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,7 @@ def _package(
resource_files_zip = ctx.actions.declare_file(
"_migrated/" + ctx.label.name + "_files/resource_files.zip",
)
debug = utils.get_bool(manifest_values["debuggable"]) if "debuggable" in manifest_values else None
_busybox.package(
ctx,
out_file = resource_apk,
Expand Down Expand Up @@ -773,7 +774,7 @@ def _package(
aapt = aapt,
busybox = busybox,
host_javabase = host_javabase,
debug = compilation_mode != _compilation_mode.OPT,
debug = compilation_mode != _compilation_mode.OPT if debug == None else debug,
should_throw_on_conflict = should_throw_on_conflict,
)

Expand Down
9 changes: 9 additions & 0 deletions rules/utils.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,14 @@ def _get_compilation_mode(ctx):
"""
return ctx.var["COMPILATION_MODE"]

def _get_bool(v):
v = v.lower()
if v == "true":
return True
if v == "false":
return False
fail("Unknown bool: " + v)

compilation_mode = struct(
DBG = "dbg",
FASTBUILD = "fastbuild",
Expand All @@ -465,6 +473,7 @@ utils = struct(
list_or_depset_to_list = _list_or_depset_to_list,
add_cls_prefix = _add_cls_prefix,
get_cls = _get_cls,
get_bool = _get_bool
)

log = struct(
Expand Down

0 comments on commit 7959ac3

Please sign in to comment.