xref: /aosp_15_r20/build/bazel/examples/gensrcs/generated_headers/foo/Android.bp (revision 7594170e27e0732bc44b93d1440d87a54b6ffe7c)
1/*
2 * Copyright (C) 2022 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package {
18    default_applicable_licenses: ["Android-Apache-2.0"],
19}
20
21gensrcs {
22    name: "foo-protoc-gen-headers",
23
24    tools: [
25        "aprotoc",
26        "protoc-gen-cppstream",
27    ],
28
29    tool_files: [
30        ":libprotobuf-internal-protos",
31    ],
32
33    cmd: "mkdir -p $(genDir) " +
34        "&& $(location aprotoc) " +
35        "  --plugin=$(location protoc-gen-cppstream) " +
36        "  --cppstream_out=$(genDir) " +
37        "  -Iexternal/protobuf/src " +
38        "  -I . " +
39        "  $(in)",
40
41    srcs: [
42        "foo.proto",
43    ],
44
45    output_extension: "proto.h",
46}
47
48cc_library_shared {
49    name: "foo-cc_library_shared",
50    srcs: [
51        "foo.cpp",
52    ],
53    generated_headers: [
54        "foo-protoc-gen-headers",
55        "bar-protoc-gen-headers",
56    ],
57}
58