xref: /aosp_15_r20/external/bazelbuild-rules_python/tests/pycross/BUILD.bazel (revision 60517a1edbc8ecf509223e9af94a7adec7d736b8)
1*60517a1eSAndroid Build Coastguard Worker# Copyright 2023 The Bazel Authors. All rights reserved.
2*60517a1eSAndroid Build Coastguard Worker#
3*60517a1eSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License");
4*60517a1eSAndroid Build Coastguard Worker# you may not use this file except in compliance with the License.
5*60517a1eSAndroid Build Coastguard Worker# You may obtain a copy of the License at
6*60517a1eSAndroid Build Coastguard Worker#
7*60517a1eSAndroid Build Coastguard Worker#     http://www.apache.org/licenses/LICENSE-2.0
8*60517a1eSAndroid Build Coastguard Worker#
9*60517a1eSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software
10*60517a1eSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS,
11*60517a1eSAndroid Build Coastguard Worker# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*60517a1eSAndroid Build Coastguard Worker# See the License for the specific language governing permissions and
13*60517a1eSAndroid Build Coastguard Worker# limitations under the License.
14*60517a1eSAndroid Build Coastguard Worker
15*60517a1eSAndroid Build Coastguard Workerload("//python:defs.bzl", "py_test")
16*60517a1eSAndroid Build Coastguard Workerload("//third_party/rules_pycross/pycross/private:wheel_library.bzl", "py_wheel_library")  # buildifier: disable=bzl-visibility
17*60517a1eSAndroid Build Coastguard Worker
18*60517a1eSAndroid Build Coastguard Workerpy_wheel_library(
19*60517a1eSAndroid Build Coastguard Worker    name = "extracted_wheel_for_testing",
20*60517a1eSAndroid Build Coastguard Worker    wheel = "@wheel_for_testing//file",
21*60517a1eSAndroid Build Coastguard Worker)
22*60517a1eSAndroid Build Coastguard Worker
23*60517a1eSAndroid Build Coastguard Workerpy_test(
24*60517a1eSAndroid Build Coastguard Worker    name = "py_wheel_library_test",
25*60517a1eSAndroid Build Coastguard Worker    srcs = [
26*60517a1eSAndroid Build Coastguard Worker        "py_wheel_library_test.py",
27*60517a1eSAndroid Build Coastguard Worker    ],
28*60517a1eSAndroid Build Coastguard Worker    data = [
29*60517a1eSAndroid Build Coastguard Worker        ":extracted_wheel_for_testing",
30*60517a1eSAndroid Build Coastguard Worker    ],
31*60517a1eSAndroid Build Coastguard Worker    deps = [
32*60517a1eSAndroid Build Coastguard Worker        "//python/runfiles",
33*60517a1eSAndroid Build Coastguard Worker    ],
34*60517a1eSAndroid Build Coastguard Worker)
35*60517a1eSAndroid Build Coastguard Worker
36*60517a1eSAndroid Build Coastguard Workerpy_wheel_library(
37*60517a1eSAndroid Build Coastguard Worker    name = "patched_extracted_wheel_for_testing",
38*60517a1eSAndroid Build Coastguard Worker    patch_args = [
39*60517a1eSAndroid Build Coastguard Worker        "-p1",
40*60517a1eSAndroid Build Coastguard Worker    ],
41*60517a1eSAndroid Build Coastguard Worker    patch_tool = "patch",
42*60517a1eSAndroid Build Coastguard Worker    patches = [
43*60517a1eSAndroid Build Coastguard Worker        "0001-Add-new-file-for-testing-patch-support.patch",
44*60517a1eSAndroid Build Coastguard Worker    ],
45*60517a1eSAndroid Build Coastguard Worker    target_compatible_with = select({
46*60517a1eSAndroid Build Coastguard Worker        # We don't have `patch` available on the Windows CI machines.
47*60517a1eSAndroid Build Coastguard Worker        "@platforms//os:windows": ["@platforms//:incompatible"],
48*60517a1eSAndroid Build Coastguard Worker        "//conditions:default": [],
49*60517a1eSAndroid Build Coastguard Worker    }),
50*60517a1eSAndroid Build Coastguard Worker    wheel = "@wheel_for_testing//file",
51*60517a1eSAndroid Build Coastguard Worker)
52*60517a1eSAndroid Build Coastguard Worker
53*60517a1eSAndroid Build Coastguard Workerpy_test(
54*60517a1eSAndroid Build Coastguard Worker    name = "patched_py_wheel_library_test",
55*60517a1eSAndroid Build Coastguard Worker    srcs = [
56*60517a1eSAndroid Build Coastguard Worker        "patched_py_wheel_library_test.py",
57*60517a1eSAndroid Build Coastguard Worker    ],
58*60517a1eSAndroid Build Coastguard Worker    data = [
59*60517a1eSAndroid Build Coastguard Worker        ":patched_extracted_wheel_for_testing",
60*60517a1eSAndroid Build Coastguard Worker    ],
61*60517a1eSAndroid Build Coastguard Worker    deps = [
62*60517a1eSAndroid Build Coastguard Worker        "//python/runfiles",
63*60517a1eSAndroid Build Coastguard Worker    ],
64*60517a1eSAndroid Build Coastguard Worker)
65