Skip to content

Commit c804f26

Browse files
authored
Merge pull request #100 from google/cpp-sync
Internal sync.
2 parents 47244a4 + fc02992 commit c804f26

Some content is hidden

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

61 files changed

+2021
-533
lines changed

BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package(default_visibility = ["//visibility:public"])

WORKSPACE

Lines changed: 5 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -1,143 +1,9 @@
1-
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
2-
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
1+
workspace(name = "com_google_cel_cpp")
32

4-
CEL_SPEC_GIT_SHA = "02a12e7cffe452a611b0e6ef47872963bbd87028" # 4/17/2020
3+
load("//bazel:deps.bzl", "cel_cpp_deps")
54

6-
CEL_SPEC_SHA = "757cfdb00dc76fd0d12dadbae982c22a9218711d5e4cf30c94cfe6c05b1cdf2b"
5+
cel_cpp_deps()
76

8-
http_archive(
9-
name = "com_google_cel_spec",
10-
sha256 = CEL_SPEC_SHA,
11-
strip_prefix = "cel-spec-" + CEL_SPEC_GIT_SHA,
12-
urls = ["https://github.com/google/cel-spec/archive/" + CEL_SPEC_GIT_SHA + ".zip"],
13-
)
7+
load("//bazel:deps_extra.bzl", "cel_cpp_deps_extra")
148

15-
http_archive(
16-
name = "com_google_absl",
17-
strip_prefix = "abseil-cpp-master",
18-
urls = ["https://github.com/abseil/abseil-cpp/archive/master.zip"],
19-
)
20-
21-
# Google RE2 (Regular Expression) C++ Library
22-
http_archive(
23-
name = "com_googlesource_code_re2",
24-
strip_prefix = "re2-master",
25-
urls = ["https://github.com/google/re2/archive/master.zip"],
26-
)
27-
28-
# gRPC dependencies:
29-
http_archive(
30-
name = "com_github_grpc_grpc",
31-
sha256 = "1236514199d3deb111a6dd7f6092f67617cd2b147f7eda7adbafccea95de7381",
32-
strip_prefix = "grpc-1.31.0",
33-
urls = ["https://github.com/grpc/grpc/archive/v1.31.0.tar.gz"],
34-
)
35-
36-
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
37-
38-
grpc_deps()
39-
40-
GOOGLEAPIS_GIT_SHA = "be480e391cc88a75cf2a81960ef79c80d5012068" # Jul 24, 2019
41-
42-
GOOGLEAPIS_SHA = "c1969e5b72eab6d9b6cfcff748e45ba57294aeea1d96fd04cd081995de0605c2"
43-
44-
http_archive(
45-
name = "com_google_googleapis",
46-
sha256 = GOOGLEAPIS_SHA,
47-
strip_prefix = "googleapis-" + GOOGLEAPIS_GIT_SHA,
48-
urls = ["https://github.com/googleapis/googleapis/archive/" + GOOGLEAPIS_GIT_SHA + ".tar.gz"],
49-
)
50-
51-
load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language")
52-
53-
switched_rules_by_language(
54-
name = "com_google_googleapis_imports",
55-
cc = True,
56-
go = True,
57-
grpc = True,
58-
)
59-
60-
http_archive(
61-
name = "io_bazel_rules_go",
62-
sha256 = "f04d2373bcaf8aa09bccb08a98a57e721306c8f6043a2a0ee610fd6853dcde3d",
63-
urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.18.6/rules_go-0.18.6.tar.gz"],
64-
)
65-
66-
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
67-
68-
# cel-go dependencies:
69-
http_archive(
70-
name = "bazel_gazelle",
71-
sha256 = "3c681998538231a2d24d0c07ed5a7658cb72bfb5fd4bf9911157c0e9ac6a2687",
72-
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/0.17.0/bazel-gazelle-0.17.0.tar.gz"],
73-
)
74-
75-
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
76-
77-
git_repository(
78-
name = "com_google_cel_go",
79-
remote = "https://github.com/google/cel-go.git",
80-
tag = "v0.5.1",
81-
)
82-
83-
go_repository(
84-
name = "org_golang_google_genproto",
85-
build_file_proto_mode = "disable",
86-
commit = "bd91e49a0898e27abb88c339b432fa53d7497ac0",
87-
importpath = "google.golang.org/genproto",
88-
)
89-
90-
go_repository(
91-
name = "com_github_antlr",
92-
commit = "621b933c7a7f01c67ae9de15103151fa0f9d6d90",
93-
importpath = "github.com/antlr/antlr4",
94-
)
95-
96-
go_rules_dependencies()
97-
98-
go_register_toolchains()
99-
100-
gazelle_dependencies()
101-
102-
# Parser dependencies
103-
http_archive(
104-
name = "rules_antlr",
105-
sha256 = "7249d1569293d9b239e23c65f6b4c81a07da921738bde0dfeb231ed98be40429",
106-
strip_prefix = "rules_antlr-3cc2f9502a54ceb7b79b37383316b23c4da66f9a",
107-
urls = ["https://github.com/marcohu/rules_antlr/archive/3cc2f9502a54ceb7b79b37383316b23c4da66f9a.tar.gz"],
108-
)
109-
110-
load("@rules_antlr//antlr:deps.bzl", "antlr_dependencies")
111-
112-
antlr_dependencies(472)
113-
114-
http_archive(
115-
name = "antlr4_runtimes",
116-
build_file_content = """
117-
package(default_visibility = ["//visibility:public"])
118-
cc_library(
119-
name = "cpp",
120-
srcs = glob(["runtime/Cpp/runtime/src/**/*.cpp"]),
121-
hdrs = glob(["runtime/Cpp/runtime/src/**/*.h"]),
122-
includes = ["runtime/Cpp/runtime/src"],
123-
)
124-
""",
125-
sha256 = "46f5e1af5f4bd28ade55cb632f9a069656b31fc8c2408f9aa045f9b5f5caad64",
126-
strip_prefix = "antlr4-4.7.2",
127-
urls = ["https://github.com/antlr/antlr4/archive/4.7.2.tar.gz"],
128-
)
129-
130-
# tools/flatbuffers dependencies
131-
FLAT_BUFFERS_SHA = "a83caf5910644ba1c421c002ef68e42f21c15f9f"
132-
133-
http_archive(
134-
name = "com_github_google_flatbuffers",
135-
sha256 = "b8efbc25721e76780752bad775a97c3f77a0250271e2db37fc747b20e8b0f24a",
136-
strip_prefix = "flatbuffers-" + FLAT_BUFFERS_SHA,
137-
url = "https://github.com/google/flatbuffers/archive/" + FLAT_BUFFERS_SHA + ".tar.gz",
138-
)
139-
140-
# Needed by gRPC build rules (but not used). Should be after genproto.
141-
load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps")
142-
143-
grpc_extra_deps()
9+
cel_cpp_deps_extra()

