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
15package {
16    default_applicable_licenses: ["system_tools_hidl_license"],
17}
18
19// Added automatically by a large-scale-change
20// See: http://go/android-license-faq
21license {
22    name: "system_tools_hidl_license",
23    visibility: [":__subpackages__"],
24    license_kinds: [
25        "SPDX-license-identifier-Apache-2.0",
26    ],
27    license_text: [
28        "NOTICE",
29    ],
30}
31
32cc_defaults {
33    name: "hidl-gen-defaults",
34    cflags: [
35        "-Wall",
36        "-Werror",
37    ],
38    target: {
39        host: {
40            cflags: [
41                "-O0",
42                "-g",
43            ],
44        },
45    },
46}
47
48// This configuration is inherited by all hidl-gen-generated modules.
49cc_defaults {
50    name: "hidl-module-defaults",
51    cflags: [
52        "-Wall",
53        "-Werror",
54        "-Wextra-semi",
55    ],
56    tidy_checks: [
57        // _hidl_cb and addOnewayTask are stuck because of the legacy ABI
58        "-performance-unnecessary-value-param",
59    ],
60    product_variables: {
61        debuggable: {
62            cflags: ["-D__ANDROID_DEBUGGABLE__"],
63        },
64    },
65}
66
67// This configuration is inherited by all hidl-gen-java modules
68java_defaults {
69    name: "hidl-java-module-defaults",
70}
71
72cc_library_host_static {
73    name: "libhidl-gen",
74    defaults: ["hidl-gen-defaults"],
75    srcs: [
76        "Annotation.cpp",
77        "ArrayType.cpp",
78        "CompoundType.cpp",
79        "ConstantExpression.cpp",
80        "DeathRecipientType.cpp",
81        "DocComment.cpp",
82        "EnumType.cpp",
83        "FmqType.cpp",
84        "HandleType.cpp",
85        "HidlTypeAssertion.cpp",
86        "Interface.cpp",
87        "Location.cpp",
88        "MemoryType.cpp",
89        "Method.cpp",
90        "NamedType.cpp",
91        "PointerType.cpp",
92        "ScalarType.cpp",
93        "Scope.cpp",
94        "StringType.cpp",
95        "Type.cpp",
96        "TypeDef.cpp",
97        "VectorType.cpp",
98    ],
99    header_libs: ["libhwbinder_headers"],  // for constants
100    shared_libs: [
101        "libbase",
102        "liblog",
103    ],
104    static_libs: [
105        "libcrypto",
106        "libhidl-gen-hash",
107        "libhidl-gen-host-utils",
108        "libhidl-gen-utils",
109    ],
110    export_shared_lib_headers: ["libbase"],
111    export_static_lib_headers: [
112        "libhidl-gen-hash",
113        "libhidl-gen-host-utils",
114        "libhidl-gen-utils",
115    ],
116    export_include_dirs: ["."], // for tests
117}
118
119cc_library_host_static {
120    name: "libhidl-gen-ast",
121    defaults: ["hidl-gen-defaults"],
122    srcs: [
123        "AST.cpp",
124        "Coordinator.cpp",
125        "generateCpp.cpp",
126        "generateCppImpl.cpp",
127        "generateDependencies.cpp",
128        "generateFormattedHidl.cpp",
129        "generateInheritanceHierarchy.cpp",
130        "generateJava.cpp",
131        "generateJavaImpl.cpp",
132        "generateVts.cpp",
133        "hidl-gen_l.ll",
134        "hidl-gen_y.yy",
135    ],
136    shared_libs: [
137        "libbase",
138        "libjsoncpp",
139    ],
140    static_libs: [
141        "libcrypto",
142        "libhidl-gen",
143        "libhidl-gen-hash",
144        "libhidl-gen-host-utils",
145        "libhidl-gen-utils",
146    ],
147    export_shared_lib_headers: ["libbase"],
148    export_static_lib_headers: [
149        "libhidl-gen-hash",
150        "libhidl-gen-utils",
151    ],
152    export_include_dirs: ["."], // for tests
153    yacc: {
154        gen_location_hh: true,
155        gen_position_hh: true,
156    },
157}
158
159cc_binary_host {
160    name: "hidl-gen",
161    defaults: ["hidl-gen-defaults"],
162    srcs: ["main.cpp"],
163    static_libs: [
164        "libbase",
165        "libcrypto",
166        "libhidl-gen",
167        "libhidl-gen-ast",
168        "libhidl-gen-hash",
169        "libhidl-gen-host-utils",
170        "libhidl-gen-utils",
171        "libjsoncpp",
172        "liblog",
173    ],
174}
175