xref: /aosp_15_r20/external/pigweed/pw_tokenizer/Android.bp (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1// Copyright 2022 The Pigweed Authors
2//
3// Licensed under the Apache License, Version 2.0 (the "License"); you may not
4// use this file except in compliance with the License. You may obtain a copy of
5// the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12// License for the specific language governing permissions and limitations under
13// the License.
14
15package {
16    default_applicable_licenses: ["external_pigweed_license"],
17}
18
19cc_library_static {
20    name: "pw_detokenizer",
21    cpp_std: "c++20",
22    vendor_available: true,
23    host_supported: true,
24    export_include_dirs: ["public"],
25    defaults: [
26        "pw_android_common_backends",
27    ],
28    header_libs: [
29        "fuchsia_sdk_lib_stdcompat",
30        "pw_assert",
31        "pw_log",
32    ],
33    export_header_lib_headers: [
34        "fuchsia_sdk_lib_stdcompat",
35        "pw_assert",
36        "pw_log",
37    ],
38    srcs: [
39        "base64.cc",
40        "detokenize.cc",
41        "decode.cc",
42    ],
43    static_libs: [
44        "pw_base64",
45        "pw_bytes",
46        "pw_containers",
47        "pw_elf_reader",
48        "pw_log_tokenized",
49        "pw_polyfill",
50        "pw_preprocessor",
51        "pw_result",
52        "pw_span",
53        "pw_stream",
54        "pw_varint",
55    ],
56    export_static_lib_headers: [
57        "pw_base64",
58        "pw_bytes",
59        "pw_containers",
60        "pw_elf_reader",
61        "pw_polyfill",
62        "pw_preprocessor",
63        "pw_result",
64        "pw_span",
65        "pw_stream",
66        "pw_varint",
67    ],
68}
69
70cc_library_static {
71    name: "pw_tokenizer",
72    cpp_std: "c++20",
73    host_supported: true,
74    vendor_available: true,
75    export_include_dirs: ["public"],
76    defaults: [
77        "pw_android_common_backends",
78    ],
79    srcs: [
80        "encode_args.cc",
81        "hash.cc",
82        "tokenize.cc",
83    ],
84    header_libs: [
85        "pw_assert",
86        "pw_log",
87    ],
88    export_header_lib_headers: [
89        "pw_assert",
90        "pw_log",
91    ],
92    static_libs: [
93        "pw_containers",
94        "pw_log_tokenized",
95        "pw_polyfill",
96        "pw_preprocessor",
97        "pw_span",
98        "pw_varint",
99    ],
100    export_static_lib_headers: [
101        "pw_containers",
102        "pw_log_tokenized",
103        "pw_polyfill",
104        "pw_preprocessor",
105        "pw_span",
106        "pw_varint",
107    ],
108}
109
110cc_library_static {
111    name: "pw_tokenizer_base64",
112    cpp_std: "c++20",
113    host_supported: true,
114    vendor_available: true,
115    export_include_dirs: ["public"],
116    defaults: [
117        "pw_android_common_backends",
118    ],
119    srcs: [
120        "base64.cc",
121    ],
122    static_libs: [
123        "pw_base64",
124        "pw_containers",
125        "pw_preprocessor",
126        "pw_span",
127        "pw_string",
128        "pw_tokenizer",
129    ],
130    export_static_lib_headers: [
131        "pw_base64",
132        "pw_containers",
133        "pw_preprocessor",
134        "pw_span",
135        "pw_string",
136        "pw_tokenizer",
137    ],
138}
139
140cc_library_headers {
141    name: "pw_tokenizer_pwpb",
142    cpp_std: "c++20",
143    vendor_available: true,
144    host_supported: true,
145    generated_headers: [
146        "google_protobuf_descriptor_pwpb_h",
147        "pw_tokenizer_proto_options_pwpb_h",
148    ],
149    export_generated_headers: [
150        "google_protobuf_descriptor_pwpb_h",
151        "pw_tokenizer_proto_options_pwpb_h",
152    ],
153}
154
155// Expose pw_tokenizer_proto/options.proto.
156filegroup {
157    name: "pw_tokenizer_proto_options_proto",
158    srcs: [
159        "pw_tokenizer_proto/options.proto",
160    ],
161}
162
163genrule {
164    name: "pw_tokenizer_proto_options_pwpb_h",
165    srcs: [
166        ":libprotobuf-internal-protos",
167        "pw_tokenizer_proto/options.proto",
168    ],
169    cmd: "python3 $(location pw_protobuf_compiler_py) " +
170        "--proto-path=external/pigweed/pw_tokenizer/ " +
171        "--proto-path=external/protobuf/src/ " +
172        "--out-dir=$$(dirname $(location pw_tokenizer_proto/options.pwpb.h)) " +
173        "--plugin-path=$(location pw_protobuf_plugin_py) " +
174        "--compile-dir=$$(dirname $(location pw_tokenizer_proto/options.proto)) " +
175        "--sources $(location pw_tokenizer_proto/options.proto) " +
176        "--language pwpb " +
177        "--no-experimental-proto3-optional " +
178        "--no-experimental-editions " +
179        "--pwpb-no-oneof-callbacks " +
180        "--protoc=$(location aprotoc) ",
181    out: [
182        "pw_tokenizer_proto/options.pwpb.h",
183    ],
184    tools: [
185        "aprotoc",
186        "pw_protobuf_plugin_py",
187        "pw_protobuf_compiler_py",
188    ],
189}
190