Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incompatible_disable_native_android_rules #8391

Closed
timpeut opened this issue May 17, 2019 · 7 comments
Closed

incompatible_disable_native_android_rules #8391

timpeut opened this issue May 17, 2019 · 7 comments
Labels
incompatible-change Incompatible/breaking change P2 We'll consider working on this in future. (Assignee optional) team-Android Issues for Android team type: feature request

Comments

@timpeut
Copy link
Contributor

timpeut commented May 17, 2019

As proposed and accepted in Android Native to Starlark Migration we will be disabling all usage of the native Android build rules. Users should be using the Starlark Android Rules.

Migration

  1. Add the following to your WORKSPACE
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "rules_android",
    urls = ["https://github.com/bazelbuild/rules_android/archive/v0.1.1.zip"],
    sha256 = "cd06d15dd8bb59926e4d65f9003bfc20f9da4b2519985c27e190cddc8b7a7806",
    strip_prefix = "rules_android-0.1.1",
)
  1. Load all android_* rules in your BUILD and .bzl files:
load("@rules_android//android:rules.bzl", "android_library")
android_library(
    ...
)

We will be updating buildifier to automatically perform step 2, but it is trivial to perform manually.

Expected Timeline

  • Released with Bazel 0.27 (June 2019), disabled by default
  • Enabled by default with September 2019 release
@jin jin added incompatible-change Incompatible/breaking change migration-0.27 team-Android Issues for Android team labels May 17, 2019
@timpeut
Copy link
Contributor Author

timpeut commented May 21, 2019

Flag has been added. Should be released in 0.27

6fe6e98

@timpeut
Copy link
Contributor Author

timpeut commented May 21, 2019

And the native-android fix has been added to buildifier

bazelbuild/buildtools#638

@cgruber
Copy link
Contributor

cgruber commented Jan 17, 2020

Wait, this didn't go in to 2.0? At this point, this is blocking the rules_kotlin proceeding with fixing this same issue, triggering the following errors:

(03:07:12) ERROR: /var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/5a661b0f3ed263c29200a380b053ff64/external/bazel_tools/tools/android/BUILD:10:1: in tags attribute of android_tools_defaults_jar rule @bazel_tools//tools/android:android_jar: The native Android rules are deprecated. Please use the Starlark Android rules by adding the following load statement to the BUILD file: load("@build_bazel_rules_android//android:rules.bzl", "android_tools_defaults_jar"). See http://github.com/bazelbuild/rules_android.
  | (03:07:12) ERROR: /var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/5a661b0f3ed263c29200a380b053ff64/external/bazel_tools/src/tools/android/java/com/google/devtools/build/android/incrementaldeployment/BUILD:11:1: in tags attribute of android_library rule @bazel_tools//src/tools/android/java/com/google/devtools/build/android/incrementaldeployment:incremental_split_stub_application: The native Android rules are deprecated. Please use the Starlark Android rules by adding the following load statement to the BUILD file: load("@build_bazel_rules_android//android:rules.bzl", "android_library"). See http://github.com/bazelbuild/rules_android.
  | (03:07:12) ERROR: /var/lib/buildkite-agent/.cache/bazel/_bazel_buildkite-agent/5a661b0f3ed263c29200a380b053ff64/external/bazel_tools/src/tools/android/java/com/google/devtools/build/android/incrementaldeployment/BUILD:3:1: in tags attribute of android_library rule @bazel_tools//src/tools/android/java/com/google/devtools/build/android/incrementaldeployment:incremental_stub_application: The native Android rules are deprecated. Please use the Starlark Android rules by adding the following load statement to the BUILD file: load("@build_bazel_rules_android//android:rules.bzl", "android_library"). See http://github.com/bazelbuild/rules_android.

@ahumesky
Copy link
Contributor

ahumesky commented Dec 3, 2020

@cgruber we won't flip this flag until #5354 is finished

@ahumesky ahumesky added the P2 We'll consider working on this in future. (Assignee optional) label Dec 3, 2020
@martis42
Copy link

This is labeled with breaking-change-5.0, which I interpret as the intention to flip this with Bazel 5.0.0.
The flag is however still inactive by default:
https://github.com/bazelbuild/bazel/blob/5.0.0/src/main/java/com/google/devtools/build/lib/rules/android/AndroidConfiguration.java#L781

Please update the issue status.

@github-actions
Copy link

Thank you for contributing to the Bazel repository! This issue has been marked as stale since it has not had any activity in the last 1+ years. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-bazeler". Please reach out to the triage team (@bazelbuild/triage) if you think this issue is still relevant or you are interested in getting the issue resolved.

@github-actions github-actions bot added stale Issues or PRs that are stale (no activity for 30 days) and removed stale Issues or PRs that are stale (no activity for 30 days) labels Jun 26, 2023
@ahumesky
Copy link
Contributor

The Starlark migration is completed, and the Android rules have been removed in Bazel 8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
incompatible-change Incompatible/breaking change P2 We'll consider working on this in future. (Assignee optional) team-Android Issues for Android team type: feature request
Projects
None yet
Development

No branches or pull requests