blob: 9f684630bc47d2abca7ea9226e4a4eb80dc5607e [file] [log] [blame]
Alex Deymo831dc452017-09-07 21:09:58 +02001// 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
15cc_defaults {
16 name: "bsdiff_defaults",
17 host_supported: true,
Tianjie Xu1c26e2e2017-10-26 17:19:41 -070018 static_libs: ["libbz", "libbrotli"],
Alex Deymodcd423b2017-09-13 20:54:24 +020019 // Allow internal includes to be referenced with the "bsdiff/" prefix in the
20 // path.
21 include_dirs: ["external"],
Alex Deymocb620ca2017-10-30 11:51:38 +010022 export_include_dirs: ["include"],
Alex Deymo831dc452017-09-07 21:09:58 +020023 cflags: [
24 "-D_FILE_OFFSET_BITS=64",
25 "-Wall",
26 "-Werror",
27 "-Wextra",
28 "-Wno-unused-parameter",
29 ],
30}
31
32// Host and target static libraries.
33cc_library_static {
34 name: "libbspatch",
35 defaults: ["bsdiff_defaults"],
Bill Peckham64263b72019-09-17 16:48:12 -070036 vendor_available: true,
Dan Willemsen141f70a2018-10-23 13:44:38 -070037 recovery_available: true,
Alex Deymo831dc452017-09-07 21:09:58 +020038
Bill Peckham590b1fa2019-10-17 18:09:55 -070039 visibility: [
40 "//bootable/recovery:__subpackages__",
41 "//external/puffin:__subpackages__",
42 "//system/update_engine:__subpackages__",
43 ],
44
Alex Deymo831dc452017-09-07 21:09:58 +020045 srcs: [
Tianjie Xu4d10c3e2017-10-26 14:02:06 -070046 "brotli_decompressor.cc",
Alex Deymo831dc452017-09-07 21:09:58 +020047 "bspatch.cc",
Tianjie Xu65288122017-10-13 15:10:58 -070048 "bz2_decompressor.cc",
Alex Deymo831dc452017-09-07 21:09:58 +020049 "buffer_file.cc",
Tianjie Xu4d10c3e2017-10-26 14:02:06 -070050 "decompressor_interface.cc",
Alex Deymo831dc452017-09-07 21:09:58 +020051 "extents.cc",
52 "extents_file.cc",
53 "file.cc",
Tianjie Xu18480eb2017-11-29 16:21:43 -080054 "logging.cc",
Alex Deymo831dc452017-09-07 21:09:58 +020055 "memory_file.cc",
Tianjie Xu65288122017-10-13 15:10:58 -070056 "patch_reader.cc",
Alex Deymo831dc452017-09-07 21:09:58 +020057 "sink_file.cc",
Tianjie Xu65288122017-10-13 15:10:58 -070058 "utils.cc",
Alex Deymo831dc452017-09-07 21:09:58 +020059 ],
60}
61
62cc_library_static {
63 name: "libbsdiff",
64 defaults: ["bsdiff_defaults"],
65
Alex Deymoa28e0192017-09-08 14:21:05 +020066 srcs: [
Tianjie Xu1c26e2e2017-10-26 17:19:41 -070067 "brotli_compressor.cc",
Alex Deymoa28e0192017-09-08 14:21:05 +020068 "bsdiff.cc",
69 "bz2_compressor.cc",
Tianjie Xu1c26e2e2017-10-26 17:19:41 -070070 "compressor_buffer.cc",
Alex Deymo68c0e7f2017-10-02 20:38:12 +020071 "diff_encoder.cc",
Alex Deymo710b3da2017-10-26 13:13:28 +020072 "endsley_patch_writer.cc",
Tianjie Xu18480eb2017-11-29 16:21:43 -080073 "logging.cc",
Alex Deymoa28e0192017-09-08 14:21:05 +020074 "patch_writer.cc",
Alex Deymo8a179e52017-10-26 17:10:20 +020075 "patch_writer_factory.cc",
Alex Deymoe1140a22017-10-02 21:01:15 +020076 "split_patch_writer.cc",
Alex Deymo48ad5ab2017-09-13 22:17:57 +020077 "suffix_array_index.cc",
Alex Deymoa28e0192017-09-08 14:21:05 +020078 ],
Alex Deymo831dc452017-09-07 21:09:58 +020079 static_libs: [
80 "libdivsufsort64",
81 "libdivsufsort",
Tianjie Xu1c26e2e2017-10-26 17:19:41 -070082 "libbrotli",
Alex Deymo831dc452017-09-07 21:09:58 +020083 ],
84}
85
Tao Bao1c1bce92019-01-10 11:28:53 -080086// Host executables: bsdiff and bspatch are only built for the host.
87cc_binary_host {
Alex Deymo831dc452017-09-07 21:09:58 +020088 name: "bspatch",
89 defaults: ["bsdiff_defaults"],
90
91 srcs: ["bspatch_main.cc"],
92 static_libs: [
93 "libbspatch",
94 "libbz",
Tianjie Xu1c26e2e2017-10-26 17:19:41 -070095 "libbrotli",
Alex Deymo831dc452017-09-07 21:09:58 +020096 ],
97}
98
Alex Deymo831dc452017-09-07 21:09:58 +020099cc_binary_host {
100 name: "bsdiff",
101 defaults: ["bsdiff_defaults"],
102
Tianjie Xu1f1cdb22017-11-20 11:05:55 -0800103 srcs: [
104 "bsdiff_arguments.cc",
105 "bsdiff_main.cc",
106 ],
Alex Deymo831dc452017-09-07 21:09:58 +0200107 static_libs: [
108 "libbsdiff",
109 "libdivsufsort64",
110 "libdivsufsort",
111 "libbz",
Tianjie Xu1c26e2e2017-10-26 17:19:41 -0700112 "libbrotli",
Alex Deymo831dc452017-09-07 21:09:58 +0200113 ],
114}
115
116// Unit tests.
117cc_test {
118 name: "bsdiff_unittest",
119 defaults: ["bsdiff_defaults"],
120 test_suites: ["device-tests"],
121 srcs: [
Tianjie Xu1c26e2e2017-10-26 17:19:41 -0700122 "brotli_compressor_unittest.cc",
Alex Deymo338f3402018-03-23 13:40:17 +0100123 "brotli_decompressor_unittest.cc",
Tianjie Xu1f1cdb22017-11-20 11:05:55 -0800124 "bsdiff_arguments.cc",
125 "bsdiff_arguments_unittest.cc",
Alex Deymo831dc452017-09-07 21:09:58 +0200126 "bsdiff_unittest.cc",
127 "bspatch_unittest.cc",
Alex Deymo64d5cd82018-03-12 20:00:04 +0100128 "bz2_decompressor_unittest.cc",
Alex Deymo68c0e7f2017-10-02 20:38:12 +0200129 "diff_encoder_unittest.cc",
Alex Deymo710b3da2017-10-26 13:13:28 +0200130 "endsley_patch_writer_unittest.cc",
Alex Deymo831dc452017-09-07 21:09:58 +0200131 "extents_file_unittest.cc",
132 "extents_unittest.cc",
Tianjie Xu65288122017-10-13 15:10:58 -0700133 "patch_reader_unittest.cc",
Alex Deymofb3b6322017-09-27 14:28:54 +0200134 "patch_writer_unittest.cc",
Alex Deymoe1140a22017-10-02 21:01:15 +0200135 "split_patch_writer_unittest.cc",
Alex Deymo48ad5ab2017-09-13 22:17:57 +0200136 "suffix_array_index_unittest.cc",
Alex Deymo831dc452017-09-07 21:09:58 +0200137 "test_utils.cc",
138 "testrunner.cc",
139 ],
Alex Deymo831dc452017-09-07 21:09:58 +0200140 static_libs: [
141 "libbsdiff",
142 "libbspatch",
143 "libgmock",
144 "libdivsufsort64",
145 "libdivsufsort",
146 "libbz",
Tianjie Xu1c26e2e2017-10-26 17:19:41 -0700147 "libbrotli",
Alex Deymo831dc452017-09-07 21:09:58 +0200148 ],
Alex Deymofb3b6322017-09-27 14:28:54 +0200149 target: {
150 android: {
151 cflags: ["-DBSDIFF_TARGET_UNITTEST"],
152 },
153 },
Alex Deymo831dc452017-09-07 21:09:58 +0200154}