Skip to content

Commit 42e2497

Browse files
authored
Merge branch 'main' into lsc-1771432703.3414142
2 parents 4684069 + 4cf2b79 commit 42e2497

48 files changed

Lines changed: 1368 additions & 369 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.bazelrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
common --enable_bzlmod
2+
# Use built-in protoc
3+
common --incompatible_enable_proto_toolchain_resolution --@com_google_protobuf//bazel/toolchains:prefer_prebuilt_protoc
4+
25
build --java_runtime_version=remotejdk_11
36
build --java_language_version=11
47

8+
59
# Hide Java 8 deprecation warnings.
610
common --javacopt=-Xlint:-options
711

812
# Remove flag once https://github.com/google/cel-spec/issues/508 and rules_jvm_external is fixed.
913
common --incompatible_autoload_externally=proto_library,cc_proto_library,java_proto_library,java_test
14+
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/bin/bash
2+
# Copyright 2026 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# https://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
set -o pipefail
17+
18+
TARGETS=(
19+
"//publish:cel"
20+
"//publish:cel_common"
21+
"//publish:cel_compiler"
22+
"//publish:cel_runtime"
23+
"//publish:cel_protobuf"
24+
"//publish:cel_v1alpha1"
25+
)
26+
27+
echo "------------------------------------------------"
28+
echo "Checking for duplicates..."
29+
echo "------------------------------------------------"
30+
31+
JDK8_FLAGS="--java_language_version=8 --java_runtime_version=8"
32+
bazel build $JDK8_FLAGS "${TARGETS[@]}" || { echo "Bazel build failed"; exit 1; }
33+
34+
(
35+
for target in "${TARGETS[@]}"; do
36+
# Locate the jar
37+
jar_path=$(bazel cquery "$target" --output=files 2>/dev/null | grep '\-project.jar$')
38+
39+
if [[ -z "$jar_path" ]]; then
40+
echo "Error: Could not find -project.jar for target $target" >&2
41+
exit 1
42+
fi
43+
44+
# Fix relative paths if running from a subdir.
45+
if [[ ! -f "$jar_path" ]]; then
46+
if [[ -f "../../$jar_path" ]]; then
47+
jar_path="../../$jar_path"
48+
else
49+
echo "Error: File not found at $jar_path" >&2
50+
exit 1
51+
fi
52+
fi
53+
54+
echo "Inspecting: $target" >&2
55+
56+
# Extract classes and append the target name to the end of the line
57+
# Format: dev/cel/expr/Expr.class //publish:cel_compiler
58+
jar tf "$jar_path" | grep "\.class$" | awk -v tgt="$target" '{print $0, tgt}'
59+
done
60+
) | awk '
61+
# $1 is the Class Name, $2 is the Target Name
62+
seen[$1] {
63+
print "❌ DUPLICATE FOUND: " $1
64+
print " Present in: " seen[$1]
65+
print " And in: " $2
66+
dupe=1
67+
next
68+
}
69+
{ seen[$1] = $2 }
70+
71+
END { if (dupe) exit 2 }
72+
'
73+
74+
EXIT_CODE=$?
75+
76+
if [ $EXIT_CODE -eq 0 ]; then
77+
echo "✅ Success: No duplicate classes found."
78+
elif [ $EXIT_CODE -eq 2 ]; then
79+
echo "⛔ Failure: Duplicate classes detected."
80+
else
81+
echo "💥 Error: An unexpected error occurred (e.g., missing jar files). Exit Code: $EXIT_CODE"
82+
fi
83+
84+
exit $EXIT_CODE
85+

.github/workflows/unwanted_deps.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,14 @@ checkUnwantedDeps '//publish:cel_runtime' '@cel_spec'
3636
checkUnwantedDeps '//publish:cel_runtime' 'protobuf_java_util'
3737
checkUnwantedDeps '//publish:cel' 'protobuf_java_util'
3838

39+
# cel_runtime shouldn't depend on antlr
40+
checkUnwantedDeps '//publish:cel_runtime' '@maven//:org_antlr_antlr4_runtime'
41+
3942
# cel_runtime shouldn't depend on the protobuf_lite runtime
4043
checkUnwantedDeps '//publish:cel_runtime' '@maven_android//:com_google_protobuf_protobuf_javalite'
4144
checkUnwantedDeps '//publish:cel' '@maven_android//:com_google_protobuf_protobuf_javalite'
4245

