Skip to content

Commit

Permalink
Migrate away from @bazel_tools//tools/android:android_extensions.bzl
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 634374307
Change-Id: I6393cf7ddfa67cda31d5053d2e096f37f0b2755c
  • Loading branch information
ted-xie authored and Copybara-Service committed May 16, 2024
1 parent bb7b5cf commit 1124b49
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ use_repo(
"rules_android_maven",
)

remote_android_extensions = use_extension("@bazel_tools//tools/android:android_extensions.bzl", "remote_android_tools_extensions")
remote_android_extensions = use_extension("//bzlmod_extensions:android_extensions.bzl", "remote_android_tools_extensions")
use_repo(remote_android_extensions, "android_gmaven_r8", "android_tools")

# integration test setup
Expand Down
34 changes: 34 additions & 0 deletions bzlmod_extensions/android_extensions.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2022 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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.

"""Module extension to declare Android runtime dependencies for Bazel."""

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_jar")

def _remote_android_tools_extensions_impl(module_ctx):
http_archive(
name = "android_tools",
sha256 = "d7cdfc03f3ad6571b7719f4355379177a4bde68d17dca2bdbf6c274d72e4d6cf",
url = "https://mirror.bazel.build/bazel_android_tools/android_tools_pkg-0.31.0.tar",
)
http_jar(
name = "android_gmaven_r8",
sha256 = "59753e70a74f918389cc87f1b7d66b5c0862932559167425708ded159e3de439",
url = "https://maven.google.com/com/android/tools/r8/8.3.37/r8-8.3.37.jar",
)
return module_ctx.extension_metadata(reproducible = True)

remote_android_tools_extensions = module_extension(
implementation = _remote_android_tools_extensions_impl,
)
3 changes: 0 additions & 3 deletions examples/basicapp/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ module(
bazel_dep(name = "rules_java", version = "7.4.0")
bazel_dep(name = "bazel_skylib", version = "1.3.0")

remote_android_extensions = use_extension("@bazel_tools//tools/android:android_extensions.bzl", "remote_android_tools_extensions")
use_repo(remote_android_extensions, "android_gmaven_r8", "android_tools")

bazel_dep(
name = "rules_android",
version = "0.2.0",
Expand Down

0 comments on commit 1124b49

Please sign in to comment.