Skip to content

Commit 08dd787

Browse files
Internal change
PiperOrigin-RevId: 917337474
1 parent b60b825 commit 08dd787

7 files changed

Lines changed: 185 additions & 13 deletions

File tree

MODULE.bazel

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,27 @@ module(
33
)
44

55
# https://registry.bazel.build/modules/abseil-cpp
6-
bazel_dep(name = "abseil-cpp", version = "20250814.1", repo_name = "com_google_absl")
6+
bazel_dep(name = "abseil-cpp", version = "20260107.0", repo_name = "com_google_absl")
77

88
# https://registry.bazel.build/modules/abseil-py
9-
bazel_dep(name = "abseil-py", version = "2.1.0", repo_name = "com_google_absl_py")
9+
bazel_dep(name = "abseil-py", version = "2.4.0", repo_name = "com_google_absl_py")
1010

1111
# https://github.com/bazelbuild/bazel-skylib
12-
bazel_dep(name = "bazel_skylib", version = "1.8.2")
12+
bazel_dep(name = "bazel_skylib", version = "1.9.0")
1313

1414
# https://registry.bazel.build/modules/cel-cpp
1515
bazel_dep(name = "cel-cpp", version = "0.15.0", repo_name = "com_google_cel_cpp")
16-
single_version_override(
16+
git_override(
1717
module_name = "cel-cpp",
18+
commit = "2e6e9ff4493bfbe0baf883107f3fb7ce6f675d88",
1819
patch_cmds = [
1920
# ABSL_CONST_INIT is incompatible with MSVC-CL with the /std:c++20 option
2021
"sed -i 's/ABSL_CONST_INIT //g' common/values/optional_value.cc",
2122
],
22-
version = "0.15.0",
23+
patch_cmds_win = [
24+
"python -c \"import sys; path='common/values/optional_value.cc'; content=open(path).read(); open(path,'w').write(content.replace('ABSL_CONST_INIT ',''))\"",
25+
],
26+
remote = "https://github.com/google/cel-cpp",
2327
)
2428

2529
# https://registry.bazel.build/modules/cel-spec
@@ -32,7 +36,7 @@ bazel_dep(name = "googletest", version = "1.17.0.bcr.2", repo_name = "com_google
3236
bazel_dep(name = "platforms", version = "1.0.0")
3337

3438
# https://registry.bazel.build/modules/protobuf
35-
bazel_dep(name = "protobuf", version = "33.1", repo_name = "com_google_protobuf")
39+
bazel_dep(name = "protobuf", version = "33.4", repo_name = "com_google_protobuf")
3640

3741
# https://registry.bazel.build/modules/pybind11_abseil
3842
bazel_dep(name = "pybind11_abseil", version = "202402.0")
@@ -41,25 +45,33 @@ bazel_dep(name = "pybind11_abseil", version = "202402.0")
4145
bazel_dep(name = "pybind11_bazel", version = "3.0.0")
4246

4347
# https://registry.bazel.build/modules/rules_cc
44-
bazel_dep(name = "rules_cc", version = "0.2.14")
48+
bazel_dep(name = "rules_cc", version = "0.2.16")
4549

4650
# https://registry.bazel.build/modules/rules_proto
4751
bazel_dep(name = "rules_proto", version = "7.1.0")
4852

4953
# https://registry.bazel.build/modules/rules_python
50-
bazel_dep(name = "rules_python", version = "1.7.0")
54+
bazel_dep(name = "rules_python", version = "1.9.0")
5155

5256
# On Windows the file system is case-insensitive, which creates a collision between
5357
# antlr4-cpp-runtime/VERSION and the system `#include <version>`
5458
single_version_override(
5559
module_name = "antlr4-cpp-runtime",
5660
patch_cmds = [
57-
"mv VERSION VERSION.txt",
61+
"python -c \"import os; os.rename('VERSION', 'VERSION.txt') if os.path.exists('VERSION') else None\"",
5862
],
5963
)
6064

61-
python_rules = use_extension("@rules_python//python/extensions:python.bzl", "python")
62-
python_rules.toolchain(
63-
is_default = True,
64-
python_version = "3.11",
65+
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
66+
python.defaults(python_version = "3.11")
67+
python.toolchain(python_version = "3.11")
68+
use_repo(python, "pythons_hub")
69+
70+
pybind11_internal_configure = use_extension(
71+
"@pybind11_bazel//:internal_configure.bzl",
72+
"internal_configure_extension",
6573
)
74+
use_repo(pybind11_internal_configure, "pybind11")
75+
76+
local_repo_ext = use_extension("//cel_expr_python:local_repo_extension.bzl", "local_repo_ext")
77+
use_repo(local_repo_ext, "python_headers_custom")

cel_expr_python/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ pybind_library(
125125
"@com_google_cel_cpp//compiler",
126126
"@com_google_cel_cpp//runtime:runtime_builder",
127127
"@com_google_cel_cpp//runtime:runtime_options",
128+
"@python_headers_custom//:headers",
128129
],
129130
)
130131

cel_expr_python/ext/BUILD

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pybind_extension(
1616
"//cel_expr_python:cel_extension",
1717
"@com_google_cel_cpp//compiler",
1818
"@com_google_cel_cpp//extensions:bindings_ext",
19+
"@python_headers_custom//:headers",
1920
],
2021
)
2122

@@ -36,6 +37,7 @@ pybind_extension(
3637
"@com_google_cel_cpp//extensions:encoders",
3738
"@com_google_cel_cpp//runtime:runtime_builder",
3839
"@com_google_cel_cpp//runtime:runtime_options",
40+
"@python_headers_custom//:headers",
3941
],
4042
)
4143

