Skip to content

Commit 8a1b7bd

Browse files
TristonianJonescopybara-github
authored andcommitted
Remove ICU locale from string.format
This change also updates cel-cpp to use bzlmod as a simplification for the WORKSPACE builds which were difficult to maintain and incompatible with Bazel module builds. PiperOrigin-RevId: 743289379
1 parent 1f1ccf7 commit 8a1b7bd

File tree

14 files changed

+245
-283
lines changed

14 files changed

+245
-283
lines changed

.bazelrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
build --cxxopt=-std=c++17 --host_cxxopt=-std=c++17
22
build --cxxopt=-fsized-deallocation
3-
build --noenable_bzlmod
3+
build --enable_bzlmod
44
build --copt=-Wno-deprecated-declarations
55
build --compilation_mode=fastbuild
66

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.2.1
1+
7.3.2

Dockerfile

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
# This Dockerfile is used to create a container around gcc9 and bazel for
2+
# building the CEL C++ library on GitHub.
3+
#
4+
# To update a new version of this container, use gcloud. You may need to run
5+
# `gcloud auth login` and `gcloud auth configure-docker` first.
6+
#
7+
# Note, if you need to run docker using `sudo` use the following commands
8+
# instead:
9+
#
10+
# sudo gcloud auth login --no-launch-browser
11+
# sudo gcloud auth configure-docker
12+
#
13+
# Run the following command from the root of the CEL repository:
14+
#
15+
# gcloud builds submit --region=us -t gcr.io/cel-analysis/gcc9 .
16+
#
17+
# Once complete get the sha256 digest from the output using the following
18+
# command:
19+
#
20+
# gcloud artifacts versions list --package=gcc9 --repository=gcr.io \
21+
# --location=us
22+
#
23+
# The cloudbuild.yaml file must be updated to use the new digest like so:
24+
#
25+
# - name: 'gcr.io/cel-analysis/gcc9@<SHA256>'
126
FROM gcc:9
227

328
# Install Bazel prerequesites and required tools.
@@ -21,7 +46,7 @@ RUN apt-get update && \
2146

2247
# Install Bazel.
2348
# https://github.com/bazelbuild/bazel/releases
24-
ARG BAZEL_VERSION="7.2.1"
49+
ARG BAZEL_VERSION="7.3.2"
2550
ADD https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh /tmp/install_bazel.sh
2651
RUN /bin/bash /tmp/install_bazel.sh && rm /tmp/install_bazel.sh
2752

MODULE.bazel

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
module(
2+
name = "cel-cpp",
3+
)
4+
5+
bazel_dep(
6+
name = "bazel_skylib",
7+
version = "1.7.1",
8+
)
9+
bazel_dep(
10+
name = "googleapis",
11+
version = "0.0.0-20241220-5e258e33.bcr.1",
12+
repo_name = "com_google_googleapis",
13+
)
14+
bazel_dep(
15+
name = "googleapis-cc",
16+
version = "1.0.0",
17+
)
18+
bazel_dep(
19+
name = "rules_cc",
20+
version = "0.1.1",
21+
)
22+
bazel_dep(
23+
name = "rules_java",
24+
version = "7.6.5",
25+
)
26+
bazel_dep(
27+
name = "rules_proto",
28+
version = "7.0.2",
29+
)
30+
bazel_dep(
31+
name = "rules_python",
32+
version = "1.3.0",
33+
)
34+
bazel_dep(
35+
name = "protobuf",
36+
version = "27.0",
37+
repo_name = "com_google_protobuf",
38+
)
39+
bazel_dep(
40+
name = "abseil-cpp",
41+
version = "20250127.1",
42+
repo_name = "com_google_absl",
43+
)
44+
bazel_dep(
45+
name = "googletest",
46+
version = "1.16.0",
47+
repo_name = "com_google_googletest",
48+
)
49+
bazel_dep(
50+
name = "google_benchmark",
51+
version = "1.9.2",
52+
repo_name = "com_github_google_benchmark",
53+
)
54+
bazel_dep(
55+
name = "re2",
56+
version = "2024-07-02",
57+
repo_name = "com_googlesource_code_re2",
58+
)
59+
bazel_dep(
60+
name = "flatbuffers",
61+
version = "25.2.10",
62+
repo_name = "com_github_google_flatbuffers",
63+
)
64+
bazel_dep(
65+
name = "cel-spec",
66+
version = "0.21.2",
67+
repo_name = "com_google_cel_spec",
68+
)
69+
70+
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
71+
python.toolchain(
72+
configure_coverage_tool = False,
73+
ignore_root_user_error = True,
74+
python_version = "3.11",
75+
)
76+
77+
CEL_SPEC_GIT_SHA = "ed0181bc27b110fa23193d98576afe774b448845" # Mar 26, 2025
78+
79+
archive_override(
80+
module_name = "cel-spec",
81+
strip_prefix = "cel-spec-" + CEL_SPEC_GIT_SHA,
82+
urls = ["https://github.com/google/cel-spec/archive/" + CEL_SPEC_GIT_SHA + ".zip"],
83+
)
84+
85+
ANTLR4_VERSION = "4.13.2"
86+
87+
bazel_dep(
88+
name = "antlr4-cpp-runtime",
89+
version = "4.13.2",
90+
)
91+
92+
http_jar = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_jar")
93+
94+
http_jar(
95+
name = "antlr4_jar",
96+
sha256 = "eae2dfa119a64327444672aff63e9ec35a20180dc5b8090b7a6ab85125df4d76",
97+
urls = ["https://www.antlr.org/download/antlr-" + ANTLR4_VERSION + "-complete.jar"],
98+
)

