xref: /aosp_15_r20/external/cronet/testing/rust_gtest_interop/BUILD.gn (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1# Copyright 2022 The Chromium Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//build/rust/rust_macro.gni")
6import("//build/rust/rust_static_library.gni")
7import("//testing/test.gni")
8
9if (enable_rust) {
10  group("rust_gtest_interop") {
11    testonly = true
12    public_deps = [
13      ":rust_gtest_interop_cpp",
14      ":rust_gtest_interop_rust",
15    ]
16  }
17
18  static_library("rust_gtest_interop_cpp") {
19    testonly = true
20    visibility = [ ":rust_gtest_interop" ]
21    sources = [
22      "rust_gtest_interop.cc",
23      "rust_gtest_interop.h",
24    ]
25    deps = [
26      "//base",
27      "//testing/gtest",
28    ]
29  }
30
31  rust_static_library("rust_gtest_interop_rust") {
32    testonly = true
33    visibility = [ ":rust_gtest_interop" ]
34    crate_name = "rust_gtest_interop"
35    crate_root = "rust_gtest_interop.rs"
36    allow_unsafe = true
37    sources = [
38      "expect_macros.rs",
39      "rust_gtest_interop.rs",
40    ]
41    deps = [
42      # Macros re-exported from the rust_gtest_interop crate. Can only be
43      # accessed through the crate, so not public_deps.
44      ":gtest_attribute",
45
46      # This is re-exported for the gtest_attribute macros.
47      "//third_party/rust/small_ctor/v0_1:lib",
48    ]
49  }
50
51  rust_macro("gtest_attribute") {
52    testonly = true
53
54    crate_root = "gtest_attribute.rs"
55    sources = [ "gtest_attribute.rs" ]
56    deps = [
57      "//third_party/rust/proc_macro2/v1:lib",
58      "//third_party/rust/quote/v1:lib",
59      "//third_party/rust/syn/v2:lib",
60    ]
61
62    # This target's contents are exposed as part of :rust_gtest_interop.
63    visibility = [ ":*" ]
64  }
65
66  test("rust_gtest_interop_unittests") {
67    sources = [
68      "rust_gtest_interop_unittest.rs",
69      "rust_gtest_interop_unittest_main.cc",
70    ]
71    deps = [
72      "//base",
73      "//base/test:test_support",
74      "//build:blink_buildflags",
75      "//testing/gtest",
76    ]
77  }
78}
79