blob: 427f29fb60498cbfe71514a53873df31cf211ac9 [file] [log] [blame]
Kent Rossb6375e02019-02-26 10:07:55 -08001"""Load dependencies needed to compile the protobuf library as a 3rd-party consumer."""
2
3load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
4
Adam Cozzettec7dfd0d2021-10-28 10:34:54 -07005PROTOBUF_MAVEN_ARTIFACTS = [
Mike Kruskaled5c57a2022-08-10 22:51:29 -07006 "com.google.caliper:caliper:1.0-beta-3",
Adam Cozzettec7dfd0d2021-10-28 10:34:54 -07007 "com.google.code.findbugs:jsr305:3.0.2",
Elliotte Rusty Haroldb73f78d2022-01-05 21:23:54 +00008 "com.google.code.gson:gson:2.8.9",
Mike Kruskale71531a2022-08-12 13:16:40 -07009 "com.google.errorprone:error_prone_annotations:2.5.1",
Adam Cozzettec7dfd0d2021-10-28 10:34:54 -070010 "com.google.j2objc:j2objc-annotations:1.3",
Elliotte Rusty Harold61dcf502022-03-30 20:52:15 +000011 "com.google.guava:guava:31.1-jre",
12 "com.google.guava:guava-testlib:31.1-jre",
Adam Cozzettec7dfd0d2021-10-28 10:34:54 -070013 "com.google.truth:truth:1.1.2",
Elliotte Rusty Harold575d56b2022-03-22 21:54:53 +000014 "junit:junit:4.13.2",
Adam Cozzettef7232f22022-03-02 19:17:27 +000015 "org.mockito:mockito-core:4.3.1",
Adam Cozzettec7dfd0d2021-10-28 10:34:54 -070016]
17
Joshua Haberman01691f62022-04-26 19:27:59 +000018def _github_archive(repo, commit, **kwargs):
19 repo_name = repo.split("/")[-1]
20 http_archive(
21 urls = [repo + "/archive/" + commit + ".zip"],
22 strip_prefix = repo_name + "-" + commit,
23 **kwargs
24 )
25
Kent Rossb6375e02019-02-26 10:07:55 -080026def protobuf_deps():
27 """Loads common dependencies needed to compile the protobuf library."""
28
Yannic Bonenbergerbf0c69e2019-07-26 13:14:19 +020029 if not native.existing_rule("bazel_skylib"):
30 http_archive(
31 name = "bazel_skylib",
Yannic948740b2020-01-15 19:27:35 +010032 urls = [
Xùdōng Yáng9f150592022-08-17 16:08:06 +020033 "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.2.1/bazel-skylib-1.2.1.tar.gz",
34 "https://github.com/bazelbuild/bazel-skylib/releases/download/1.2.1/bazel-skylib-1.2.1.tar.gz",
Yannic948740b2020-01-15 19:27:35 +010035 ],
Xùdōng Yáng9f150592022-08-17 16:08:06 +020036 sha256 = "f7be3474d42aae265405a592bb7da8e171919d74c16f082a5457840f06054728",
Yannic Bonenbergerbf0c69e2019-07-26 13:14:19 +020037 )
38
Adam Cozzette9bf0aca2022-04-08 09:12:05 -070039 if not native.existing_rule("com_google_absl"):
40 # Abseil LTS from November 2021
Joshua Haberman01691f62022-04-26 19:27:59 +000041 _github_archive(
David L. Jones83303ba2022-04-21 17:38:03 -070042 name = "com_google_absl",
Joshua Haberman01691f62022-04-26 19:27:59 +000043 repo = "https://github.com/abseil/abseil-cpp",
Mike Kruskald8421bd2022-08-21 00:54:31 -070044 commit = "273292d1cfc0a94a65082ee350509af1d113344d",
45 sha256 = "6764f226bd6e2d8ab9fe2f3cab5f45fb1a4a15c04b58b87ba7fa87456054f98b",
Adam Cozzette9bf0aca2022-04-08 09:12:05 -070046 )
47
Yannic Bonenberger6e899192019-07-23 16:28:57 +020048 if not native.existing_rule("zlib"):
Kent Rossb6375e02019-02-26 10:07:55 -080049 http_archive(
Nic McDonaldf313b9c2019-04-12 15:41:08 -070050 name = "zlib",
Adam Cozzettefaa42e92022-03-29 15:50:39 -040051 build_file = "@com_google_protobuf//:third_party/zlib.BUILD",
Keith Smiley516f8b12019-08-28 21:41:02 -070052 sha256 = "629380c90a77b964d896ed37163f5c3a34f6e6d897311f1df2a7016355c45eff",
Kent Rossb6375e02019-02-26 10:07:55 -080053 strip_prefix = "zlib-1.2.11",
Keith Smiley516f8b12019-08-28 21:41:02 -070054 urls = ["https://github.com/madler/zlib/archive/v1.2.11.tar.gz"],
Kent Rossb6375e02019-02-26 10:07:55 -080055 )
Adam Liddella74c43b2019-07-15 23:35:19 +000056
Yannic Bonenberger6e899192019-07-23 16:28:57 +020057 if not native.existing_rule("rules_cc"):
Joshua Haberman01691f62022-04-26 19:27:59 +000058 _github_archive(
Yannic Bonenberger6e899192019-07-23 16:28:57 +020059 name = "rules_cc",
Joshua Haberman01691f62022-04-26 19:27:59 +000060 repo = "https://github.com/bazelbuild/rules_cc",
61 commit = "818289e5613731ae410efb54218a4077fb9dbb03",
62 sha256 = "0adbd6f567291ad526e82c765e15aed33cea5e256eeba129f1501142c2c56610",
Yannic Bonenberger6e899192019-07-23 16:28:57 +020063 )
64
65 if not native.existing_rule("rules_java"):
Joshua Haberman01691f62022-04-26 19:27:59 +000066 _github_archive(
Yannic Bonenberger6e899192019-07-23 16:28:57 +020067 name = "rules_java",
Joshua Haberman01691f62022-04-26 19:27:59 +000068 repo = "https://github.com/bazelbuild/rules_java",
69 commit = "981f06c3d2bd10225e85209904090eb7b5fb26bd",
70 sha256 = "7979ece89e82546b0dcd1dff7538c34b5a6ebc9148971106f0e3705444f00665",
Yannic Bonenberger6e899192019-07-23 16:28:57 +020071 )
72
73 if not native.existing_rule("rules_proto"):
Joshua Haberman01691f62022-04-26 19:27:59 +000074 _github_archive(
Yannic Bonenberger6e899192019-07-23 16:28:57 +020075 name = "rules_proto",
Joshua Haberman01691f62022-04-26 19:27:59 +000076 repo = "https://github.com/bazelbuild/rules_proto",
77 commit = "f7a30f6f80006b591fa7c437fe5a951eb10bcbcf",
Doree048092021-04-09 21:12:25 +030078 sha256 = "a4382f78723af788f0bc19fd4c8411f44ffe0a72723670a34692ffad56ada3ac",
Yannic Bonenbergerd2d6ff52019-08-06 21:12:06 +020079 )
80
81 if not native.existing_rule("rules_python"):
82 http_archive(
83 name = "rules_python",
Joshua Habermana6901f02022-04-25 22:00:57 +000084 sha256 = "9fcf91dbcc31fde6d1edb15f117246d912c33c36f44cf681976bd886538deba6",
85 strip_prefix = "rules_python-0.8.0",
86 url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/0.8.0.tar.gz",
Yannic Bonenberger6e899192019-07-23 16:28:57 +020087 )
Derek Perezbc45f922021-04-20 11:36:32 -070088
89 if not native.existing_rule("rules_jvm_external"):
Joshua Haberman01691f62022-04-26 19:27:59 +000090 _github_archive(
Derek Perezbc45f922021-04-20 11:36:32 -070091 name = "rules_jvm_external",
Joshua Haberman01691f62022-04-26 19:27:59 +000092 repo = "https://github.com/bazelbuild/rules_jvm_external",
93 commit = "906875b0d5eaaf61a8ca2c9c3835bde6f435d011",
Deanna Garciaaafcb922022-02-28 18:28:50 +000094 sha256 = "744bd7436f63af7e9872948773b8b106016dc164acb3960b4963f86754532ee7",
Derek Perezbc45f922021-04-20 11:36:32 -070095 )
Deanna Garcia7924cd62022-01-13 00:10:23 +000096
Derek Perez3a4d9312021-11-04 22:57:29 +000097 if not native.existing_rule("rules_pkg"):
98 http_archive(
99 name = "rules_pkg",
100 urls = [
David L. Jones83303ba2022-04-21 17:38:03 -0700101 "https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.7.0/rules_pkg-0.7.0.tar.gz",
102 "https://github.com/bazelbuild/rules_pkg/releases/download/0.7.0/rules_pkg-0.7.0.tar.gz",
Derek Perez3a4d9312021-11-04 22:57:29 +0000103 ],
David L. Jones83303ba2022-04-21 17:38:03 -0700104 sha256 = "8a298e832762eda1830597d64fe7db58178aa84cd5926d76d5b744d6558941c2",
Derek Perez3a4d9312021-11-04 22:57:29 +0000105 )
Deanna Garcia7924cd62022-01-13 00:10:23 +0000106
107 if not native.existing_rule("io_bazel_rules_kotlin"):
108 http_archive(
109 name = "io_bazel_rules_kotlin",
Xùdōng Yángeea13412022-07-05 14:49:57 +0200110 urls = ["https://github.com/bazelbuild/rules_kotlin/releases/download/v1.7.0-RC-1/rules_kotlin_release.tgz"],
111 sha256 = "68b910730026921814d3a504ccbe9adaac9938983d940e626523e6e4ecfb0355",
Deanna Garcia7924cd62022-01-13 00:10:23 +0000112 )
Joshua Habermana6901f02022-04-25 22:00:57 +0000113
114 if not native.existing_rule("upb"):
Joshua Haberman01691f62022-04-26 19:27:59 +0000115 _github_archive(
Joshua Habermana6901f02022-04-25 22:00:57 +0000116 name = "upb",
Joshua Haberman01691f62022-04-26 19:27:59 +0000117 repo = "https://github.com/protocolbuffers/upb",
Mike Kruskal081901b2022-09-09 13:03:37 -0700118 commit = "5485645125ba3783ae2b597bd7b77679721cb1c6",
119 sha256 = "86de85c58eb3cb04b0987a7642ce84e55629f704ab4a9a0210a660a1115f1dd0",
Joshua Habermana6901f02022-04-25 22:00:57 +0000120 )