bazel/antlr.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def antlr_cc_library(name, src, package):
3434
srcs = [generated],
3535
deps = [
3636
generated,
37-
"@antlr4_runtimes//:cpp",
37+
"@antlr4-cpp-runtime//:antlr4-cpp-runtime",
3838
],
3939
linkstatic = 1,
4040
)

cloudbuild.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
steps:
2-
- name: 'gcr.io/cel-analysis/gcc-9@sha256:5c08ae90e33a33010c8e518173a926143ba029affb54ceec288f375f474ea87f'
2+
- name: 'gcr.io/cel-analysis/gcc9@sha256:4d5ff2e55224398807235a44b57e9c5793e922ac46e9ff428536bb8f8e5790ce'
33
args:
44
- '--output_base=/bazel' # This is mandatory to avoid steps accidently sharing data.
55
- 'test'
66
- '...'
7-
- '--noenable_bzlmod'
7+
- '--enable_bzlmod'
88
- '--copt=-Wno-deprecated-declarations'
99
- '--compilation_mode=fastbuild'
1010
- '--test_output=errors'
@@ -16,15 +16,15 @@ steps:
1616
- '--google_default_credentials'
1717
id: gcc-9
1818
waitFor: ['-']
19-
- name: 'gcr.io/cel-analysis/gcc-9@sha256:5c08ae90e33a33010c8e518173a926143ba029affb54ceec288f375f474ea87f'
19+
- name: 'gcr.io/cel-analysis/gcc9@sha256:4d5ff2e55224398807235a44b57e9c5793e922ac46e9ff428536bb8f8e5790ce'
2020
env:
2121
- 'CC=clang-11'
2222
- 'CXX=clang++-11'
2323
args:
2424
- '--output_base=/bazel' # This is mandatory to avoid steps accidently sharing data.
2525
- 'test'
2626
- '...'
27-
- '--noenable_bzlmod'
27+
- '--enable_bzlmod'
2828
- '--copt=-Wno-deprecated-declarations'
2929
- '--compilation_mode=fastbuild'
3030
- '--test_output=errors'

conformance/BUILD

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,8 +205,6 @@ _TESTS_TO_SKIP_MODERN = [
205205
"string_ext/substring",
206206
"string_ext/trim",
207207
"string_ext/quote",
208-
"string_ext/format",
209-
"string_ext/format_errors",
210208
"string_ext/value_errors",
211209
"string_ext/type_errors",
212210

@@ -262,8 +260,6 @@ _TESTS_TO_SKIP_LEGACY = [
262260
"string_ext/substring",
263261
"string_ext/trim",
264262
"string_ext/quote",
265-
"string_ext/format",
266-
"string_ext/format_errors",
267263
"string_ext/value_errors",
268264
"string_ext/type_errors",
269265

eval/public/cel_options.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ cel::RuntimeOptions ConvertToRuntimeOptions(const InterpreterOptions& options) {
4040
options.enable_lazy_bind_initialization,
4141
options.max_recursion_depth,
4242
options.enable_recursive_tracing,
43-
options.enable_fast_builtins,
44-
options.locale};
43+
options.enable_fast_builtins};
4544
}
4645

4746
} // namespace google::api::expr::runtime

eval/public/cel_options.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,11 +198,6 @@ struct InterpreterOptions {
198198
//
199199
// Currently applies to !_, @not_strictly_false, _==_, _!=_, @in
200200
bool enable_fast_builtins = true;
201-
202-
// The locale to use for string formatting.
203-
//
204-
// Default is en_US.
205-
std::string locale = "en_US";
206201
};
207202
// LINT.ThenChange(//depot/google3/runtime/runtime_options.h)
208203

extensions/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,6 @@ cc_library(
611611
"@com_google_absl//absl/strings:string_view",
612612
"@com_google_absl//absl/time",
613613
"@com_google_protobuf//:protobuf",
614-
"@icu4c",
615614
],
616615
)
617616

0 commit comments

Comments
 (0)