@@ -58,6 +60,7 @@ pybind_extension(
5860
"@com_google_cel_cpp//extensions:math_ext_decls",
5961
"@com_google_cel_cpp//runtime:runtime_builder",
6062
"@com_google_cel_cpp//runtime:runtime_options",
63+
"@python_headers_custom//:headers",
6164
],
6265
)
6366

@@ -81,6 +84,7 @@ pybind_extension(
8184
"@com_google_cel_cpp//runtime:optional_types",
8285
"@com_google_cel_cpp//runtime:runtime_builder",
8386
"@com_google_cel_cpp//runtime:runtime_options",
87+
"@python_headers_custom//:headers",
8488
],
8589
)
8690

@@ -98,6 +102,7 @@ pybind_extension(
98102
"//cel_expr_python:cel_extension",
99103
"@com_google_cel_cpp//compiler",
100104
"@com_google_cel_cpp//extensions:proto_ext",
105+
"@python_headers_custom//:headers",
101106
],
102107
)
103108

@@ -119,5 +124,6 @@ pybind_extension(
119124
"@com_google_cel_cpp//extensions:strings",
120125
"@com_google_cel_cpp//runtime:runtime_builder",
121126
"@com_google_cel_cpp//runtime:runtime_options",
127+
"@python_headers_custom//:headers",
122128
],
123129
)
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
"""Module extension to create a local repository for custom headers."""
2+
3+
def _custom_headers_repo_impl(ctx):
4+
# Resolve label to path
5+
build_file_path = ctx.path(ctx.attr.build_file_label)
6+
repo_dir = build_file_path.dirname
7+
8+
# Symlink the include directory
9+
ctx.symlink(repo_dir.get_child("include"), "include")
10+
11+
# Create BUILD file
12+
ctx.file("BUILD.bazel", """
13+
cc_library(
14+
name = "headers",
15+
hdrs = glob(["include/python3.11/**"]),
16+
includes = ["include/python3.11"],
17+
visibility = ["//visibility:public"],
18+
)
19+
""")
20+
21+
custom_headers_repo = repository_rule(
22+
implementation = _custom_headers_repo_impl,
23+
attrs = {
24+
"build_file_label": attr.label(mandatory = True),
25+
},
26+
)
27+
28+
def _local_repo_extension_impl(_ctx):
29+
custom_headers_repo(
30+
name = "python_headers_custom",
31+
build_file_label = "@@rules_python++python+python_3_11_x86_64-unknown-linux-gnu//:BUILD.bazel",
32+
)
33+
34+
local_repo_ext = module_extension(
35+
implementation = _local_repo_extension_impl,
36+
)
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
@echo off
2+
setlocal enabledelayedexpansion
3+
4+
echo --- Environment Info ---
5+
echo Host Name: %COMPUTERNAME%
6+
echo User Name: %USERNAME%
7+
echo Current Directory: %CD%
8+
9+
:: Change directory to the repository root (moving up from release/kokoro)
10+
cd /d "%~dp0..\.."
11+
echo New Directory: %CD%
12+
13+
set "NO_PROXY=bcr.bazel.build,bazel.build"
14+
set "no_proxy=bcr.bazel.build,bazel.build"
15+
echo NO_PROXY set to bcr.bazel.build,bazel.build
16+
17+
echo --- Locating Bash ---
18+
where bash.exe
19+
20+
set "BAZEL_SH=C:\msys64\usr\bin\bash.exe"
21+
echo BAZEL_SH set to %BAZEL_SH%
22+
23+
echo --- Disabling Windows System Proxy ---
24+
powershell -ExecutionPolicy Bypass -file "%~dp0proxy_ctrl.ps1" -disable
25+
26+
27+
28+
echo --- Testing Network via Curl ---
29+
curl -I https://bcr.bazel.build/
30+
curl -I https://bcr.bazel.build/modules/abseil-py/2.4.0/patches/module_dot_bazel.patch
31+
32+
set PYTHON_EXE=python
33+
where python3.11 >nul 2>&1
34+
if !ERRORLEVEL! EQU 0 (
35+
set PYTHON_EXE=python3.11
36+
) else if exist C:\Python311\python.exe (
37+
set PYTHON_EXE=C:\Python311\python.exe
38+
)
39+
40+
echo --- Python Version ---
41+
!PYTHON_EXE! --version
42+
43+
echo --- Bazel Version ---
44+
bazel version
45+
46+
echo --- Bazel Build ---
47+
bazel "--host_jvm_args=-Dhttp.proxyHost=" "--host_jvm_args=-Dhttps.proxyHost=" "--host_jvm_args=-Dhttp.proxyPort=" "--host_jvm_args=-Dhttps.proxyPort=" build "--repo_env=no_proxy=bcr.bazel.build,bazel.build" "--repo_env=NO_PROXY=bcr.bazel.build,bazel.build" --http_connector_attempts=5 --experimental_repository_downloader_retries=5 --config=windows --verbose_failures //...
48+
if !ERRORLEVEL! NEQ 0 (
49+
echo Build failed!
50+
exit /b 1
51+
)
52+
53+
echo --- Bazel Test ---
54+
bazel "--host_jvm_args=-Dhttp.proxyHost=" "--host_jvm_args=-Dhttps.proxyHost=" "--host_jvm_args=-Dhttp.proxyPort=" "--host_jvm_args=-Dhttps.proxyPort=" test "--repo_env=no_proxy=bcr.bazel.build,bazel.build" "--repo_env=NO_PROXY=bcr.bazel.build,bazel.build" --http_connector_attempts=5 --experimental_repository_downloader_retries=5 --config=windows --test_output=errors //...
55+
if !ERRORLEVEL! NEQ 0 (
56+
echo Tests failed!
57+
exit /b 1
58+
)
59+
60+
echo --- Success ---
61+
echo Build and tests passed successfully.

