workspace( name = "com_google_googleapis", # This tells Bazel that the node_modules directory is special and # is managed by the package manager. # https://bazelbuild.github.io/rules_nodejs/install.html managed_directories = {"@npm": ["@gapic_generator_typescript//:node_modules"]}, ) load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") ############################################################################## # Common ############################################################################## load("//:repository_rules.bzl", "switched_rules_by_language") switched_rules_by_language( name = "com_google_googleapis_imports", cc = True, csharp = True, gapic = True, go = True, grpc = True, java = True, nodejs = True, php = True, python = True, ruby = True, ) # Protobuf depends on very old version of bazel_skylib (forward compatible with the new one). # Importing older version of bazel_skylib first (this is one of the things that protobuf_deps() call # below will do) breaks the grpc repositories, so importing the proper version explicitly before # everything else. http_archive( name = "bazel_skylib", urls = ["https://github.com/bazelbuild/bazel-skylib/releases/download/0.9.0/bazel_skylib-0.9.0.tar.gz"], ) # Python rules should go early in the dependencies list, otherwise a wrong # version of the library will be selected as a transitive dependency of gRPC. http_archive( name = "rules_python", strip_prefix = "rules_python-0.9.0", url = "https://github.com/bazelbuild/rules_python/archive/0.9.0.tar.gz", ) http_archive( name = "rules_pkg", sha256 = "8a298e832762eda1830597d64fe7db58178aa84cd5926d76d5b744d6558941c2", urls = [ "https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.7.0/rules_pkg-0.7.0.tar.gz", "https://github.com/bazelbuild/rules_pkg/releases/download/0.7.0/rules_pkg-0.7.0.tar.gz", ], ) load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies") rules_pkg_dependencies() http_archive( name = "com_google_protobuf", sha256 = "ce2fbea3c78147a41b2a922485d283137845303e5e1b6cbd7ece94b96ade7031", strip_prefix = "protobuf-3.21.7", urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.21.7.tar.gz"], ) load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") protobuf_deps() http_archive( name = "rules_proto", sha256 = "602e7161d9195e50246177e7c55b2f39950a9cf7366f74ed5f22fd45750cd208", strip_prefix = "rules_proto-97d8af4dc474595af3900dd85cb3a29ad28cc313", urls = [ "https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz", "https://github.com/bazelbuild/rules_proto/archive/97d8af4dc474595af3900dd85cb3a29ad28cc313.tar.gz", ], ) load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains") rules_proto_dependencies() rules_proto_toolchains() ############################################################################## # Go ############################################################################## # This must be above the download of gRPC (in C++ section) and rules_gapic because both repositories depend on rules_go # and we would rather manage our version of rules_go explicitly rather than depend on the version those bring in transitively. _io_bazel_rules_go_version = "0.33.0" http_archive( name = "io_bazel_rules_go", sha256 = "685052b498b6ddfe562ca7a97736741d87916fe536623afb7da2824c0211c369", urls = [ "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v{0}/rules_go-v{0}.zip".format(_io_bazel_rules_go_version), "https://github.com/bazelbuild/rules_go/releases/download/v{0}/rules_go-v{0}.zip".format(_io_bazel_rules_go_version), ], ) load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") go_rules_dependencies() go_register_toolchains(version = "1.16") # rules_gapic also depends on rules_go, so it must come after our own dependency on rules_go. # It must also come before gapic-generator-go so as to ensure that it does not bring in an old # version of rules_gapic. _rules_gapic_version = "0.17.0" _rules_gapic_sha256 = "3fd8b13f0b801c5efc1bb24cf08c33ddc61793ba48818154058c2c533dfc11c5" http_archive( name = "rules_gapic", sha256 = _rules_gapic_sha256, strip_prefix = "rules_gapic-%s" % _rules_gapic_version, urls = ["https://github.com/googleapis/rules_gapic/archive/v%s.tar.gz" % _rules_gapic_version], ) load("@rules_gapic//:repositories.bzl", "rules_gapic_repositories") rules_gapic_repositories() # Gazelle dependency version should match gazelle dependency expected by gRPC _bazel_gazelle_version = "0.24.0" http_archive( name = "bazel_gazelle", sha256 = "de69a09dc70417580aabf20a28619bb3ef60d038470c7cf8442fafcf627c21cb", urls = [ "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v{0}/bazel-gazelle-v{0}.tar.gz".format(_bazel_gazelle_version), "https://github.com/bazelbuild/bazel-gazelle/releases/download/v{0}/bazel-gazelle-v{0}.tar.gz".format(_bazel_gazelle_version), ], ) _gapic_generator_go_version = "0.33.3" http_archive( name = "com_googleapis_gapic_generator_go", repo_mapping = { "@go_googleapis": "@com_google_googleapis", }, strip_prefix = "gapic-generator-go-%s" % _gapic_generator_go_version, urls = ["https://github.com/googleapis/gapic-generator-go/archive/v%s.tar.gz" % _gapic_generator_go_version], ) load("@com_googleapis_gapic_generator_go//:repositories.bzl", "com_googleapis_gapic_generator_go_repositories") com_googleapis_gapic_generator_go_repositories() # Gazelle dependencies should go after gapic-generator-go dependencies to make sure that # gazelle does not override some of the critical dependencies of the gapic-generator-go. # At the same time gazelle repository itself must be imported before gapic-generator-go, # because gapic-generator-go depends on go_repository rule, which is defined in gazelle repo. load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") gazelle_dependencies() ############################################################################## # C++ ############################################################################## # C++ must go before everything else, since the key dependencies (protobuf and gRPC) # are C++ repositories and they have the highest chance to have the correct versions of the # transitive dependencies (for those dependencies which are shared by many other repositories # imported in this workspace). # # Note, even though protobuf and gRPC are mostly written in C++, they are used to generate stuff # for most of the other languages as well, so they can be considered as the core cross-language # dependencies. # Import boringssl explicitly to override what gRPC imports as its dependency. # Boringssl build fails on gcc12 without this fix: # https://github.com/google/boringssl/commit/8462a367bb57e9524c3d8eca9c62733c63a63cf4, # which is present only in the newest version of boringssl, not the one imported # by gRPC. Remove this import once gRPC depends on a newer version. http_archive( name = "boringssl", sha256 = "b460f8673f3393e58ce506e9cdde7f2c3b2575b075f214cb819fb57d809f052b", strip_prefix = "boringssl-bb41bc007079982da419c0ec3186e510cbcf09d0", urls = [ "https://github.com/google/boringssl/archive/bb41bc007079982da419c0ec3186e510cbcf09d0.zip", ], ) _grpc_version = "1.47.0" _grpc_sha256 = "edf25f4db6c841853b7a29d61b0980b516dc31a1b6cdc399bcf24c1446a4a249" http_archive( name = "com_github_grpc_grpc", sha256 = _grpc_sha256, strip_prefix = "grpc-%s" % _grpc_version, urls = ["https://github.com/grpc/grpc/archive/v%s.zip" % _grpc_version], ) load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps") grpc_deps() # gRPC enforces a specific version of Go toolchain which conflicts with our build. # All the relevant parts of grpc_extra_deps() are imported in this WORKSPACE file # explicitly, that is why we do not call grpc_extra_deps() here. load("@build_bazel_rules_apple//apple:repositories.bzl", "apple_rules_dependencies") apple_rules_dependencies() load("@build_bazel_apple_support//lib:repositories.bzl", "apple_support_dependencies") apple_support_dependencies() ############################################################################## # Java ############################################################################## load("@com_google_protobuf//:protobuf_deps.bzl", "PROTOBUF_MAVEN_ARTIFACTS") # Starting in protobuf 3.19, protobuf project started to provide # PROTOBUF_MAVEN_ARTIFACTS variable so that Bazel users can resolve their # dependencies through maven_install. # https://github.com/protocolbuffers/protobuf/issues/9132 RULES_JVM_EXTERNAL_TAG = "4.2" RULES_JVM_EXTERNAL_SHA = "cd1a77b7b02e8e008439ca76fd34f5b07aecb8c752961f9640dea15e9e5ba1ca" http_archive( name = "rules_jvm_external", sha256 = RULES_JVM_EXTERNAL_SHA, strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG, url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % RULES_JVM_EXTERNAL_TAG, ) load("@rules_jvm_external//:defs.bzl", "maven_install") maven_install( artifacts = PROTOBUF_MAVEN_ARTIFACTS, generate_compat_repositories = True, repositories = [ "https://repo.maven.apache.org/maven2/", ], ) _gax_java_version = "2.19.4" http_archive( name = "com_google_api_gax_java", strip_prefix = "gax-java-%s" % _gax_java_version, urls = ["https://github.com/googleapis/gax-java/archive/v%s.zip" % _gax_java_version], ) load("@com_google_api_gax_java//:repository_rules.bzl", "com_google_api_gax_java_properties") com_google_api_gax_java_properties( name = "com_google_api_gax_java_properties", file = "@com_google_api_gax_java//:dependencies.properties", ) load("@com_google_api_gax_java//:repositories.bzl", "com_google_api_gax_java_repositories") com_google_api_gax_java_repositories() load("@io_grpc_grpc_java//:repositories.bzl", "grpc_java_repositories") grpc_java_repositories() # Java microgenerator. # Must go AFTER java-gax, since both java gax and gapic-generator are written in java and may conflict. _gapic_generator_java_version = "2.10.1" http_archive( name = "gapic_generator_java", strip_prefix = "gapic-generator-java-%s" % _gapic_generator_java_version, urls = ["https://github.com/googleapis/gapic-generator-java/archive/v%s.zip" % _gapic_generator_java_version], ) load("@gapic_generator_java//:repositories.bzl", "gapic_generator_java_repositories") gapic_generator_java_repositories() ############################################################################## # Python ############################################################################## load("@rules_gapic//python:py_gapic_repositories.bzl", "py_gapic_repositories") py_gapic_repositories() load("@rules_python//python:pip.bzl", "pip_install") pip_install() _gapic_generator_python_version = "1.5.0" http_archive( name = "gapic_generator_python", strip_prefix = "gapic-generator-python-%s" % _gapic_generator_python_version, urls = ["https://github.com/googleapis/gapic-generator-python/archive/v%s.zip" % _gapic_generator_python_version], ) load( "@gapic_generator_python//:repositories.bzl", "gapic_generator_python", "gapic_generator_register_toolchains", ) gapic_generator_python() gapic_generator_register_toolchains() ############################################################################## # TypeScript ############################################################################## _gapic_generator_typescript_version = "2.18.2" _gapic_generator_typescript_sha256 = "45dfd7f059f45f83352a2d9438c1ed021817d9c894220cbd9578b1580194b937" ### TypeScript generator http_archive( name = "gapic_generator_typescript", sha256 = _gapic_generator_typescript_sha256, strip_prefix = "gapic-generator-typescript-%s" % _gapic_generator_typescript_version, urls = ["https://github.com/googleapis/gapic-generator-typescript/archive/v%s.tar.gz" % _gapic_generator_typescript_version], ) load("@gapic_generator_typescript//:repositories.bzl", "gapic_generator_typescript_repositories") gapic_generator_typescript_repositories() load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "yarn_install") node_repositories( package_json = ["@gapic_generator_typescript//:package.json"], ) yarn_install( name = "npm", package_json = "@gapic_generator_typescript//:package.json", yarn_lock = "@gapic_generator_typescript//:yarn.lock", ) ############################################################################## # PHP ############################################################################## # PHP micro-generator _gapic_generator_php_version = "1.5.0" http_archive( name = "gapic_generator_php", strip_prefix = "gapic-generator-php-%s" % _gapic_generator_php_version, urls = ["https://github.com/googleapis/gapic-generator-php/archive/v%s.zip" % _gapic_generator_php_version], ) load("@rules_gapic//php:php_gapic_repositories.bzl", "php", "php_gapic_repositories") # TODO(ndietz): upgrade to PHP 8x php( name = "php", prebuilt_phps = ["@gapic_generator_php//rules_php_gapic:resources/php-7.4.15_linux_x86_64.tar.gz"], strip_prefix = "php-7.4.15", urls = ["https://www.php.net/distributions/php-7.4.15.tar.gz"], ) php_gapic_repositories() load("@gapic_generator_php//:repositories.bzl", "gapic_generator_php_repositories") gapic_generator_php_repositories() ############################################################################## # C# ############################################################################## # Required to access the C#-specific common resources config. _gax_dotnet_version = "Google.Api.Gax-3.3.0" _gax_dotnet_sha256 = "c4d31345a226987e8551cb81afa685c9322d3f806077d9f02011676cf00c15d9" http_archive( name = "gax_dotnet", build_file_content = "exports_files([\"Google.Api.Gax/ResourceNames/CommonResourcesConfig.json\"])", sha256 = _gax_dotnet_sha256, strip_prefix = "gax-dotnet-%s" % _gax_dotnet_version, urls = ["https://github.com/googleapis/gax-dotnet/archive/refs/tags/%s.tar.gz" % _gax_dotnet_version], ) _gapic_generator_csharp_version = "1.4.8" _gapic_generator_csharp_sha256 = "1c155829aabb32a1e94fb9c4fe70054d683b1142fe7853c01f3adc3d5b184a6e" http_archive( name = "gapic_generator_csharp", sha256 = _gapic_generator_csharp_sha256, strip_prefix = "gapic-generator-csharp-%s" % _gapic_generator_csharp_version, urls = ["https://github.com/googleapis/gapic-generator-csharp/archive/refs/tags/v%s.tar.gz" % _gapic_generator_csharp_version], ) load("@gapic_generator_csharp//:repositories.bzl", "gapic_generator_csharp_repositories") gapic_generator_csharp_repositories() # Version of C# generator targeting GAX v3. This is present so that teams that # do not want to move immediately to GAX v4 when it comes out (e.g. Ads) are # able to stick with the GAX-v3-based generator. _gapic_generator_csharp_gax_v3_version = "1.3.20" _gapic_generator_csharp_gax_v3_sha256 = "20cacae7641c51eda434adb1279716030def82c2617f4d3507ba56478ff879f9" http_archive( name = "gapic_generator_csharp_gax_v3", repo_mapping = { "@gapic_generator_restore": "@gapic_generator_restore_gax_v3", }, sha256 = _gapic_generator_csharp_gax_v3_sha256, strip_prefix = "gapic-generator-csharp-%s" % _gapic_generator_csharp_gax_v3_version, urls = ["https://github.com/googleapis/gapic-generator-csharp/archive/refs/tags/v%s.tar.gz" % _gapic_generator_csharp_gax_v3_version], ) load("@gapic_generator_csharp_gax_v3//:repositories.bzl", gapic_generator_csharp_repositories_gax_v3 = "gapic_generator_csharp_repositories") gapic_generator_csharp_repositories_gax_v3(gapic_generator_suffix = "_gax_v3") ############################################################################## # Ruby ############################################################################## _gapic_generator_ruby_version = "v0.17.1" _gapic_generator_ruby_sha256 = "0294824beee2ed14af99154324c1776efb0a36f4975fa01954ba73067bdd0dcb" http_archive( name = "gapic_generator_ruby", sha256 = _gapic_generator_ruby_sha256, strip_prefix = "gapic-generator-ruby-gapic-generator-%s" % _gapic_generator_ruby_version, urls = ["https://github.com/googleapis/gapic-generator-ruby/archive/refs/tags/gapic-generator/%s.tar.gz" % _gapic_generator_ruby_version], ) load("@gapic_generator_ruby//rules_ruby_gapic:repositories.bzl", "gapic_generator_ruby_repositories") gapic_generator_ruby_repositories() ############################################################################## # Discovery ############################################################################## _disco_to_proto3_converter_version = "c47a76dd3d591478dd1a902413636c06da1153b8" http_archive( name = "com_google_disco_to_proto3_converter", strip_prefix = "disco-to-proto3-converter-%s" % _disco_to_proto3_converter_version, urls = ["https://github.com/googleapis/disco-to-proto3-converter/archive/%s.zip" % _disco_to_proto3_converter_version], ) load("@com_google_disco_to_proto3_converter//:repository_rules.bzl", "com_google_disco_to_proto3_converter_properties") com_google_disco_to_proto3_converter_properties( name = "com_google_disco_to_proto3_converter_properties", file = "@com_google_disco_to_proto3_converter//:pom.xml", ) load("@com_google_disco_to_proto3_converter//:repositories.bzl", "com_google_disco_to_proto3_converter_repositories") com_google_disco_to_proto3_converter_repositories()