1package {
2    default_applicable_licenses: ["external_rust_cxx_license"],
3}
4
5// Added automatically by a large-scale-change that took the approach of
6// 'apply every license found to every target'. While this makes sure we respect
7// every license restriction, it may not be entirely correct.
8//
9// e.g. GPL in an MIT project might only apply to the contrib/ directory.
10//
11// Please consider splitting the single license below into multiple licenses,
12// taking care not to lose any license_kind information, and overriding the
13// default license using the 'licenses: [...]' property on targets as needed.
14//
15// For unused files, consider creating a 'fileGroup' with "//visibility:private"
16// to attach the license to, and including a comment whether the files may be
17// used in the current project.
18//
19// large-scale-change included anything that looked like it might be a license
20// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
21//
22// Please consider removing redundant or irrelevant files from 'license_text:'.
23// See: http://go/android-license-faq
24license {
25    name: "external_rust_cxx_license",
26    visibility: [":__subpackages__"],
27    license_kinds: [
28        "SPDX-license-identifier-Apache-2.0",
29        "SPDX-license-identifier-MIT",
30    ],
31    license_text: [
32        "LICENSE-APACHE",
33        "LICENSE-MIT",
34    ],
35}
36
37rust_library {
38    name: "libcxx",
39    crate_name: "cxx",
40    srcs: ["src/lib.rs"],
41    edition: "2021",
42    features: [
43        "alloc",
44        "std",
45    ],
46    rustlibs: [
47        "libanyhow",
48        "libthiserror",
49    ],
50    proc_macros: [
51        "libcxxbridge_macro",
52    ],
53    whole_static_libs: [
54        "libcxxbridge05",
55    ],
56    shared_libs: ["libc++"],
57    host_supported: true,
58    vendor_available: true,
59    product_available: true,
60    apex_available: [
61        "//apex_available:anyapex",
62        "//apex_available:platform",
63    ],
64    min_sdk_version: "29",
65}
66
67cc_library_static {
68    name: "libcxxbridge05",
69    defaults: ["rust_static_cc_lib_defaults"],
70    cflags: ["-DRUST_CXX_NO_EXCEPTIONS"],
71    srcs: ["src/cxx.cc"],
72    host_supported: true,
73    vendor_available: true,
74    product_available: true,
75    apex_available: [
76        "//apex_available:anyapex",
77        "//apex_available:platform",
78    ],
79    min_sdk_version: "29",
80}
81
82cc_library_static {
83    host_supported: true,
84    name: "libcxx-demo-blobstore",
85    srcs: ["demo/src/blobstore.cc"],
86    generated_headers: [
87        "cxx-demo-bridge-header",
88        "cxx-bridge-header",
89    ],
90    generated_sources: ["cxx-demo-bridge-code"],
91}
92
93genrule {
94    name: "cxx-bridge-header",
95    tools: ["cxxbridge"],
96    cmd: "$(location cxxbridge) --header > $(out)",
97    out: ["rust/cxx.h"],
98}
99