xref: /aosp_15_r20/external/cronet/third_party/re2/src/python/BUILD.bazel (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1# Copyright 2009 The RE2 Authors.  All Rights Reserved.
2# Use of this source code is governed by a BSD-style
3# license that can be found in the LICENSE file.
4
5# Bazel (http://bazel.build/) BUILD file for RE2 Python.
6
7load("@pybind11_bazel//:build_defs.bzl", "pybind_extension")
8load("@rules_python//python:defs.bzl", "py_library", "py_test")
9
10pybind_extension(
11    name = "_re2",
12    srcs = ["_re2.cc"],
13    deps = [
14        "//:re2",
15        "@abseil-cpp//absl/strings",
16    ],
17)
18
19py_library(
20    name = "re2",
21    srcs = ["re2.py"],
22    data = [":_re2"],
23    imports = ["."],
24    visibility = ["//visibility:public"],
25)
26
27py_test(
28    name = "re2_test",
29    size = "small",
30    srcs = ["re2_test.py"],
31    deps = [
32        ":re2",
33        "@abseil-py//absl/testing:absltest",
34        "@abseil-py//absl/testing:parameterized",
35    ],
36)
37
38# These are implementation details for `setup.py`, so they can be
39# named however we want. For now, they are named to be consistent
40# with the `--cpu` flag values that they will eventually replace.
41
42platform(
43    name = "darwin_x86_64",
44    constraint_values = [
45        "@platforms//cpu:x86_64",
46        "@platforms//os:macos",
47    ],
48)
49
50platform(
51    name = "darwin_arm64",
52    constraint_values = [
53        "@platforms//cpu:arm64",
54        "@platforms//os:macos",
55    ],
56)
57
58platform(
59    name = "x64_x86_windows",
60    constraint_values = [
61        "@platforms//cpu:x86_32",
62        "@platforms//os:windows",
63    ],
64)
65
66platform(
67    name = "x64_windows",
68    constraint_values = [
69        "@platforms//cpu:x86_64",
70        "@platforms//os:windows",
71    ],
72)
73