base/status_macros.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,8 @@ inline To down_cast(From* f) { // so we only accept pointers
6767
#define EXPECT_OK(expression) EXPECT_TRUE(expression.ok())
6868
#endif
6969

70+
#if !defined(CHECK_OK)
71+
#define CHECK_OK(expression) assert(expression.ok())
72+
#endif
73+
7074
#endif // THIRD_PARTY_CEL_CPP_BASE_STATUS_MACROS_H_

bazel/deps.bzl

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
"""
2+
Main dependencies of cel-cpp.
3+
"""
4+
5+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
6+
7+
def base_deps():
8+
"""Base evaluator and test dependencies."""
9+
http_archive(
10+
name = "com_google_absl",
11+
strip_prefix = "abseil-cpp-master",
12+
urls = ["https://github.com/abseil/abseil-cpp/archive/master.zip"],
13+
)
14+
15+
http_archive(
16+
name = "com_google_googletest",
17+
urls = ["https://github.com/google/googletest/archive/master.zip"],
18+
strip_prefix = "googletest-master",
19+
)
20+
21+
http_archive(
22+
name = "com_github_google_benchmark",
23+
urls = ["https://github.com/google/benchmark/archive/master.zip"],
24+
strip_prefix = "benchmark-master",
25+
)
26+
27+
http_archive(
28+
name = "com_googlesource_code_re2",
29+
strip_prefix = "re2-master",
30+
urls = ["https://github.com/google/re2/archive/master.zip"],
31+
)
32+
33+
PROTOBUF_VERSION = "3.14.0"
34+
http_archive(
35+
name = "com_google_protobuf",
36+
strip_prefix = "protobuf-" + PROTOBUF_VERSION,
37+
urls = ["https://github.com/protocolbuffers/protobuf/archive/v" + PROTOBUF_VERSION + ".tar.gz"],
38+
)
39+
40+
GOOGLEAPIS_GIT_SHA = "be480e391cc88a75cf2a81960ef79c80d5012068" # Jul 24, 2019
41+
GOOGLEAPIS_SHA = "c1969e5b72eab6d9b6cfcff748e45ba57294aeea1d96fd04cd081995de0605c2"
42+
http_archive(
43+
name = "com_google_googleapis",
44+
sha256 = GOOGLEAPIS_SHA,
45+
strip_prefix = "googleapis-" + GOOGLEAPIS_GIT_SHA,
46+
urls = ["https://github.com/googleapis/googleapis/archive/" + GOOGLEAPIS_GIT_SHA + ".tar.gz"],
47+
)
48+
49+
def parser_deps():
50+
"""ANTLR dependency for the parser."""
51+
http_archive(
52+
name = "rules_antlr",
53+
sha256 = "7249d1569293d9b239e23c65f6b4c81a07da921738bde0dfeb231ed98be40429",
54+
strip_prefix = "rules_antlr-3cc2f9502a54ceb7b79b37383316b23c4da66f9a",
55+
urls = ["https://github.com/marcohu/rules_antlr/archive/3cc2f9502a54ceb7b79b37383316b23c4da66f9a.tar.gz"],
56+
)
57+
58+
http_archive(
59+
name = "antlr4_runtimes",
60+
build_file_content = """
61+
package(default_visibility = ["//visibility:public"])
62+
cc_library(
63+
name = "cpp",
64+
srcs = glob(["runtime/Cpp/runtime/src/**/*.cpp"]),
65+
hdrs = glob(["runtime/Cpp/runtime/src/**/*.h"]),
66+
includes = ["runtime/Cpp/runtime/src"],
67+
)
68+
""",
69+
sha256 = "46f5e1af5f4bd28ade55cb632f9a069656b31fc8c2408f9aa045f9b5f5caad64",
70+
strip_prefix = "antlr4-4.7.2",
71+
urls = ["https://github.com/antlr/antlr4/archive/4.7.2.tar.gz"],
72+
)
73+
74+
def flatbuffers_deps():
75+
"""FlatBuffers support."""
76+
FLAT_BUFFERS_SHA = "a83caf5910644ba1c421c002ef68e42f21c15f9f"
77+
http_archive(
78+
name = "com_github_google_flatbuffers",
79+
sha256 = "b8efbc25721e76780752bad775a97c3f77a0250271e2db37fc747b20e8b0f24a",
80+
strip_prefix = "flatbuffers-" + FLAT_BUFFERS_SHA,
81+
url = "https://github.com/google/flatbuffers/archive/" + FLAT_BUFFERS_SHA + ".tar.gz",
82+
)
83+
84+
def cel_spec_deps():
85+
"""CEL Spec conformance testing."""
86+
http_archive(
87+
name = "io_bazel_rules_go",
88+
sha256 = "207fad3e6689135c5d8713e5a17ba9d1290238f47b9ba545b63d9303406209c6",
89+
urls = [
90+
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.24.7/rules_go-v0.24.7.tar.gz",
91+
"https://github.com/bazelbuild/rules_go/releases/download/v0.24.7/rules_go-v0.24.7.tar.gz",
92+
],
93+
)
94+
95+
http_archive(
96+
name = "bazel_gazelle",
97+
sha256 = "b85f48fa105c4403326e9525ad2b2cc437babaa6e15a3fc0b1dbab0ab064bc7c",
98+
urls = [
99+
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.2/bazel-gazelle-v0.22.2.tar.gz",
100+
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.21.2/bazel-gazelle-v0.22.2.tar.gz",
101+
],
102+
)
103+
104+
CEL_SPEC_GIT_SHA = "95fe21a64063d63482a4b1b3159c07b5b7b64d77" # 11/23/2020
105+
http_archive(
106+
name = "com_google_cel_spec",
107+
strip_prefix = "cel-spec-" + CEL_SPEC_GIT_SHA,
108+
urls = ["https://github.com/google/cel-spec/archive/" + CEL_SPEC_GIT_SHA + ".zip"],
109+
)
110+
111+
def cel_cpp_deps():
112+
"""All core dependencies of cel-cpp."""
113+
base_deps()
114+
parser_deps()
115+
flatbuffers_deps()
116+
cel_spec_deps()

bazel/deps_extra.bzl

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
"""
2+
Transitive dependencies.
3+
"""
4+
5+
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
6+
load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language")
7+
load("@rules_antlr//antlr:deps.bzl", "antlr_dependencies")
8+
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
9+
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
10+
11+
def cel_spec_deps_extra():
12+
"""CEL Spec dependencies."""
13+
go_repository(
14+
name = "org_golang_google_genproto",
15+
build_file_proto_mode = "disable_global",
16+
commit = "62d171c70ae133bd47722027b62f8820407cf744",
17+
importpath = "google.golang.org/genproto",
18+
)
19+
20+
go_repository(
21+
name = "org_golang_google_grpc",
22+
build_file_proto_mode = "disable_global",
23+
importpath = "google.golang.org/grpc",
24+
tag = "v1.33.2",
25+
)
26+
27+
go_repository(
28+
name = "org_golang_x_net",
29+
importpath = "golang.org/x/net",
30+
sum = "h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=",
31+
version = "v0.0.0-20190311183353-d8887717615a",
32+
)
33+
34+
go_repository(
35+
name = "org_golang_x_text",
36+
importpath = "golang.org/x/text",
37+
sum = "h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=",
38+
version = "v0.3.0",
39+
)
40+
41+
go_rules_dependencies()
42+
go_register_toolchains()
43+
gazelle_dependencies()
44+
45+
def cel_cpp_deps_extra():
46+
"""All transitive dependencies."""
47+
protobuf_deps()
48+
switched_rules_by_language(
49+
name = "com_google_googleapis_imports",
50+
cc = True,
51+
go = True, # cel-spec requirement
52+
)
53+
antlr_dependencies(472)
54+
cel_spec_deps_extra()

0 commit comments

Comments
 (0)