|
| 1 | +# TODO: migrate all dependencies from WORKSPACE to MODULE.bazel |
| 2 | +# https://github.com/protocolbuffers/protobuf/issues/14313 |
| 3 | + |
| 4 | +module( |
| 5 | + name = "protobuf", |
| 6 | + version = "30.0-rc1.bcr.1", # Automatically updated on release |
| 7 | + compatibility_level = 1, |
| 8 | + repo_name = "com_google_protobuf", |
| 9 | +) |
| 10 | + |
| 11 | +# LOWER BOUND dependency versions. |
| 12 | +# Bzlmod follows MVS: |
| 13 | +# https://bazel.build/versions/6.0.0/build/bzlmod#version-resolution |
| 14 | +# Thus the highest version in their module graph is resolved. |
| 15 | +bazel_dep(name = "abseil-cpp", version = "20240722.0", repo_name = "com_google_absl") |
| 16 | +bazel_dep(name = "bazel_skylib", version = "1.7.1") |
| 17 | +bazel_dep(name = "jsoncpp", version = "1.9.6") |
| 18 | +bazel_dep(name = "rules_apple", version = "3.13.0", repo_name = "build_bazel_rules_apple") |
| 19 | +bazel_dep(name = "apple_support", version = "1.15.1", repo_name = "build_bazel_apple_support") |
| 20 | +bazel_dep(name = "rules_cc", version = "0.0.17") |
| 21 | +bazel_dep(name = "rules_fuzzing", version = "0.5.2") |
| 22 | +bazel_dep(name = "rules_java", version = "8.6.1") |
| 23 | +bazel_dep(name = "rules_jvm_external", version = "6.3") |
| 24 | +bazel_dep(name = "rules_kotlin", version = "1.9.6") |
| 25 | +bazel_dep(name = "rules_license", version = "1.0.0") |
| 26 | +bazel_dep(name = "rules_pkg", version = "1.0.1") |
| 27 | +bazel_dep(name = "rules_python", version = "1.0.0") |
| 28 | +bazel_dep(name = "rules_rust", version = "0.51.0") |
| 29 | +bazel_dep(name = "platforms", version = "0.0.10") |
| 30 | +bazel_dep(name = "zlib", version = "1.3.1.bcr.5") |
| 31 | +bazel_dep(name = "bazel_features", version = "1.23.0", repo_name = "proto_bazel_features") |
| 32 | +bazel_dep( |
| 33 | + name = "rules_shell", |
| 34 | + version = "0.2.0", |
| 35 | +) |
| 36 | + |
| 37 | +# Proto toolchains |
| 38 | +register_toolchains("//bazel/private/toolchains:all") |
| 39 | + |
| 40 | +SUPPORTED_PYTHON_VERSIONS = [ |
| 41 | + "3.9", |
| 42 | + "3.10", |
| 43 | + "3.11", |
| 44 | + "3.12", |
| 45 | +] |
| 46 | + |
| 47 | +# TODO: Support hermetic / system python in bzlmod. |
| 48 | +python = use_extension("@rules_python//python/extensions:python.bzl", "python") |
| 49 | + |
| 50 | +[ |
| 51 | + python.toolchain( |
| 52 | + # Disable root warning for .pyc cache misses since CI runs as root. |
| 53 | + # See https://github.com/bazelbuild/rules_python/pull/713 |
| 54 | + ignore_root_user_error = True, |
| 55 | + is_default = python_version == SUPPORTED_PYTHON_VERSIONS[-1], |
| 56 | + python_version = python_version, |
| 57 | + ) |
| 58 | + for python_version in SUPPORTED_PYTHON_VERSIONS |
| 59 | +] |
| 60 | + |
| 61 | +pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip", dev_dependency = True) |
| 62 | + |
| 63 | +[ |
| 64 | + pip.parse( |
| 65 | + hub_name = "protobuf_pip_deps", |
| 66 | + python_version = python_version, |
| 67 | + requirements_lock = "//python:requirements.txt", |
| 68 | + ) |
| 69 | + for python_version in SUPPORTED_PYTHON_VERSIONS |
| 70 | +] |
| 71 | + |
| 72 | +use_repo(pip, "protobuf_pip_deps") |
| 73 | + |
| 74 | +crate = use_extension("@rules_rust//crate_universe:extension.bzl", "crate", dev_dependency = True) |
| 75 | +crate.spec( |
| 76 | + package = "googletest", |
| 77 | + version = ">0.0.0", |
| 78 | +) |
| 79 | +crate.spec( |
| 80 | + package = "paste", |
| 81 | + version = ">=1", |
| 82 | +) |
| 83 | +crate.from_specs() |
| 84 | +use_repo(crate, crate_index = "crates") |
| 85 | + |
| 86 | +maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven", dev_dependency = True) |
| 87 | +maven.install( |
| 88 | + name = "protobuf_maven", |
| 89 | + artifacts = [ |
| 90 | + "com.google.caliper:caliper:1.0-beta-3", |
| 91 | + "com.google.code.findbugs:jsr305:3.0.2", |
| 92 | + "com.google.code.gson:gson:2.8.9", |
| 93 | + "com.google.errorprone:error_prone_annotations:2.5.1", |
| 94 | + "com.google.j2objc:j2objc-annotations:2.8", |
| 95 | + "com.google.guava:guava:32.0.1-jre", |
| 96 | + "com.google.guava:guava-testlib:32.0.1-jre", |
| 97 | + "com.google.testparameterinjector:test-parameter-injector:1.18", |
| 98 | + "com.google.truth:truth:1.1.2", |
| 99 | + "junit:junit:4.13.2", |
| 100 | + "org.mockito:mockito-core:4.3.1", |
| 101 | + "biz.aQute.bnd:biz.aQute.bndlib:6.4.0", |
| 102 | + "info.picocli:picocli:4.6.3", |
| 103 | + ], |
| 104 | + repositories = [ |
| 105 | + "https://repo1.maven.org/maven2", |
| 106 | + "https://repo.maven.apache.org/maven2", |
| 107 | + ], |
| 108 | +) |
| 109 | +use_repo(maven, "protobuf_maven") |
| 110 | + |
| 111 | +# Development dependencies |
| 112 | +bazel_dep(name = "googletest", version = "1.14.0", dev_dependency = True, repo_name = "com_google_googletest") |
| 113 | +bazel_dep(name = "rules_buf", version = "0.3.0", dev_dependency = True) |
| 114 | +bazel_dep(name = "rules_testing", version = "0.6.0", dev_dependency = True) |
| 115 | +bazel_dep( |
| 116 | + name = "abseil-py", |
| 117 | + version = "2.1.0", |
| 118 | + dev_dependency = True, |
| 119 | + repo_name = "com_google_absl_py", |
| 120 | +) |
| 121 | + |
| 122 | +# For clang-cl configuration |
| 123 | +cc_configure = use_extension("@rules_cc//cc:extensions.bzl", "cc_configure_extension") |
| 124 | +use_repo(cc_configure, "local_config_cc") |
| 125 | + |
| 126 | +# rules_proto are needed for @com_google_protobuf_v25.0 used in //compatibility/... tests |
| 127 | +bazel_dep(name = "rules_proto", version = "4.0.0", dev_dependency = True) |
0 commit comments