43-
# cel_runtime_android shouldn't depend on the full protobuf runtime
46+
# cel_runtime_android shouldn't depend on the full protobuf runtime or antlr
4447
checkUnwantedDeps '//publish:cel_runtime_android' '@maven//:com_google_protobuf_protobuf_java'
48+
checkUnwantedDeps '//publish:cel_runtime_android' '@maven//:org_antlr_antlr4_runtime'
4549
exit 0

.github/workflows/workflow.yml

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,31 @@ concurrency:
1515
cancel-in-progress: true
1616

1717
jobs:
18+
Static-Checks:
19+
runs-on: ubuntu-latest
20+
timeout-minutes: 30
21+
steps:
22+
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
23+
- run: echo "🐧 Job is running on a ${{ runner.os }} server!"
24+
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
25+
- name: Check out repository code
26+
uses: actions/checkout@v6
27+
- name: Setup Bazel
28+
uses: bazel-contrib/setup-bazel@0.18.0
29+
with:
30+
# Avoid downloading Bazel every time.
31+
bazelisk-cache: true
32+
# Store build cache per workflow.
33+
disk-cache: ${{ github.workflow }}
34+
# Share repository cache between workflows.
35+
repository-cache: true
36+
# Never write to the cache, strictly read-only
37+
cache-save: false
38+
- name: Unwanted Dependencies
39+
run: .github/workflows/unwanted_deps.sh
40+
- name: Cross-artifact Duplicate Classes Check
41+
run: .github/workflows/cross_artifact_dependencies_check.sh
42+
- run: echo "🍏 This job's status is ${{ job.status }}."
1843
Bazel-Tests:
1944
runs-on: ubuntu-latest
2045
timeout-minutes: 30
@@ -25,14 +50,16 @@ jobs:
2550
- name: Check out repository code
2651
uses: actions/checkout@v6
2752
- name: Setup Bazel
28-
uses: bazel-contrib/setup-bazel@0.14.0
53+
uses: bazel-contrib/setup-bazel@0.18.0
2954
with:
3055
# Avoid downloading Bazel every time.
3156
bazelisk-cache: true
3257
# Store build cache per workflow.
3358
disk-cache: ${{ github.workflow }}
3459
# Share repository cache between workflows.
3560
repository-cache: true
61+
# Prevent PRs from polluting cache
62+
cache-save: ${{ github.event_name != 'pull_request' }}
3663
- name: Bazel Output Version
3764
run: bazelisk --version
3865
- name: Java 8 Build
@@ -41,19 +68,41 @@ jobs:
4168
# Exclude codelab exercises as they are intentionally made to fail
4269
# Exclude maven conformance tests. They are only executed when there's version change.
4370
run: bazelisk test ... --deleted_packages=//codelab/src/test/codelab --test_output=errors --test_tag_filters=-conformance_maven --build_tag_filters=-conformance_maven
71+
- run: echo "🍏 This job's status is ${{ job.status }}."
4472

45-
# -- Start of Maven Conformance Tests (Ran only when there's version changes) --
46-
- name: Get changed file
73+
# -- Start of Maven Conformance Tests (Ran only when there's version changes) --
74+
Maven-Conformance:
75+
runs-on: ubuntu-latest
76+
timeout-minutes: 30
77+
steps:
78+
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
79+
- run: echo "🐧 Job is running on a ${{ runner.os }} server!"
80+
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
81+
- name: Check out repository code
82+
uses: actions/checkout@v6
83+
- name: Get changed files
4784
id: changed_file
4885
uses: tj-actions/changed-files@v46
4986
with:
5087
files: publish/cel_version.bzl
88+
- name: Setup Bazel
89+
if: steps.changed_file.outputs.any_changed == 'true'
90+
uses: bazel-contrib/setup-bazel@0.18.0
91+
with:
92+
# Avoid downloading Bazel every time.
93+
bazelisk-cache: true
94+
# Store build cache per workflow.
95+
disk-cache: ${{ github.workflow }}
96+
# Share repository cache between workflows.
97+
repository-cache: true
98+
# Never write to the cache, strictly read-only
99+
cache-save: false
51100
- name: Verify Version Consistency
52101
if: steps.changed_file.outputs.any_changed == 'true'
53102
run: |
54103
CEL_VERSION=$(grep 'CEL_VERSION =' publish/cel_version.bzl | cut -d '"' -f 2)
55104
56-
MODULE_VERSION=$(grep 'dev.cel:cel' MODULE.bazel | cut -d '"' -f 2 | cut -d ':' -f 3)
105+
MODULE_VERSION=$(grep 'CEL_VERSION =' MODULE.bazel | cut -d '"' -f 2)
57106
58107
if [ -z "$CEL_VERSION" ] || [ -z "$MODULE_VERSION" ]; then
59108
echo "❌ Error: Could not extract one or both version strings."

