@@ -2,124 +2,138 @@ workspace(name = "gapic_generator_python")
22
33load ("@bazel_tools//tools/build_defs/repo:http.bzl" , "http_archive" )
44
5- _bazel_skylib_version = "1.4.0"
5+ # =========================================================================
6+ # 1. LOAD MODERN DEPENDENCIES FIRST (CRITICAL: FIRST-LOAD WINS)
7+ # =========================================================================
8+ # Load Protobuf 35.1
9+ http_archive (
10+ name = "com_google_protobuf" ,
11+ strip_prefix = "protobuf-35.1" ,
12+ urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v35.1/protobuf-35.1.zip" ],
13+ )
614
7- _bazel_skylib_sha256 = "f24ab666394232f834f74d19e2ff142b0af17466ea0c69a3f4c276ee75f6efce"
15+ # Load standard, unpatched rules_gapic v1.0.0
16+ http_archive (
17+ name = "rules_gapic" ,
18+ strip_prefix = "rules_gapic-1.0.0" ,
19+ urls = [
20+ "https://github.com/googleapis/rules_gapic/archive/v1.0.0.tar.gz"
21+ ],
22+ patch_cmds = [
23+ # Safely buffer files in memory first to prevent truncation, then insert the load statement [11]
24+ "python3 -c \" import glob; [open(f, 'w').write('load(\\ \" @rules_proto//proto:defs.bzl\\ \" , \\ \" ProtoInfo\\ \" )\\ n' + c) for f, c in [(f, open(f).read()) for f in glob.glob('**/*.bzl', recursive=True)] if 'ProtoInfo' in c and '@rules_proto//proto:defs.bzl' not in c]\" "
25+ ],
26+ )
827
28+ http_archive (
29+ name = "rules_cc" ,
30+ urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.1.5/rules_cc-0.1.5.tar.gz" ],
31+ strip_prefix = "rules_cc-0.1.5" ,
32+ )
33+
34+ _bazel_skylib_version = "1.9.0"
935http_archive (
1036 name = "bazel_skylib" ,
11- sha256 = _bazel_skylib_sha256 ,
1237 url = "https://github.com/bazelbuild/bazel-skylib/releases/download/{0}/bazel-skylib-{0}.tar.gz" .format (_bazel_skylib_version ),
1338)
1439
40+ http_archive (
41+ name = "com_google_absl" ,
42+ strip_prefix = "abseil-cpp-20240722.1" ,
43+ urls = [
44+ "https://github.com/abseil/abseil-cpp/releases/download/20240722.1/abseil-cpp-20240722.1.tar.gz" ,
45+ ],
46+ )
47+
1548_io_bazel_rules_go_version = "0.33.0"
1649http_archive (
1750 name = "io_bazel_rules_go" ,
18- sha256 = "685052b498b6ddfe562ca7a97736741d87916fe536623afb7da2824c0211c369" ,
1951 urls = [
2052 "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v{0}/rules_go-v{0}.zip" .format (_io_bazel_rules_go_version ),
2153 "https://github.com/bazelbuild/rules_go/releases/download/v{0}/rules_go-v{0}.zip" .format (_io_bazel_rules_go_version ),
2254 ],
2355)
2456
25- _rules_python_version = "0.26.0"
26-
27- _rules_python_sha256 = "9d04041ac92a0985e344235f5d946f71ac543f1b1565f2cdbc9a2aaee8adf55b"
28-
57+ # =========================================================================
58+ # UPGRADED: rules_python v1.1.0 (No sha256) [11]
59+ # =========================================================================
60+ _rules_python_version = "1.1.0"
2961http_archive (
3062 name = "rules_python" ,
31- sha256 = _rules_python_sha256 ,
3263 strip_prefix = "rules_python-{}" .format (_rules_python_version ),
33- url = "https://github.com/bazelbuild/rules_python/archive/{ }.tar.gz" .format (_rules_python_version ),
64+ url = "https://github.com/bazelbuild/rules_python/releases/download/{0}/rules_python-{0 }.tar.gz" .format (_rules_python_version ),
3465)
3566
3667load ("@rules_python//python:repositories.bzl" , "py_repositories" )
37-
3868py_repositories ()
3969
4070load ("@rules_python//python:pip.bzl" , "pip_parse" )
41-
42-
4371pip_parse (
4472 name = "gapic_generator_python_pip_deps" ,
45- requirements_lock = "//:requirements.txt" ,
73+ requirements_lock = "//:requirements.txt" ,
4674)
47- load ("@gapic_generator_python_pip_deps//:requirements.bzl" , "install_deps" )
4875
76+ load ("@gapic_generator_python_pip_deps//:requirements.bzl" , "install_deps" )
4977install_deps ()
50- #
51- # Import gapic-generator-python specific dependencies
52- #
53- load (
54- "//:repositories.bzl" ,
55- "gapic_generator_python" ,
56- "gapic_generator_register_toolchains" ,
57- )
58-
59- gapic_generator_python ()
60-
61- gapic_generator_register_toolchains ()
62-
63- _grpc_version = "1.71.0"
64-
65- _grpc_sha256 = "9313c3f8f4dd3341597f152d506a50caf571fe40f886e24ea9078891990df285"
6678
79+ # =========================================================================
80+ # 2. LOAD THE UNPATCHED UPSTREAM gRPC REPOSITORY
81+ # =========================================================================
82+ _grpc_version = "816506e5c0434a42414af6955cc9eef0c562ff3a"
6783http_archive (
6884 name = "com_github_grpc_grpc" ,
69- sha256 = _grpc_sha256 ,
70- strip_prefix = "grpc-%s" % _grpc_version ,
71- urls = ["https://github.com/grpc/grpc/archive/v%s.zip" % _grpc_version ],
85+ strip_prefix = "grpc-816506e5c0434a42414af6955cc9eef0c562ff3a" ,
86+ urls = ["https://github.com/grpc/grpc/archive/816506e5c0434a42414af6955cc9eef0c562ff3a.zip" ],
7287)
73- # instantiated in grpc_deps().
74-
75- _protobuf_version = "30.2"
7688
77- _protobuf_sha256 = "07a43d88fe5a38e434c7f94129cad56a4c43a51f99336074d0799c2f7d4e44c5"
78-
79- http_archive (
80- name = "com_google_protobuf" ,
81- sha256 = _protobuf_sha256 ,
82- strip_prefix = "protobuf-%s" % _protobuf_version ,
83- urls = ["https://github.com/protocolbuffers/protobuf/archive/v%s.tar.gz" % _protobuf_version ],
84- )
8589load ("@com_github_grpc_grpc//bazel:grpc_deps.bzl" , "grpc_deps" )
86-
8790grpc_deps ()
8891
89- http_archive (
90- name = "rules_cc" ,
91- urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.1.1/rules_cc-0.1.1.tar.gz" ],
92- sha256 = "712d77868b3152dd618c4d64faaddefcc5965f90f5de6e6dd1d5ddcd0be82d42" ,
93- strip_prefix = "rules_cc-0.1.1" ,
92+ # =========================================================================
93+ # 3. LOAD GAPIC-GENERATOR DEPENDENCIES
94+ # =========================================================================
95+ load (
96+ "//:repositories.bzl" ,
97+ "gapic_generator_python" ,
98+ "gapic_generator_register_toolchains" ,
9499)
100+ gapic_generator_python ()
101+ gapic_generator_register_toolchains ()
95102
96- load ("@com_google_protobuf//:protobuf_deps.bzl" , "protobuf_deps" , "PROTOBUF_MAVEN_ARTIFACTS" )
97- # This is actually already done within grpc_deps but calling this for Bazel convention.
98- protobuf_deps ()
99-
100- # Add rules_java to resolve the following error
101- # `The repository '@compatibility_proxy' could not be resolved: Repository '@compatibility_proxy' is not defined`
103+ # Add rules_java to resolve compatibility proxy errors
102104load ("@rules_java//java:rules_java_deps.bzl" , "rules_java_dependencies" )
103-
104105rules_java_dependencies ()
105106
106- # gRPC enforces a specific version of Go toolchain which conflicts with our build.
107- # All the relevant parts of grpc_extra_deps() are imported in this WORKSPACE file
108- # explicitly, that is why we do not call grpc_extra_deps() here and call
109- # apple_rules_dependencies and apple_support_dependencies macros explicitly.
107+ # =========================================================================
108+ # 4. LOAD TRANSITIVE PROTO DEPENDENCIES & REGISTER TOOLCHAINS
109+ # =========================================================================
110+ load ("@com_google_protobuf//:protobuf_deps.bzl" , "protobuf_deps" )
111+ protobuf_deps ()
110112
111- load ("@build_bazel_rules_apple//apple:repositories.bzl" , "apple_rules_dependencies" )
113+ load ("@rules_proto//proto:repositories.bzl" , "rules_proto_dependencies" )
114+ rules_proto_dependencies ()
115+
116+ load ("@rules_proto//proto:toolchains.bzl" , "rules_proto_toolchains" )
117+ rules_proto_toolchains ()
112118
119+ # =========================================================================
120+ # 5. LOAD SUPPORTING PLATFORMS
121+ # =========================================================================
122+ load ("@build_bazel_rules_apple//apple:repositories.bzl" , "apple_rules_dependencies" )
113123apple_rules_dependencies ()
114124
115125load ("@build_bazel_apple_support//lib:repositories.bzl" , "apple_support_dependencies" )
116-
117126apple_support_dependencies ()
118127
119128load ("@com_google_googleapis//:repository_rules.bzl" , "switched_rules_by_language" )
120-
121129switched_rules_by_language (
122130 name = "com_google_googleapis_imports" ,
123131 gapic = True ,
124132 grpc = True ,
125133)
134+
135+ load ("@rules_python//python:repositories.bzl" , "python_register_toolchains" )
136+ python_register_toolchains (
137+ name = "python311" ,
138+ python_version = "3.11" ,
139+ )
0 commit comments