blob: ee6dc4f0ceccf0d591bacd5df4c1f581980debe8 [file] [log] [blame]
// Copyright (C) 2008 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package {
default_applicable_licenses: ["external_bsdiff_license"],
}
license {
name: "external_bsdiff_license",
visibility: [":__subpackages__"],
license_kinds: ["SPDX-license-identifier-Apache-2.0","SPDX-license-identifier-BSD"],
license_text: ["LICENSE"],
}
cc_defaults {
name: "bsdiff_defaults",
host_supported: true,
static_libs: ["libbz", "libbrotli"],
// Allow internal includes to be referenced with the "bsdiff/" prefix in the
// path.
include_dirs: ["external"],
export_include_dirs: ["include"],
cflags: [
"-D_FILE_OFFSET_BITS=64",
"-Wall",
"-Werror",
"-Wextra",
"-Wno-unused-parameter",
],
}
// Host and target static libraries.
cc_library_static {
name: "libbspatch",
defaults: ["bsdiff_defaults"],
vendor_available: true,
recovery_available: true,
visibility: [
"//bootable/recovery:__subpackages__",
"//external/puffin:__subpackages__",
"//system/update_engine:__subpackages__",
"//system/core/fs_mgr/libsnapshot:__subpackages__",
],
srcs: [
"brotli_decompressor.cc",
"bspatch.cc",
"bz2_decompressor.cc",
"buffer_file.cc",
"decompressor_interface.cc",
"extents.cc",
"extents_file.cc",
"file.cc",
"logging.cc",
"memory_file.cc",
"patch_reader.cc",
"sink_file.cc",
"utils.cc",
],
}
cc_library_static {
name: "libbsdiff",
defaults: ["bsdiff_defaults"],
srcs: [
"brotli_compressor.cc",
"bsdiff.cc",
"bz2_compressor.cc",
"compressor_buffer.cc",
"diff_encoder.cc",
"endsley_patch_writer.cc",
"logging.cc",
"patch_writer.cc",
"patch_writer_factory.cc",
"split_patch_writer.cc",
"suffix_array_index.cc",
],
static_libs: [
"libdivsufsort64",
"libdivsufsort",
"libbrotli",
],
}
// Host executables: bsdiff and bspatch are only built for the host.
cc_binary_host {
name: "bspatch",
defaults: ["bsdiff_defaults"],
srcs: ["bspatch_main.cc"],
static_libs: [
"libbspatch",
"libbz",
"libbrotli",
],
}
cc_binary_host {
name: "bsdiff",
defaults: ["bsdiff_defaults"],
srcs: [
"bsdiff_arguments.cc",
"bsdiff_main.cc",
],
static_libs: [
"libbsdiff",
"libdivsufsort64",
"libdivsufsort",
"libbz",
"libbrotli",
],
}
// Unit tests.
cc_test {
name: "bsdiff_unittest",
defaults: ["bsdiff_defaults"],
test_suites: ["device-tests"],
srcs: [
"brotli_compressor_unittest.cc",
"brotli_decompressor_unittest.cc",
"bsdiff_arguments.cc",
"bsdiff_arguments_unittest.cc",
"bsdiff_unittest.cc",
"bspatch_unittest.cc",
"bz2_decompressor_unittest.cc",
"diff_encoder_unittest.cc",
"endsley_patch_writer_unittest.cc",
"extents_file_unittest.cc",
"extents_unittest.cc",
"patch_reader_unittest.cc",
"patch_writer_unittest.cc",
"split_patch_writer_unittest.cc",
"suffix_array_index_unittest.cc",
"test_utils.cc",
"testrunner.cc",
],
static_libs: [
"libbsdiff",
"libbspatch",
"libgmock",
"libdivsufsort64",
"libdivsufsort",
"libbz",
"libbrotli",
],
target: {
android: {
cflags: ["-DBSDIFF_TARGET_UNITTEST"],
},
},
test_options: {
unit_test: true,
},
}