MODULE.bazel

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ module(
1616
name = "cel_java",
1717
)
1818

19-
bazel_dep(name = "bazel_skylib", version = "1.7.1")
19+
bazel_dep(name = "bazel_skylib", version = "1.8.2")
2020
bazel_dep(name = "rules_jvm_external", version = "6.9")
21-
bazel_dep(name = "protobuf", version = "29.3", repo_name = "com_google_protobuf") # see https://github.com/bazelbuild/rules_android/issues/373
21+
bazel_dep(name = "protobuf", version = "33.4", repo_name = "com_google_protobuf") # see https://github.com/bazelbuild/rules_android/issues/373
2222
bazel_dep(name = "googleapis", version = "0.0.0-20241220-5e258e33.bcr.1", repo_name = "com_google_googleapis")
2323
bazel_dep(name = "rules_pkg", version = "1.0.1")
2424
bazel_dep(name = "rules_license", version = "1.0.0")
2525
bazel_dep(name = "rules_proto", version = "7.1.0")
26-
bazel_dep(name = "rules_java", version = "8.12.0")
26+
bazel_dep(name = "rules_java", version = "9.3.0")
2727
bazel_dep(name = "rules_android", version = "0.7.1")
28-
bazel_dep(name = "rules_shell", version = "0.5.1")
28+
bazel_dep(name = "rules_shell", version = "0.6.1")
2929
bazel_dep(name = "googleapis-java", version = "1.0.0")
3030
bazel_dep(name = "cel-spec", version = "0.24.0", repo_name = "cel_spec")
3131

@@ -39,7 +39,9 @@ GUAVA_VERSION = "33.5.0"
3939

4040
TRUTH_VERSION = "1.4.4"
4141

42-
PROTOBUF_JAVA_VERSION = "4.33.4"
42+
PROTOBUF_JAVA_VERSION = "4.33.5"
43+
44+
CEL_VERSION = "0.12.0-SNAPSHOT"
4345

