xref: /aosp_15_r20/external/brotli/Android.bp (revision f4ee7fba7774faf2a30f13154332c0a06550dbc4)
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//
15
16package {
17    default_applicable_licenses: ["external_brotli_license"],
18}
19
20// Added automatically by a large-scale-change that took the approach of
21// 'apply every license found to every target'. While this makes sure we respect
22// every license restriction, it may not be entirely correct.
23//
24// e.g. GPL in an MIT project might only apply to the contrib/ directory.
25//
26// Please consider splitting the single license below into multiple licenses,
27// taking care not to lose any license_kind information, and overriding the
28// default license using the 'licenses: [...]' property on targets as needed.
29//
30// For unused files, consider creating a 'fileGroup' with "//visibility:private"
31// to attach the license to, and including a comment whether the files may be
32// used in the current project.
33// See: http://go/android-license-faq
34license {
35    name: "external_brotli_license",
36    visibility: [":__subpackages__"],
37    license_kinds: [
38        "SPDX-license-identifier-BSD",
39        "SPDX-license-identifier-MIT",
40        "SPDX-license-identifier-Unlicense",
41        "legacy_permissive",
42        "legacy_unencumbered",
43    ],
44    license_text: [
45        "LICENSE",
46    ],
47}
48
49cc_library_static {
50    name: "libbrotli",
51    host_supported: true,
52    vendor_available: true,
53    recovery_available: true,
54    ramdisk_available: true,
55    vendor_ramdisk_available: true,
56
57    min_sdk_version: "apex_inherit",
58    apex_available: [
59        "//apex_available:platform",
60        "com.android.adbd",
61    ],
62
63    visibility: [
64        "//bootable/recovery:__subpackages__",
65        "//bootable/deprecated-ota:__subpackages__",
66        "//external/bsdiff:__subpackages__",
67        "//external/puffin:__subpackages__",
68        "//packages/modules/adb:__subpackages__",
69        "//system/core/fs_mgr/libsnapshot:__subpackages__",
70        "//system/extras/partition_tools:__subpackages__",
71        "//system/update_engine:__subpackages__",
72    ],
73
74    cflags: [
75        "-Werror",
76        "-O2",
77    ],
78    export_include_dirs: ["c/include"],
79    srcs: [
80        "c/common/*.c",
81        "c/dec/*.c",
82        "c/enc/*.c",
83    ],
84    target: {
85        linux_bionic: {
86            enabled: true,
87        },
88        windows: {
89            enabled: true,
90        },
91    },
92    stl: "none",
93}
94
95cc_binary {
96    name: "brotli",
97    host_supported: true,
98    cflags: ["-Werror"],
99    srcs: ["c/tools/brotli.c"],
100    target: {
101        linux_bionic: {
102            enabled: true,
103        },
104    },
105    static_libs: ["libbrotli"],
106    stl: "none",
107}
108
109cc_library_shared {
110    name: "libbrotli_encoder_jni",
111    host_supported: true,
112    srcs: [
113        "java/org/brotli/wrapper/enc/encoder_jni.cc",
114    ],
115    static_libs: [
116        "libnativehelper_lazy",
117        "libbrotli",
118    ],
119    cflags: [
120        "-Wno-unused-parameter",
121    ],
122}
123
124//
125// Support for brotli in java code.
126//
127
128java_library {
129    name: "brotli-java",
130    host_supported: true,
131    hostdex: true,
132    srcs: ["java/**/*.java"],
133    exclude_srcs: ["java/**/*Test.java"],
134    sdk_version: "current",
135    // TODO(b/237039251) use "apex_inherit" when Java modules support it
136    min_sdk_version: "29",
137    // b/267831518: Pin tradefed and dependencies to Java 11.
138    java_version: "11",
139    apex_available: [
140        "//apex_available:platform",
141        "com.android.virt",
142    ],
143}
144
145// TODO(b/171429704): Remove this genrule and use the fuzz_data.zip
146// directly in brotli-fuzzer when a corpus_zip option is available.
147genrule {
148    name: "brotli-fuzzer-corpus",
149    srcs: ["java/org/brotli/integration/fuzz_data.zip"],
150    cmd: "mkdir -p $(genDir)/c/fuzz && " +
151        "unzip -q $(in) -d $(genDir)/c/fuzz",
152    out: [
153        "c/fuzz/04bdd9f35a2881027adddb039026623cd2e86664",
154        "c/fuzz/04dc2c1dc1f4612d4dc4892f4444983f2064c252",
155        "c/fuzz/05a79f06cf3f67f726dae68d18a2290f6c9a50c9",
156        "c/fuzz/05b3606442abab241ede01c3b34d1d73afc580d1",
157        "c/fuzz/065977e9fc84bab81eada79880b4481fece00616",
158        "c/fuzz/08e61f98cc5e260e8d9b853bf9d5c1d9c7a9fc4d",
159        "c/fuzz/155b07e636d98a80a53e667caef9e11370cef995",
160        "c/fuzz/2ad192eab5c0f6e50f0c64777811ae9111bad918",
161        "c/fuzz/2b1cba1e32deab80f440d886d1be7ca43733e878",
162        "c/fuzz/2fe9bc36724f80651a75cde84233a4832afec947",
163        "c/fuzz/312287bfd6732b264b54f9d5eda69f79c73898da",
164        "c/fuzz/3254df93e6003641dfc55522f594335e2c871b8f",
165        "c/fuzz/35a8db906eb1834b8acefd0bb9236ab8dc2ebbfe",
166        "c/fuzz/3a8e0fefadd562f706a16ec84c67646ba7ddcf29",
167        "c/fuzz/3edbdb6fcdb1ff53428af36bc4982f4611303eae",
168        "c/fuzz/477f2aa9b6ca0ff2ef72365d227baabb4855646e",
169        "c/fuzz/49fab0752d21ca89e4da04bdbb86dc7abb6b77e9",
170        "c/fuzz/4b809bfcd95342116053b0c057c878f08c1178b9",
171        "c/fuzz/523dfcdc31b2cb3b0f4715faa2be89b3d0a1d373",
172        "c/fuzz/54fd1711209fb1c0781092374132c66e79e2241b",
173        "c/fuzz/5515e03743624befa68a626382b605829300448d",
174        "c/fuzz/5be2ace579d7b0d816c31db7e65dc3245f1e09a6",
175        "c/fuzz/6f672b1c3c8643ce5083f6efee790b29459cbb47",
176        "c/fuzz/6fb6157dc83d29ef5d4da645e4a078179f54f405",
177        "c/fuzz/70eaba097fdbde0c63159f194ec4cec0f201acd8",
178        "c/fuzz/725ce4c76aa864430d7f4cae9e4cc4fbdd889f5e",
179        "c/fuzz/73231c6592f195ffd41100b8706d1138ff6893b9",
180        "c/fuzz/754f38420c156404309fa05f1ed773be47336882",
181        "c/fuzz/7730f322fb995dd3495d6e69906ff1f5b3cd876f",
182        "c/fuzz/7b74620c59451546866d80c0629ec01221246f59",
183        "c/fuzz/7b9cde6a96a7446f6951cca66266284db28be916",
184        "c/fuzz/7cc01983b79447178179e59af8a56cf4f45b9f8f",
185        "c/fuzz/7d3783cb4414c6098f7ac49ebaa8d2122eb06a0e",
186        "c/fuzz/7ecfeb33839bb8cea5027eb9fc7e5689799e704c",
187        "c/fuzz/7f88ed32938bef52eeaf3d3defedbfd2df87f895",
188        "c/fuzz/90450c570b868c4db80473b978529f6ec6dde20d",
189        "c/fuzz/9590340f604e5c729dbf8b54e25715fd18adb318",
190        "c/fuzz/a3491e5bbd78932592cd02dbff09cd05ca36e2e9",
191        "c/fuzz/a848e83a76d026b01bdfc2c0a6ac841564a97347",
192        "c/fuzz/a8abd012eb59b862bf9bc1ea443d2f35a1a2e222",
193        "c/fuzz/abcaee2817f06af41383c41a7e0920f1cc5a14ec",
194        "c/fuzz/ac81161dd772b1c7a47aa5cefed1ec3d8ac442af",
195        "c/fuzz/aec354d02df9ddb8d4e9ebb0c2771f1325cc2b89",
196        "c/fuzz/c01afbfde5a6ff0e5b0873f9d1ab8742293a375e",
197        "c/fuzz/c18cc3b3c69a07404a2c3cc756ed2d18f3dd4348",
198        "c/fuzz/c46fa7f0b56a80fcf8b1a8a6cbc24e4139b59a6b",
199        "c/fuzz/c51ab436e7332470ea2fd3d68ddbc3d0c43cf7ea",
200        "c/fuzz/c95701b41f06e892874d3001b32c64510c33c178",
201        "c/fuzz/d2b552c1f35b645332e7f63dea404046fdc8577b",
202        "c/fuzz/d6b5b93e87be7082e917d4bcc4d3436f34978d4b",
203        "c/fuzz/d75a03333816807599eadcb043a298ffa8c83378",
204        "c/fuzz/da39a3ee5e6b4b0d3255bfef95601890afd80709",
205        "c/fuzz/dc37d2e46439be3aa4bf23102f0960adbf13aae1",
206        "c/fuzz/de7c798e9523bd7e8350f3a391248cc9700bc4b4",
207        "c/fuzz/e1346339b452f86470a562335958bb6729f66bb2",
208        "c/fuzz/e6d0943f26000ee2306f10b1c1d44ab23619b20a",
209        "c/fuzz/ed22dce9884f67e05bcc082ba9b11424cf6e0449",
210        "c/fuzz/f5c1dc2f4906adb429197a011692b71bc1db856a",
211        "c/fuzz/fb1d6415c35cf9d7807e05e14179537e2019e635",
212    ],
213}
214
215cc_fuzz {
216    name: "brotli-fuzzer",
217    static_libs: ["libbrotli"],
218    srcs: ["c/fuzz/decode_fuzzer.c"],
219    corpus: [":brotli-fuzzer-corpus"],
220    fuzz_config: {
221        componentid: 128577,
222    },
223}
224