Skip to content

Commit

Permalink
Remove the deprecated android_binary_internal rule and all the refere…
Browse files Browse the repository at this point in the history
…nces.

PiperOrigin-RevId: 660565704
Change-Id: If70d4d13792689b83740d5db816e4f9145f684cb
  • Loading branch information
Zhaoqing Xu authored and copybara-github committed Aug 7, 2024
1 parent 4ecc190 commit 67bf411
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 94 deletions.
8 changes: 4 additions & 4 deletions android/rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@

# Don't use relative paths since this file is coppied to //android/rules.bzl.

load(
"//rules:android_binary.bzl",
_android_binary = "android_binary_macro",
)
load(
"//rules:android_ndk_repository.bzl",
_android_ndk_repository = "android_ndk_repository",
Expand Down Expand Up @@ -49,6 +45,10 @@ load(
"//rules/android_application:android_application.bzl",
_android_application = "android_application",
)
load(
"//rules/android_binary:rule.bzl",
_android_binary = "android_binary_macro",
)
load(
"//rules/android_library:rule.bzl",
_android_library = "android_library_macro",
Expand Down
15 changes: 1 addition & 14 deletions rules/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,6 @@ bzl_library(
],
)

bzl_library(
name = "android_binary_bzl",
srcs = [
"android_binary.bzl",
],
visibility = ["//:__subpackages__"],
deps = [
":visibility_bzl",
"//rules/android_binary_internal:bzl",
"@rules_java//java/common",
],
)

bzl_library(
name = "android_split_transition_bzl",
srcs = [
Expand Down Expand Up @@ -119,12 +106,12 @@ bzl_library(
"//stardoc:__pkg__",
],
deps = [
":android_binary_bzl",
":common_bzl",
":min_sdk_version_bzl",
":visibility_bzl",
"//rules/aar_import:bzl",
"//rules/android_application:bzl",
"//rules/android_binary:bzl",
"//rules/android_library:bzl",
"//rules/android_local_test:bzl",
"//rules/android_sandboxed_sdk:bzl",
Expand Down
2 changes: 1 addition & 1 deletion rules/android_application/android_application.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
This file exists to inject the correct version of android_binary.
"""

load("//rules:android_binary.bzl", _android_binary_macro = "android_binary_macro")
load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
load("//rules/android_binary:rule.bzl", _android_binary_macro = "android_binary_macro")
load(":android_application_rule.bzl", _android_application_macro = "android_application_macro")

visibility(PROJECT_VISIBILITY)
Expand Down
4 changes: 2 additions & 2 deletions rules/android_application/android_feature_module.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
This file exists to inject the correct version of android_binary and android_library.
"""

load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
load(
"//rules:android_binary.bzl",
"//rules/android_binary:rule.bzl",
_android_binary_macro = "android_binary_macro",
)
load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
load(
"//rules/android_library:rule.bzl",
_android_library_macro = "android_library_macro",
Expand Down
46 changes: 0 additions & 46 deletions rules/android_binary.bzl

This file was deleted.

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -577,19 +577,19 @@ def finalize(
output_groups,
deploy_ctx,
**_unused_ctxs):
"""Final step of the android_binary_internal processor pipeline.
"""Final step of the android_binary processor pipeline.
Args:
ctx: The context.
providers: The list of providers for the android_binary_internal rule.
providers: The list of providers for the android_binary rule.
validation_outputs: Validation outputs for the rule.
implicit_outputs: Implicit outputs for the rule.
output_groups: Output groups for the rule.
deploy_ctx: The context from the deploy creation step.
**_unused_ctxs: Other contexts.
Returns:
The list of providers the android_binary_internal rule should return.
The list of providers the android_binary rule should return.
"""
output_groups["_validation"] = depset(validation_outputs)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""R8 processor steps for android_binary_internal."""
"""R8 processor steps for android_binary."""

load("//rules:acls.bzl", "acls")
load("//rules:android_neverlink_aspect.bzl", "StarlarkAndroidNeverlinkInfo")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ load(
"//rules:attrs.bzl",
_attrs = "attrs",
)
load("//rules:providers.bzl", "AndroidApplicationResourceInfo")
load("//rules:utils.bzl", "ANDROID_SDK_TOOLCHAIN_TYPE")
load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
load(":attrs.bzl", "ATTRS")
Expand All @@ -28,7 +27,7 @@ visibility(PROJECT_VISIBILITY)

_DEFAULT_ALLOWED_ATTRS = ["name", "visibility", "tags", "testonly", "transitive_configs", "$enable_manifest_merging", "features", "exec_properties"]

_DEFAULT_PROVIDES = [AndroidApplicationResourceInfo, OutputGroupInfo]
_DEFAULT_PROVIDES = [ApkInfo, JavaInfo]

def _outputs(name, proguard_generate_mapping, _package_name, _generate_proguard_outputs):
label = "//" + _package_name + ":" + name
Expand Down Expand Up @@ -88,17 +87,14 @@ def make_rule(
cfg = config_common.config_feature_flag_transition("feature_flags"),
)

android_binary_internal = make_rule()
android_binary = make_rule()

# TODO(zhaoqxu): Consider removing this method
def sanitize_attrs(attrs, allowed_attrs = ATTRS.keys()):
"""Sanitizes the attributes.
The android_binary_internal has a subset of the android_binary attributes, but is
called from the android_binary macro with the same full set of attributes. This removes
any unnecessary attributes.
Args:
attrs: A dict. The attributes for the android_binary_internal rule.
attrs: A dict. The attributes for the android_binary rule.
allowed_attrs: The list of attribute keys to keep.
Returns:
Expand All @@ -117,13 +113,10 @@ def sanitize_attrs(attrs, allowed_attrs = ATTRS.keys()):

return attrs

def android_binary_internal_macro(internal_rule = android_binary_internal, **attrs):
"""android_binary_internal rule.
def android_binary_macro(**attrs):
"""android_binary rule.
Args:
internal_rule: For migration only, do not use. The rule to run under the hood.
This is used as a workaround to rename the android_binary_internal rule to
android_binary.
**attrs: Rule attributes
"""

Expand All @@ -133,7 +126,7 @@ def android_binary_internal_macro(internal_rule = android_binary_internal, **att
if type(attrs.get("proguard_specs", None)) == "select" or attrs.get("proguard_specs", None):
attrs["$generate_proguard_outputs"] = True

internal_rule(
android_binary(
**sanitize_attrs(
attrs,
# _package_name and other attributes are allowed attributes but are also private.
Expand Down
2 changes: 1 addition & 1 deletion rules/android_sandboxed_sdk/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ bzl_library(
srcs = glob(["*.bzl"]),
visibility = ["//:__subpackages__"],
deps = [
"//rules:android_binary_bzl",
"//rules:common_bzl",
"//rules/android_binary:bzl",
],
)
2 changes: 1 addition & 1 deletion rules/android_sandboxed_sdk/android_sandboxed_sdk.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
This file exists to inject the correct version of android_binary.
"""

load("//rules:android_binary.bzl", _android_binary_macro = "android_binary_macro")
load("//rules:visibility.bzl", "PROJECT_VISIBILITY")
load("//rules/android_binary:rule.bzl", _android_binary_macro = "android_binary_macro")
load(":android_sandboxed_sdk_macro.bzl", _android_sandboxed_sdk_macro = "android_sandboxed_sdk_macro")

visibility(PROJECT_VISIBILITY)
Expand Down
2 changes: 1 addition & 1 deletion rules/dex_desugar_aspect.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def _aspect_attrs():
"_toolchain", # to get Kotlin toolchain component in android_library
]

# Also used by the android_binary_internal rule
# Also used by the android_binary rule
def get_aspect_deps(ctx):
"""Get all the deps of the dex_desugar_aspect that requires traversal.
Expand Down
8 changes: 4 additions & 4 deletions rules/rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@

# Don't use relative paths since this file is coppied to //android/rules.bzl.

load(
"//rules:android_binary.bzl",
_android_binary = "android_binary_macro",
)
load(
"//rules:android_ndk_repository.bzl",
_android_ndk_repository = "android_ndk_repository",
Expand Down Expand Up @@ -49,6 +45,10 @@ load(
"//rules/android_application:android_application.bzl",
_android_application = "android_application",
)
load(
"//rules/android_binary:rule.bzl",
_android_binary = "android_binary_macro",
)
load(
"//rules/android_library:rule.bzl",
_android_library = "android_library_macro",
Expand Down
4 changes: 2 additions & 2 deletions stardoc/doc_rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ load(
_android_application = "android_application",
)
load(
"//rules/android_binary_internal:rule.bzl",
_android_binary = "android_binary_internal",
"//rules/android_binary:rule.bzl",
_android_binary = "android_binary",
)
load(
"//rules/android_library:rule.bzl",
Expand Down

0 comments on commit 67bf411

Please sign in to comment.