4446
# Compile only artifacts
4547
[
@@ -114,7 +116,11 @@ maven.install(
114116

115117
maven.install(
116118
name = "maven_conformance",
117-
artifacts = ["dev.cel:cel:0.11.1"],
119+
artifacts = [
120+
"dev.cel:cel:" + CEL_VERSION,
121+
"dev.cel:compiler:" + CEL_VERSION,
122+
"dev.cel:runtime:" + CEL_VERSION,
123+
],
118124
repositories = [
119125
"https://maven.google.com",
120126
"https://repo1.maven.org/maven2",

bundle/src/test/java/dev/cel/bundle/CelImplTest.java

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1991,59 +1991,6 @@ public void program_nativeTypeUnknownsEnabled_asCallArguments() throws Exception
19911991
assertThat(result.attributes()).isEmpty();
19921992
}
19931993

1994-
@Test
1995-
@TestParameters("{expression: 'string(123)'}")
1996-
@TestParameters("{expression: 'string(123u)'}")
1997-
@TestParameters("{expression: 'string(1.5)'}")
1998-
@TestParameters("{expression: 'string(\"foo\")'}")
1999-
@TestParameters("{expression: 'string(b\"foo\")'}")
2000-
@TestParameters("{expression: 'string(timestamp(100))'}")
2001-
@TestParameters("{expression: 'string(duration(\"1h\"))'}")
2002-
public void program_stringConversionDisabled_throws(String expression) throws Exception {
2003-
Cel cel =
2004-
CelFactory.standardCelBuilder()
2005-
.setOptions(
2006-
CelOptions.current()
2007-
.enableTimestampEpoch(true)
2008-
.enableStringConversion(false)
2009-
.build())
2010-
.build();
2011-
CelAbstractSyntaxTree ast = cel.compile(expression).getAst();
2012-
2013-
CelEvaluationException e =
2014-
assertThrows(CelEvaluationException.class, () -> cel.createProgram(ast).eval());
2015-
assertThat(e).hasMessageThat().contains("No matching overload for function 'string'");
2016-
assertThat(e.getErrorCode()).isEqualTo(CelErrorCode.OVERLOAD_NOT_FOUND);
2017-
}
2018-
2019-
@Test
2020-
public void program_stringConcatenationDisabled_throws() throws Exception {
2021-
Cel cel =
2022-
CelFactory.standardCelBuilder()
2023-
.setOptions(CelOptions.current().enableStringConcatenation(false).build())
2024-
.build();
2025-
CelAbstractSyntaxTree ast = cel.compile("'foo' + 'bar'").getAst();
2026-
2027-
CelEvaluationException e =
2028-
assertThrows(CelEvaluationException.class, () -> cel.createProgram(ast).eval());
2029-
assertThat(e).hasMessageThat().contains("No matching overload for function '_+_'");
2030-
assertThat(e.getErrorCode()).isEqualTo(CelErrorCode.OVERLOAD_NOT_FOUND);
2031-
}
2032-
2033-
@Test
2034-
public void program_listConcatenationDisabled_throws() throws Exception {
2035-
Cel cel =
2036-
CelFactory.standardCelBuilder()
2037-
.setOptions(CelOptions.current().enableListConcatenation(false).build())
2038-
.build();
2039-
CelAbstractSyntaxTree ast = cel.compile("[1] + [2]").getAst();
2040-
2041-
CelEvaluationException e =
2042-
assertThrows(CelEvaluationException.class, () -> cel.createProgram(ast).eval());
2043-
assertThat(e).hasMessageThat().contains("No matching overload for function '_+_'");
2044-
assertThat(e.getErrorCode()).isEqualTo(CelErrorCode.OVERLOAD_NOT_FOUND);
2045-
}
2046-
20471994
@Test
20481995
public void program_comprehensionDisabled_throws() throws Exception {
20491996
Cel cel =

common/BUILD.bazel

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ cel_android_library(
7979
exports = ["//common/src/main/java/dev/cel/common:cel_source_android"],
8080
)
8181

82+
java_library(
83+
name = "cel_source_helper",
84+
visibility = ["//:internal"],
85+
exports = ["//common/src/main/java/dev/cel/common:cel_source_helper"],
86+
)
87+
8288
java_library(
8389
name = "cel_ast",
8490
exports = ["//common/src/main/java/dev/cel/common:cel_ast"],
@@ -108,9 +114,6 @@ java_library(
108114
visibility = [
109115
"//:internal",
110116
# TODO: Remove references to the following clients
111-
"//java/com/google/abuse/admin/notebook/compiler/checkedtypes:__pkg__",
112-
"//java/com/google/paymentfraud/v2/util/featurereplay/common/risklogrecordio:__pkg__",
113-
"//java/com/google/payments/consumer/growth/treatmentconfig/management/backend/service/config/utils:__pkg__",
114117
],
115118
exports = ["//common/src/main/java/dev/cel/common:cel_descriptor_util"],
116119
)

common/internal/BUILD.bazel

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ java_library(
1111
exports = ["//common/src/main/java/dev/cel/common/internal"],
1212
)
1313

14+
java_library(
15+
name = "code_point_stream",
16+
exports = ["//common/src/main/java/dev/cel/common/internal:code_point_stream"],
17+
)
18+
1419
java_library(
1520
name = "comparison_functions",
1621
exports = ["//common/src/main/java/dev/cel/common/internal:comparison_functions"],

0 commit comments

Comments
 (0)