xref: /aosp_15_r20/external/flatbuffers/Android.bp (revision 890232f25432b36107d06881e0a25aaa6b473652)
1// Copyright (C) 2017 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: ["external_flatbuffers_license"],
17}
18
19// Added automatically by a large-scale-change that took the approach of
20// 'apply every license found to every target'. While this makes sure we respect
21// every license restriction, it may not be entirely correct.
22//
23// e.g. GPL in an MIT project might only apply to the contrib/ directory.
24//
25// Please consider splitting the single license below into multiple licenses,
26// taking care not to lose any license_kind information, and overriding the
27// default license using the 'licenses: [...]' property on targets as needed.
28//
29// For unused files, consider creating a 'fileGroup' with "//visibility:private"
30// to attach the license to, and including a comment whether the files may be
31// used in the current project.
32//
33// large-scale-change included anything that looked like it might be a license
34// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc.
35//
36// Please consider removing redundant or irrelevant files from 'license_text:'.
37// See: http://go/android-license-faq
38license {
39    name: "external_flatbuffers_license",
40    visibility: [":__subpackages__"],
41    license_kinds: [
42        "SPDX-license-identifier-Apache-2.0",
43        "SPDX-license-identifier-BSD",
44        "SPDX-license-identifier-Zlib",
45    ],
46    license_text: [
47        "LICENSE",
48        "LICENSE.txt",
49    ],
50}
51
52cc_library_headers {
53    name: "flatbuffer_headers",
54    export_include_dirs: ["include"],
55    vendor_available: true,
56    host_supported: true,
57    sdk_version: "current",
58    min_sdk_version: "apex_inherit",
59    apex_available: [
60        "com.android.adservices",
61        "com.android.extservices",
62        "com.android.neuralnetworks",
63        "com.android.ondevicepersonalization",
64        "test_com.android.neuralnetworks",
65        "//apex_available:platform",
66    ],
67}
68
69cc_binary_host {
70    name: "flatc",
71
72    cppflags: [
73        "-fsigned-char",
74        "-pedantic",
75        "-Wall",
76        "-Werror",
77        "-Wextra",
78        "-Werror=shadow",
79        "-Wno-implicit-fallthrough", // in reflection.cpp
80    ],
81
82    rtti: true,
83
84    local_include_dirs: [
85        "grpc",
86        "include",
87    ],
88
89    srcs: [
90        "src/*.cpp",
91        "grpc/src/compiler/*.cc",
92    ],
93    exclude_srcs: [
94        "src/flathash.cpp",
95    ],
96}
97
98java_library {
99    name: "flatbuffers-java",
100    srcs: ["java/**/*.java"],
101    sdk_version: "current",
102    min_sdk_version: "30",
103
104    java_version: "1.8",
105    apex_available: [
106        "//apex_available:platform",
107        "com.android.ondevicepersonalization",
108    ],
109}
110
111cc_library {
112    name: "libflatbuffers-cpp",
113    export_include_dirs: ["include"],
114    sdk_version: "current",
115    stl: "libc++_static",
116    host_supported: true,
117    vendor_available: true,
118    local_include_dirs: [
119        "include",
120    ],
121    srcs: [
122        "src/code_generators.cpp",
123        "src/idl_gen_fbs.cpp",
124        "src/idl_gen_text.cpp",
125        "src/idl_parser.cpp",
126        "src/reflection.cpp",
127        "src/util.cpp",
128    ],
129    apex_available: [
130        "//apex_available:platform",
131        "com.android.btservices",
132        "com.android.extservices",
133    ],
134    min_sdk_version: "30",
135}
136
137cc_defaults {
138    name: "flatbuffers_fuzzer_defaults",
139    srcs: [
140        "tests/test_assert.cpp",
141    ],
142    shared_libs: [
143        "liblog",
144        "libflatbuffers-cpp",
145    ],
146    local_include_dirs: [
147        "tests",
148        "tests/fuzzer",
149    ],
150    fuzz_config: {
151        componentid: 87896,
152    },
153}
154
155cc_fuzz {
156    name: "flatbuffers_parser_fuzzer",
157    defaults: ["flatbuffers_fuzzer_defaults"],
158    srcs: [
159        "tests/fuzzer/flatbuffers_parser_fuzzer.cc",
160    ],
161}
162
163cc_fuzz {
164    name: "flatbuffers_scalar_fuzzer",
165    defaults: ["flatbuffers_fuzzer_defaults"],
166    srcs: [
167        "tests/fuzzer/flatbuffers_scalar_fuzzer.cc",
168    ],
169}
170
171cc_fuzz {
172    name: "flatbuffers_verifier_fuzzer",
173    defaults: ["flatbuffers_fuzzer_defaults"],
174    srcs: [
175        "tests/fuzzer/flatbuffers_verifier_fuzzer.cc",
176    ],
177}
178