1// Copyright (C) 2008 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_bsdiff_license"], 17} 18 19license { 20 name: "external_bsdiff_license", 21 visibility: [":__subpackages__"], 22 license_kinds: ["SPDX-license-identifier-Apache-2.0","SPDX-license-identifier-BSD"], 23 license_text: ["LICENSE"], 24} 25 26cc_defaults { 27 name: "bsdiff_defaults", 28 host_supported: true, 29 static_libs: ["libbz", "libbrotli"], 30 // Allow internal includes to be referenced with the "bsdiff/" prefix in the 31 // path. 32 include_dirs: ["external"], 33 export_include_dirs: ["include"], 34 cflags: [ 35 "-D_FILE_OFFSET_BITS=64", 36 "-Wall", 37 "-Werror", 38 "-Wextra", 39 "-Wno-unused-parameter", 40 ], 41} 42 43// Host and target static libraries. 44cc_library_static { 45 name: "libbspatch", 46 defaults: ["bsdiff_defaults"], 47 vendor_available: true, 48 recovery_available: true, 49 50 visibility: [ 51 "//bootable/recovery:__subpackages__", 52 "//bootable/deprecated-ota:__subpackages__", 53 "//external/puffin:__subpackages__", 54 "//system/update_engine:__subpackages__", 55 "//system/core/fs_mgr/libsnapshot:__subpackages__", 56 ], 57 58 srcs: [ 59 "brotli_decompressor.cc", 60 "bspatch.cc", 61 "bz2_decompressor.cc", 62 "buffer_file.cc", 63 "decompressor_interface.cc", 64 "extents.cc", 65 "extents_file.cc", 66 "file.cc", 67 "logging.cc", 68 "memory_file.cc", 69 "patch_reader.cc", 70 "sink_file.cc", 71 "utils.cc", 72 ], 73} 74 75cc_library_static { 76 name: "libbsdiff", 77 recovery_available: true, 78 defaults: ["bsdiff_defaults"], 79 80 srcs: [ 81 "brotli_compressor.cc", 82 "bsdiff.cc", 83 "bz2_compressor.cc", 84 "compressor_buffer.cc", 85 "diff_encoder.cc", 86 "endsley_patch_writer.cc", 87 "logging.cc", 88 "patch_writer.cc", 89 "patch_writer_factory.cc", 90 "split_patch_writer.cc", 91 "suffix_array_index.cc", 92 ], 93 static_libs: [ 94 "libdivsufsort64", 95 "libdivsufsort", 96 "libbrotli", 97 ], 98} 99 100// Host executables: bsdiff and bspatch are only built for the host. 101cc_binary_host { 102 name: "bspatch", 103 defaults: ["bsdiff_defaults"], 104 105 srcs: ["bspatch_main.cc"], 106 static_libs: [ 107 "libbspatch", 108 "libbz", 109 "libbrotli", 110 ], 111} 112 113cc_binary_host { 114 name: "bsdiff", 115 defaults: ["bsdiff_defaults"], 116 117 srcs: [ 118 "bsdiff_arguments.cc", 119 "bsdiff_main.cc", 120 ], 121 static_libs: [ 122 "libbsdiff", 123 "libdivsufsort64", 124 "libdivsufsort", 125 "libbz", 126 "libbrotli", 127 ], 128} 129 130// Unit tests. 131cc_test { 132 name: "bsdiff_unittest", 133 defaults: ["bsdiff_defaults"], 134 test_suites: ["device-tests"], 135 srcs: [ 136 "brotli_compressor_unittest.cc", 137 "brotli_decompressor_unittest.cc", 138 "bsdiff_arguments.cc", 139 "bsdiff_arguments_unittest.cc", 140 "bsdiff_unittest.cc", 141 "bspatch_unittest.cc", 142 "bz2_decompressor_unittest.cc", 143 "diff_encoder_unittest.cc", 144 "endsley_patch_writer_unittest.cc", 145 "extents_file_unittest.cc", 146 "extents_unittest.cc", 147 "patch_reader_unittest.cc", 148 "patch_writer_unittest.cc", 149 "split_patch_writer_unittest.cc", 150 "suffix_array_index_unittest.cc", 151 "test_utils.cc", 152 "testrunner.cc", 153 ], 154 static_libs: [ 155 "libbsdiff", 156 "libbspatch", 157 "libgmock", 158 "libdivsufsort64", 159 "libdivsufsort", 160 "libbz", 161 "libbrotli", 162 ], 163 target: { 164 android: { 165 cflags: ["-DBSDIFF_TARGET_UNITTEST"], 166 }, 167 }, 168 test_options: { 169 unit_test: true, 170 }, 171} 172