1// Copyright (C) 2016 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://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,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// =========
16// incidentd
17// =========
18
19cc_binary {
20    name: "incidentd",
21
22    srcs: [
23        "src/**/*.cpp",
24        "src/**/*.proto",
25        ":incidentd_section_list",
26    ],
27
28    cflags: [
29        "-Wall",
30        "-Werror",
31        "-Wno-missing-field-initializers",
32        "-Wno-unused-variable",
33        "-Wunused-parameter",
34        "-Wno-tautological-undefined-compare",
35
36        // Allow implicit fallthrough in IncidentService.cpp:85 until it is fixed.
37        "-Wno-error=implicit-fallthrough",
38
39        // optimize for size (protobuf glop can get big)
40        "-Os",
41        //"-g",
42        //"-O0",
43    ],
44
45    local_include_dirs: ["src"],
46    generated_headers: ["gen-platform-proto-constants"],
47
48    proto: {
49        type: "lite",
50    },
51
52    shared_libs: [
53        "libbase",
54        "libbinder",
55        "libdebuggerd_client",
56        "libdumputils",
57        "libincident",
58        "liblog",
59        "libprotoutil",
60        "libservices",
61        "libutils",
62        "libprotobuf-cpp-lite",
63    ],
64
65    static_libs: [
66        "libincidentcompanion",
67        "libplatformprotos",
68    ],
69
70    product_variables: {
71        debuggable: {
72            cflags: ["-DALLOW_RESTRICTED_SECTIONS=1"],
73        },
74    },
75
76
77    init_rc: ["incidentd.rc"],
78}
79
80// ==============
81// incidentd_test
82// ==============
83
84cc_test {
85    name: "incidentd_test",
86    test_suites: ["device-tests"],
87
88    cflags: [
89        "-Werror",
90        "-Wall",
91        "-Wno-unused-variable",
92        "-Wunused-parameter",
93        "-g",
94        "-Wno-tautological-undefined-compare",
95
96        // Allow implicit fallthrough in IncidentService.cpp:85 until it is fixed.
97        "-Wno-error=implicit-fallthrough",
98    ],
99
100    local_include_dirs: ["src"],
101    generated_headers: ["gen-platform-proto-constants"],
102
103    srcs: [
104        "tests/**/*.cpp",
105        "tests/**/*.proto",
106        "src/FdBuffer.cpp",
107        "src/Privacy.cpp",
108        "src/PrivacyFilter.cpp",
109        "src/Reporter.cpp",
110        "src/Section.cpp",
111        "src/Throttler.cpp",
112        "src/WorkDirectory.cpp",
113        "src/incidentd_util.cpp",
114        "src/proto_util.cpp",
115        "src/report_directory.cpp",
116        "src/**/*.proto",
117    ],
118
119    data: ["testdata/**/*"],
120
121    static_libs: [
122        "libgmock",
123        "libincidentcompanion",
124        "libplatformprotos-test",
125    ],
126    shared_libs: [
127        "libbase",
128        "libbinder",
129        "libdebuggerd_client",
130        "libdumputils",
131        "libincident",
132        "liblog",
133        "libprotobuf-cpp-full",
134        "libprotoutil",
135        "libservices",
136        "libutils",
137    ],
138
139    target: {
140        android: {
141            proto: {
142                type: "full",
143            },
144        },
145    },
146}
147
148genrule {
149    name: "incidentd_section_list",
150    tools: ["incident-section-gen"],
151    out: ["section_list.cpp"],
152    cmd: "$(location incident-section-gen) incidentd > $(out)",
153}
154