1//
2// Copyright (C) 2017 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
17// ==========================================================
18// Build the host executable: stats-log-api-gen
19// ==========================================================
20cc_binary_host {
21    name: "stats-log-api-gen",
22    srcs: [
23        "Collation.cpp",
24        "main.cpp",
25    ],
26    cflags: [
27        "-Wall",
28        "-Werror",
29    ],
30
31    shared_libs: [
32        "libstats_proto_host",
33        "libprotobuf-cpp-full",
34    ],
35
36    proto: {
37        type: "full",
38    },
39}
40
41// ==========================================================
42// Build the host test executable: stats-log-api-gen
43// ==========================================================
44cc_test_host {
45    name: "stats-log-api-gen-test",
46    cflags: [
47        "-Wall",
48        "-Wextra",
49        "-Werror",
50        "-g",
51        "-DUNIT_TEST",
52    ],
53    srcs: [
54        "Collation.cpp",
55        "test_collation.cpp",
56        "test.proto",
57    ],
58
59    static_libs: [
60        "libgmock_host",
61    ],
62
63    shared_libs: [
64        "libstats_proto_host",
65        "libprotobuf-cpp-full",
66    ],
67
68    proto: {
69        type: "full",
70        include_dirs: [
71            "external/protobuf/src",
72        ],
73    },
74}
75
76// ==========================================================
77// Native library
78// ==========================================================
79genrule {
80    name: "statslog.h",
81    tools: ["stats-log-api-gen"],
82    cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog.h",
83    out: [
84        "statslog.h",
85    ],
86}
87
88genrule {
89    name: "statslog.cpp",
90    tools: ["stats-log-api-gen"],
91    cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog.cpp",
92    out: [
93        "statslog.cpp",
94    ],
95}
96
97cc_library_shared {
98    name: "libstatslog",
99    generated_sources: ["statslog.cpp"],
100    generated_headers: ["statslog.h"],
101    cflags: [
102        "-Wall",
103        "-Werror",
104    ],
105    export_generated_headers: ["statslog.h"],
106    shared_libs: [
107        "liblog",
108        "libutils",
109        "libcutils",
110    ],
111    static_libs: ["libstatssocket"],
112}
113