Skip to content

Commit

Permalink
Remove deps_query support completely from android_library
Browse files Browse the repository at this point in the history
Summary:
`deps_query` is generally a bad approach, since you end up taking a runtime dependency on a bunch of deps that you usually only want at compile time (and so you should use `provided_deps_query`).

Also, with `buck2` we want to do queries like this using User-Defined-Rules instead which will be much more precise and efficient.

Reviewed By: christolliday

Differential Revision: D48972651

fbshipit-source-id: d77f1c4a373bc5c45c3cb1309b53bb8b78454bca
  • Loading branch information
Ian Childs authored and facebook-github-bot committed Nov 16, 2023
1 parent 12f6808 commit 407dbc9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions prelude/android/android_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ load(
load("@prelude//kotlin:kotlin_library.bzl", "build_kotlin_library")

def android_library_impl(ctx: AnalysisContext) -> list[Provider]:
packaging_deps = ctx.attrs.deps + (ctx.attrs.deps_query or []) + ctx.attrs.exported_deps + ctx.attrs.runtime_deps
packaging_deps = ctx.attrs.deps + ctx.attrs.exported_deps + ctx.attrs.runtime_deps
if ctx.attrs._build_only_native_code:
shared_library_info, cxx_resource_info, linkable_graph = create_native_providers(ctx, ctx.label, packaging_deps)
return [
Expand Down Expand Up @@ -87,7 +87,7 @@ def _get_dummy_r_dot_java(
ctx: AnalysisContext) -> ([Artifact, None], [AndroidLibraryIntellijInfo, None]):
android_resources = dedupe([resource for resource in filter(None, [
x.get(AndroidResourceInfo)
for x in ctx.attrs.deps + (ctx.attrs.deps_query or []) + ctx.attrs.provided_deps + (getattr(ctx.attrs, "provided_deps_query", []) or [])
for x in ctx.attrs.deps + ctx.attrs.provided_deps + (getattr(ctx.attrs, "provided_deps_query", []) or [])
]) if resource.res != None])
if len(android_resources) == 0:
return (None, None)
Expand Down
2 changes: 1 addition & 1 deletion prelude/android/robolectric_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def robolectric_test_impl(ctx: AnalysisContext) -> list[Provider]:
if runtime_dependencies_dir:
extra_cmds.append(cmd_args(runtime_dependencies_dir, format = "-Drobolectric.dependency.dir={}"))

all_packaging_deps = ctx.attrs.deps + (ctx.attrs.deps_query or []) + ctx.attrs.exported_deps + ctx.attrs.runtime_deps
all_packaging_deps = ctx.attrs.deps + ctx.attrs.exported_deps + ctx.attrs.runtime_deps
android_packageable_info = merge_android_packageable_info(ctx.label, ctx.actions, all_packaging_deps)
resources_info = get_android_binary_resources_info(
ctx,
Expand Down
2 changes: 0 additions & 2 deletions prelude/decls/android_rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,6 @@ android_library = prelude_rule(
jvm_common.exported_deps() |
jvm_common.provided_deps() |
jvm_common.exported_provided_deps() |
buck.deps_query_arg() |
buck.provided_deps_query_arg() |
jvm_common.abi_generation_mode() |
jvm_common.source_only_abi_deps() |
Expand Down Expand Up @@ -1396,7 +1395,6 @@ robolectric_test = prelude_rule(
"default_cxx_platform": attrs.option(attrs.string(), default = None),
"default_host_platform": attrs.option(attrs.configuration_label(), default = None),
"deps": attrs.list(attrs.dep(), default = []),
"deps_query": attrs.option(attrs.query(), default = None),
"env": attrs.dict(key = attrs.string(), value = attrs.arg(), sorted = False, default = {}),
"exported_deps": attrs.list(attrs.dep(), default = []),
"exported_provided_deps": attrs.list(attrs.dep(), default = []),
Expand Down

0 comments on commit 407dbc9

Please sign in to comment.