1# Copyright 2022 The Bazel Authors. All rights reserved. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15"""Sets up prerequisites for rules_android.""" 16 17load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") 18load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") 19 20def rules_android_prereqs(dev_mode = False): 21 """Downloads prerequisite repositories for rules_android.""" 22 maybe( 23 http_archive, 24 name = "rules_java", 25 urls = [ 26 "https://github.com/bazelbuild/rules_java/releases/download/6.0.0/rules_java-6.0.0.tar.gz", 27 ], 28 sha256 = "469b7f3b580b4fcf8112f4d6d0d5a4ce8e1ad5e21fee67d8e8335d5f8b3debab", 29 ) 30 31 maybe( 32 http_archive, 33 name = "rules_jvm_external", 34 strip_prefix = "rules_jvm_external-fa73b1a8e4846cee88240d0019b8f80d39feb1c3", 35 sha256 = "7e13e48b50f9505e8a99cc5a16c557cbe826e9b68d733050cd1e318d69f94bb5", 36 url = "https://github.com/bazelbuild/rules_jvm_external/archive/fa73b1a8e4846cee88240d0019b8f80d39feb1c3.zip", 37 ) 38 39 maybe( 40 http_archive, 41 name = "com_google_protobuf", 42 sha256 = "87407cd28e7a9c95d9f61a098a53cf031109d451a7763e7dd1253abf8b4df422", 43 strip_prefix = "protobuf-3.19.1", 44 urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.19.1.tar.gz"], 45 ) 46 47 maybe( 48 http_archive, 49 name = "remote_java_tools_for_rules_android", 50 sha256 = "8fb4d3138bd92a9d3324dae29c9f70d91ca2db18cd0bf1997446eed4657d19b3", 51 urls = [ 52 "https://mirror.bazel.build/bazel_java_tools/releases/java/v11.8/java_tools-v11.8.zip", 53 "https://github.com/bazelbuild/java_tools/releases/download/java_v11.8/java_tools-v11.8.zip", 54 ], 55 ) 56 57 maybe( 58 http_archive, 59 name = "bazel_skylib", 60 sha256 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c", 61 urls = [ 62 "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz", 63 "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz", 64 ], 65 ) 66 67 maybe( 68 http_archive, 69 name = "io_bazel_rules_go", 70 sha256 = "51dc53293afe317d2696d4d6433a4c33feedb7748a9e352072e2ec3c0dafd2c6", 71 urls = [ 72 "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.40.1/rules_go-v0.40.1.zip", 73 "https://github.com/bazelbuild/rules_go/releases/download/v0.40.1/rules_go-v0.40.1.zip", 74 ], 75 ) 76 77 maybe( 78 http_archive, 79 name = "bazel_gazelle", 80 sha256 = "5982e5463f171da99e3bdaeff8c0f48283a7a5f396ec5282910b9e8a49c0dd7e", 81 urls = [ 82 "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.25.0/bazel-gazelle-v0.25.0.tar.gz", 83 "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.25.0/bazel-gazelle-v0.25.0.tar.gz", 84 ], 85 ) 86 87 maybe( 88 http_archive, 89 name = "robolectric", 90 urls = ["https://github.com/robolectric/robolectric-bazel/archive/4.10.3.tar.gz"], 91 strip_prefix = "robolectric-bazel-4.10.3", 92 sha256 = "1b199a932cbde4af728dd8275937091adbb89a4bf63d326de49e6d0a42e723bf", 93 ) 94 95 maybe( 96 http_archive, 97 name = "rules_license", 98 urls = [ 99 "https://github.com/bazelbuild/rules_license/releases/download/0.0.4/rules_license-0.0.4.tar.gz", 100 "https://mirror.bazel.build/github.com/bazelbuild/rules_license/releases/download/0.0.4/rules_license-0.0.4.tar.gz", 101 ], 102 sha256 = "6157e1e68378532d0241ecd15d3c45f6e5cfd98fc10846045509fb2a7cc9e381", 103 ) 104 105 maybe( 106 http_archive, 107 name = "py_absl", 108 sha256 = "0fb3a4916a157eb48124ef309231cecdfdd96ff54adf1660b39c0d4a9790a2c0", 109 urls = [ 110 "https://github.com/abseil/abseil-py/archive/refs/tags/v1.4.0.tar.gz", 111 ], 112 strip_prefix = "abseil-py-1.4.0", 113 ) 114 115 maybe( 116 http_archive, 117 name = "rules_proto", 118 sha256 = "dc3fb206a2cb3441b485eb1e423165b231235a1ea9b031b4433cf7bc1fa460dd", 119 strip_prefix = "rules_proto-5.3.0-21.7", 120 urls = [ 121 "https://github.com/bazelbuild/rules_proto/archive/refs/tags/5.3.0-21.7.tar.gz", 122 ], 123 ) 124 125 maybe( 126 http_archive, 127 name = "rules_python", 128 strip_prefix = "rules_python-0.23.1", 129 urls = [ 130 "https://github.com/bazelbuild/rules_python/releases/download/0.23.1/rules_python-0.23.1.tar.gz", 131 "https://mirror.bazel.build/github.com/bazelbuild/rules_python/releases/download/0.23.1/rules_python-0.23.1.tar.gz", 132 ], 133 sha256 = "84aec9e21cc56fbc7f1335035a71c850d1b9b5cc6ff497306f84cced9a769841", 134 ) 135 136 if dev_mode: 137 maybe( 138 http_archive, 139 name = "rules_bazel_integration_test", 140 sha256 = "d6dada79939533a8127000d2aafa125f29a4a97f720e01c050fdeb81b1080b08", 141 urls = [ 142 "https://github.com/bazel-contrib/rules_bazel_integration_test/releases/download/v0.17.0/rules_bazel_integration_test.v0.17.0.tar.gz", 143 ], 144 ) 145 146 maybe( 147 http_archive, 148 name = "cgrindel_bazel_starlib", 149 sha256 = "a8d25340956b429b56302d3fd702bb3df8b3a67db248dd32b3084891ad497964", 150 urls = [ 151 "https://github.com/cgrindel/bazel-starlib/releases/download/v0.17.0/bazel-starlib.v0.17.0.tar.gz", 152 ], 153 ) 154