xref: /aosp_15_r20/external/protobuf/java/lite/BUILD.bazel (revision 1b3f573f81763fcece89efc2b6a5209149e44ab8)
1load("@bazel_skylib//rules:build_test.bzl", "build_test")
2load("@rules_pkg//:mappings.bzl", "pkg_filegroup", "pkg_files", "strip_prefix")
3load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain")
4load("//conformance:defs.bzl", "conformance_test")
5load("//java/internal:testing.bzl", "junit_tests")
6
7exports_files(
8    ["lite.awk"],
9    visibility = ["//java/core:__pkg__"],
10)
11
12exports_files(
13    ["pom_template.xml"],
14    visibility = ["//java/core:__pkg__"],
15)
16
17alias(
18    name = "lite",
19    actual = "//java/core:lite",
20    visibility = ["//visibility:public"],
21)
22
23proto_lang_toolchain(
24    name = "toolchain",
25    # keep this in sync w/ LITE_WELL_KNOWN_PROTO_MAP in //:BUILD
26    blacklisted_protos = [
27        "//:any_proto",
28        "//:api_proto",
29        "//:duration_proto",
30        "//:empty_proto",
31        "//:field_mask_proto",
32        "//:source_context_proto",
33        "//:struct_proto",
34        "//:timestamp_proto",
35        "//:type_proto",
36        "//:wrappers_proto",
37    ],
38    command_line = "--java_out=lite:$(OUT)",
39    runtime = ":lite",
40    visibility = ["//visibility:public"],
41)
42
43test_suite(
44    name = "tests",
45    tests = [
46        "conformance_test",
47        "lite_build_test",
48        "lite_tests",
49        "//java/core:lite_tests",
50    ],
51)
52
53build_test(
54    name = "lite_build_test",
55    targets = [
56        ":lite",
57    ],
58)
59
60conformance_test(
61    name = "conformance_test",
62    failure_list = "//conformance:failure_list_java_lite.txt",
63    testee = "//conformance:conformance_java_lite",
64    text_format_failure_list = "//conformance:text_format_failure_list_java_lite.txt",
65)
66
67junit_tests(
68    name = "lite_tests",
69    size = "small",
70    srcs = glob(["src/test/**/*.java"]),
71    deps = [
72        ":lite",
73        "//java/core:generic_test_protos_java_proto_lite",
74        "//java/core:java_test_protos_java_proto_lite",
75        "//java/core:test_util_lite",
76        "@maven//:com_google_truth_truth",
77        "@maven//:junit_junit",
78    ],
79)
80
81pkg_files(
82    name = "dist_files",
83    srcs = glob([
84        "**/*.java",
85    ]) + [
86        "BUILD.bazel",
87        "generate-sources-build.xml",
88        "generate-test-sources-build.xml",
89        "lite.awk",
90        "pom.xml",
91        "pom_template.xml",
92        "process-lite-sources-build.xml",
93    ],
94    strip_prefix = strip_prefix.from_root(""),
95    visibility = ["//java:__pkg__"],
96)
97