Skip to content

Commit

Permalink
Actually make buck install apex work
Browse files Browse the repository at this point in the history
Summary: kalman5 reported that install didn't work, which led me down this rabbit hole. It turns out the package manager needs explicit marking as apex to install, and it lies that apexes can install.

Reviewed By: kemurphy

Differential Revision: D58879929

fbshipit-source-id: 804b72b1836adfff85c8d67f57bf9af8208196ed
  • Loading branch information
vener91 authored and facebook-github-bot committed Jun 22, 2024
1 parent e2a9da4 commit 5564c18
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions android/android_apk.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,11 @@ def get_install_info(
manifest: Artifact,
exopackage_info: [ExopackageInfo, None],
definitely_has_native_libs: bool = True,
staged_install_mode_default: bool = False) -> InstallInfo:
apex_mode: bool = False) -> InstallInfo:
files = {
ctx.attrs.name: output_apk,
"manifest": manifest,
"options": generate_install_config(ctx, staged_install_mode_default),
"options": generate_install_config(ctx, apex_mode),
}

if exopackage_info:
Expand Down Expand Up @@ -220,23 +220,23 @@ def get_install_info(
files = files,
)

def generate_install_config(ctx: AnalysisContext, staged_install_mode_default: bool) -> Artifact:
data = get_install_config(staged_install_mode_default)
def generate_install_config(ctx: AnalysisContext, apex_mode: bool) -> Artifact:
data = get_install_config(apex_mode)
return ctx.actions.write_json("install_android_options.json", data)

def get_install_config(staged_install_mode_default: bool) -> dict[str, typing.Any]:
def get_install_config(apex_mode: bool) -> dict[str, typing.Any]:
# TODO: read from toolchains
staged_install_mode = read_root_config("adb", "staged_install_mode", None)
install_config = {
"adb_restart_on_failure": read_root_config("adb", "adb_restart_on_failure", "true"),
"agent_port_base": read_root_config("adb", "agent_port_base", "2828"),
"always_use_java_agent": read_root_config("adb", "always_use_java_agent", "false"),
"apex_mode": apex_mode,
"is_zstd_compression_enabled": read_root_config("adb", "is_zstd_compression_enabled", "false"),
"max_retries": read_root_config("adb", "retries", "5"),
"multi_install_mode": read_root_config("adb", "multi_install_mode", "false"),
"retry_delay_millis": read_root_config("adb", "retry_delay_millis", "500"),
"skip_install_metadata": read_root_config("adb", "skip_install_metadata", "false"),
"staged_install_mode": staged_install_mode_default if staged_install_mode == None else staged_install_mode,
"staged_install_mode": read_root_config("adb", "staged_install_mode", None),
}

adb_executable = read_root_config("android", "adb", None)
Expand Down

0 comments on commit 5564c18

Please sign in to comment.