• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2009-2021, Google LLC
2# All rights reserved.
3#
4# Use of this source code is governed by a BSD-style
5# license that can be found in the LICENSE file or at
6# https://developers.google.com/open-source/licenses/bsd
7
8load(
9    "//bazel:upb_proto_library.bzl",
10    "upb_c_proto_library",
11    "upb_proto_reflection_library",
12)
13load(
14    "//upb/bazel:build_defs.bzl",
15    "UPB_DEFAULT_COPTS",
16    "make_shell_script",
17)
18
19package(default_applicable_licenses = ["//:license"])
20
21licenses(["notice"])
22
23config_setting(
24    name = "windows",
25    constraint_values = ["@platforms//os:windows"],
26    visibility = ["//visibility:public"],
27)
28
29upb_c_proto_library(
30    name = "conformance_upb_proto",
31    testonly = 1,
32    deps = ["//conformance:conformance_proto"],
33)
34
35upb_proto_reflection_library(
36    name = "conformance_upb_proto_reflection",
37    testonly = 1,
38    deps = ["//conformance:conformance_proto"],
39)
40
41upb_proto_reflection_library(
42    name = "test_messages_proto2_upbdefs",
43    testonly = 1,
44    visibility = ["//visibility:private"],
45    deps = ["//src/google/protobuf:test_messages_proto2_proto"],
46)
47
48upb_proto_reflection_library(
49    name = "test_messages_proto3_upbdefs",
50    testonly = 1,
51    visibility = ["//visibility:private"],
52    deps = ["//src/google/protobuf:test_messages_proto3_proto"],
53)
54
55cc_binary(
56    name = "conformance_upb",
57    testonly = 1,
58    srcs = ["conformance_upb.c"],
59    copts = UPB_DEFAULT_COPTS,
60    data = ["conformance_upb_failures.txt"],
61    target_compatible_with = select({
62        "@platforms//os:windows": ["@platforms//:incompatible"],
63        "//conditions:default": [],
64    }),
65    deps = [
66        ":conformance_upb_proto",
67        ":conformance_upb_proto_reflection",
68        ":test_messages_proto2_upbdefs",
69        ":test_messages_proto3_upbdefs",
70        "//editions:test_messages_proto2_editions_upbdefs",
71        "//editions:test_messages_proto3_editions_upbdefs",
72        "//upb:base",
73        "//upb:json",
74        "//upb:port",
75        "//upb:reflection",
76        "//upb:text",
77        "//upb:wire",
78    ],
79)
80
81make_shell_script(
82    name = "gen_test_conformance_upb",
83    out = "test_conformance_upb.sh",
84    contents = "$1 --maximum_edition 2023 --enforce_recommended --failure_list $2 $3",
85)
86
87sh_test(
88    name = "test_conformance_upb",
89    srcs = ["test_conformance_upb.sh"],
90    args = [
91        "$(location //conformance:conformance_test_runner)",
92        "$(location :conformance_upb_failures.txt)",
93        "$(location :conformance_upb)",
94    ],
95    data = [
96        "conformance_upb_failures.txt",
97        ":conformance_upb",
98        "//conformance:conformance_test_runner",
99    ],
100    target_compatible_with = select({
101        "@platforms//os:windows": ["@platforms//:incompatible"],
102        "//conditions:default": [],
103    }),
104    deps = ["@bazel_tools//tools/bash/runfiles"],
105)
106
107cc_binary(
108    name = "conformance_upb_dynamic_minitable",
109    testonly = 1,
110    srcs = ["conformance_upb.c"],
111    copts = UPB_DEFAULT_COPTS + [
112        "-DREBUILD_MINITABLES",
113    ],
114    data = ["conformance_upb_failures.txt"],
115    target_compatible_with = select({
116        "@platforms//os:windows": ["@platforms//:incompatible"],
117        "//conditions:default": [],
118    }),
119    deps = [
120        ":conformance_upb_proto",
121        ":conformance_upb_proto_reflection",
122        ":test_messages_proto2_upbdefs",
123        ":test_messages_proto3_upbdefs",
124        "//editions:test_messages_proto2_editions_upbdefs",
125        "//editions:test_messages_proto3_editions_upbdefs",
126        "//upb:base",
127        "//upb:json",
128        "//upb:port",
129        "//upb:reflection",
130        "//upb:text",
131        "//upb:wire",
132    ],
133)
134
135make_shell_script(
136    name = "gen_test_conformance_upb_dynamic_minitable",
137    out = "test_conformance_upb_dynamic_minitable.sh",
138    contents = "$1 --maximum_edition 2023 --enforce_recommended --failure_list $2 $3",
139)
140
141sh_test(
142    name = "test_conformance_upb_dynamic_minitable",
143    srcs = ["test_conformance_upb_dynamic_minitable.sh"],
144    args = [
145        "$(location //conformance:conformance_test_runner)",
146        "$(location :conformance_upb_failures.txt)",
147        "$(location :conformance_upb_dynamic_minitable)",
148    ],
149    data = [
150        "conformance_upb_failures.txt",
151        ":conformance_upb_dynamic_minitable",
152        "//conformance:conformance_test_runner",
153    ],
154    deps = ["@bazel_tools//tools/bash/runfiles"],
155)
156