1"""External dependencies for grpc-java.""" 2 3load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") 4 5# For use with maven_install's artifacts. 6# maven_install( 7# ... 8# artifacts = [ 9# # Your own deps 10# ] + IO_GRPC_GRPC_JAVA_ARTIFACTS, 11# ) 12IO_GRPC_GRPC_JAVA_ARTIFACTS = [ 13 "com.google.android:annotations:4.1.1.4", 14 "com.google.api.grpc:proto-google-common-protos:2.17.0", 15 "com.google.auth:google-auth-library-credentials:1.4.0", 16 "com.google.auth:google-auth-library-oauth2-http:1.4.0", 17 "com.google.auto.value:auto-value-annotations:1.10.1", 18 "com.google.auto.value:auto-value:1.10.1", 19 "com.google.code.findbugs:jsr305:3.0.2", 20 "com.google.code.gson:gson:2.10.1", 21 "com.google.errorprone:error_prone_annotations:2.18.0", 22 "com.google.guava:failureaccess:1.0.1", 23 "com.google.guava:guava:31.1-android", 24 "com.google.re2j:re2j:1.7", 25 "com.google.truth:truth:1.0.1", 26 "com.squareup.okhttp:okhttp:2.7.5", 27 "com.squareup.okio:okio:1.17.5", 28 "io.netty:netty-buffer:4.1.87.Final", 29 "io.netty:netty-codec-http2:4.1.87.Final", 30 "io.netty:netty-codec-http:4.1.87.Final", 31 "io.netty:netty-codec-socks:4.1.87.Final", 32 "io.netty:netty-codec:4.1.87.Final", 33 "io.netty:netty-common:4.1.87.Final", 34 "io.netty:netty-handler-proxy:4.1.87.Final", 35 "io.netty:netty-handler:4.1.87.Final", 36 "io.netty:netty-resolver:4.1.87.Final", 37 "io.netty:netty-tcnative-boringssl-static:2.0.61.Final", 38 "io.netty:netty-tcnative-classes:2.0.61.Final", 39 "io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.87.Final", 40 "io.netty:netty-transport-native-unix-common:4.1.87.Final", 41 "io.netty:netty-transport:4.1.87.Final", 42 "io.opencensus:opencensus-api:0.31.0", 43 "io.opencensus:opencensus-contrib-grpc-metrics:0.31.0", 44 "io.perfmark:perfmark-api:0.26.0", 45 "junit:junit:4.13.2", 46 "org.apache.tomcat:annotations-api:6.0.53", 47 "org.codehaus.mojo:animal-sniffer-annotations:1.23", 48] 49 50# For use with maven_install's override_targets. 51# maven_install( 52# ... 53# override_targets = IO_GRPC_GRPC_JAVA_OVERRIDE_TARGETS, 54# ) 55# 56# If you have your own overrides as well, you can use: 57# override_targets = { 58# "your.target:artifact": "@//third_party/artifact", 59# } | IO_GRPC_GRPC_JAVA_OVERRIDE_TARGETS, 60IO_GRPC_GRPC_JAVA_OVERRIDE_TARGETS = { 61 "com.google.protobuf:protobuf-java": "@com_google_protobuf//:protobuf_java", 62 "com.google.protobuf:protobuf-java-util": "@com_google_protobuf//:protobuf_java_util", 63 "com.google.protobuf:protobuf-javalite": "@com_google_protobuf_javalite//:protobuf_java_lite", 64 "io.grpc:grpc-alts": "@io_grpc_grpc_java//alts", 65 "io.grpc:grpc-api": "@io_grpc_grpc_java//api", 66 "io.grpc:grpc-auth": "@io_grpc_grpc_java//auth", 67 "io.grpc:grpc-census": "@io_grpc_grpc_java//census", 68 "io.grpc:grpc-context": "@io_grpc_grpc_java//context", 69 "io.grpc:grpc-core": "@io_grpc_grpc_java//core:core_maven", 70 "io.grpc:grpc-googleapis": "@io_grpc_grpc_java//googleapis", 71 "io.grpc:grpc-grpclb": "@io_grpc_grpc_java//grpclb", 72 "io.grpc:grpc-netty": "@io_grpc_grpc_java//netty", 73 "io.grpc:grpc-netty-shaded": "@io_grpc_grpc_java//netty:shaded_maven", 74 "io.grpc:grpc-okhttp": "@io_grpc_grpc_java//okhttp", 75 "io.grpc:grpc-protobuf": "@io_grpc_grpc_java//protobuf", 76 "io.grpc:grpc-protobuf-lite": "@io_grpc_grpc_java//protobuf-lite", 77 "io.grpc:grpc-rls": "@io_grpc_grpc_java//rls", 78 "io.grpc:grpc-services": "@io_grpc_grpc_java//services:services_maven", 79 "io.grpc:grpc-stub": "@io_grpc_grpc_java//stub", 80 "io.grpc:grpc-testing": "@io_grpc_grpc_java//testing", 81 "io.grpc:grpc-xds": "@io_grpc_grpc_java//xds:xds_maven", 82} 83 84def grpc_java_repositories(): 85 """Imports dependencies for grpc-java.""" 86 if not native.existing_rule("com_github_cncf_xds"): 87 http_archive( 88 name = "com_github_cncf_xds", 89 strip_prefix = "xds-e9ce68804cb4e64cab5a52e3c8baf840d4ff87b7", 90 sha256 = "0d33b83f8c6368954e72e7785539f0d272a8aba2f6e2e336ed15fd1514bc9899", 91 urls = [ 92 "https://github.com/cncf/xds/archive/e9ce68804cb4e64cab5a52e3c8baf840d4ff87b7.tar.gz", 93 ], 94 ) 95 if not native.existing_rule("com_github_grpc_grpc"): 96 http_archive( 97 name = "com_github_grpc_grpc", 98 strip_prefix = "grpc-1.46.0", 99 sha256 = "67423a4cd706ce16a88d1549297023f0f9f0d695a96dd684adc21e67b021f9bc", 100 urls = [ 101 "https://github.com/grpc/grpc/archive/v1.46.0.tar.gz", 102 ], 103 ) 104 if not native.existing_rule("com_google_protobuf"): 105 com_google_protobuf() 106 if not native.existing_rule("com_google_protobuf_javalite"): 107 com_google_protobuf_javalite() 108 if not native.existing_rule("com_google_googleapis"): 109 http_archive( 110 name = "com_google_googleapis", 111 sha256 = "49930468563dd48283e8301e8d4e71436bf6d27ac27c235224cc1a098710835d", 112 strip_prefix = "googleapis-ca1372c6d7bcb199638ebfdb40d2b2660bab7b88", 113 urls = [ 114 "https://github.com/googleapis/googleapis/archive/ca1372c6d7bcb199638ebfdb40d2b2660bab7b88.tar.gz", 115 ], 116 ) 117 if not native.existing_rule("io_bazel_rules_go"): 118 http_archive( 119 name = "io_bazel_rules_go", 120 sha256 = "ab21448cef298740765f33a7f5acee0607203e4ea321219f2a4c85a6e0fb0a27", 121 urls = [ 122 "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.32.0/rules_go-v0.32.0.zip", 123 "https://github.com/bazelbuild/rules_go/releases/download/v0.32.0/rules_go-v0.32.0.zip", 124 ], 125 ) 126 if not native.existing_rule("io_grpc_grpc_proto"): 127 io_grpc_grpc_proto() 128 if not native.existing_rule("envoy_api"): 129 http_archive( 130 name = "envoy_api", 131 sha256 = "b426904abf51ba21dd8947a05694bb3c861d6f5e436e4673e74d7d7bfb6d3188", 132 strip_prefix = "data-plane-api-268824e4eee3d7770a347a5dc5aaddc0b1b14e24", 133 urls = [ 134 "https://github.com/envoyproxy/data-plane-api/archive/268824e4eee3d7770a347a5dc5aaddc0b1b14e24.tar.gz", 135 ], 136 ) 137 138def com_google_protobuf(): 139 # proto_library rules implicitly depend on @com_google_protobuf//:protoc, 140 # which is the proto-compiler. 141 # This statement defines the @com_google_protobuf repo. 142 http_archive( 143 name = "com_google_protobuf", 144 sha256 = "5d0f05587aa3ad56079b4c4481dcb462267e5f1075d905c321f8ed6339e74ab0", 145 strip_prefix = "protobuf-22.3", 146 urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v22.3/protobuf-22.3.zip"], 147 ) 148 149def com_google_protobuf_javalite(): 150 # java_lite_proto_library rules implicitly depend on @com_google_protobuf_javalite 151 http_archive( 152 name = "com_google_protobuf_javalite", 153 sha256 = "5d0f05587aa3ad56079b4c4481dcb462267e5f1075d905c321f8ed6339e74ab0", 154 strip_prefix = "protobuf-22.3", 155 urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v22.3/protobuf-22.3.zip"], 156 ) 157 158def io_grpc_grpc_proto(): 159 http_archive( 160 name = "io_grpc_grpc_proto", 161 sha256 = "464e97a24d7d784d9c94c25fa537ba24127af5aae3edd381007b5b98705a0518", 162 strip_prefix = "grpc-proto-08911e9d585cbda3a55eb1dcc4b99c89aebccff8", 163 urls = ["https://github.com/grpc/grpc-proto/archive/08911e9d585cbda3a55eb1dcc4b99c89aebccff8.zip"], 164 ) 165