release/kokoro/proxy_ctrl.ps1

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Enable or disable the proxy with various options
2+
#
3+
# -proxy : Address and port of the proxy (defaults to 192.168.0.3:8888). Note, a valid proxy_reg
4+
# (see below) is required as well.
5+
#
6+
# -override: The proxy overide (defaults to <local> (localhost)). Note, a valid proxy_reg (see
7+
# below) is required as well.
8+
#
9+
# -proxy_reg : Path to the registry file that contains the actual IE proxy settings in a hex
10+
# key value pair. To generate a version of this, manually set the proxy using internet
11+
# settings in Windows, and then export the
12+
# HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections\DefaultConnectionSettings
13+
# and HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections\SavedLegacySettings
14+
# keys into a reg file. This is required for the proxy to work.
15+
#
16+
# -enable : Enable the proxy.
17+
#
18+
# -disable : Disable the proxy.
19+
20+
param (
21+
[string]$proxy = "192.168.0.3:8888",
22+
[string]$proxy_reg = "$env:KOKORO_PIPER_DIR\google3\devtools\kokoro\vanadium\windows_scripts\win7_proxy_settings.reg",
23+
[switch]$enable = $false,
24+
[switch]$disable = $false,
25+
[string]$override = "`"<local>`""
26+
)
27+
28+
function Enable-Proxy {
29+
Write-Host "Enabling Windows proxy via $proxy"
30+
$reg_key = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
31+
Set-ItemProperty -path $reg_key ProxyServer -value $proxy
32+
Set-ItemProperty -path $reg_key ProxyOverride -value "$override"
33+
Set-ItemProperty -path $reg_key ProxyEnable -value 1
34+
Invoke-Expression "& netsh winhttp set proxy $proxy $override"
35+
Invoke-Expression "& regedit.exe /s $proxy_reg"
36+
}
37+
38+
function Disable-Proxy {
39+
Write-Host "Disabling Windows proxy"
40+
$reg_key = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
41+
Set-ItemProperty -path $reg_key ProxyEnable -value 0
42+
$reg_key = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections"
43+
Set-ItemProperty -path $reg_key DefaultConnectionSettings -value ""
44+
Set-ItemProperty -path $reg_key SavedLegacySettings -value ""
45+
Invoke-Expression "& netsh winhttp reset proxy"
46+
}
47+
48+
if ($enable) {
49+
Enable-Proxy
50+
return 0
51+
}
52+
53+
if ($disable) {
54+
Disable-Proxy
55+
return 0
56+
}
2.17 KB
Binary file not shown.

0 commit comments

Comments
 (0)