blob: 0910688cbf2599d53217248135d6584a84a2ce77 [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"],
36
37 srcs: [
Tianjie Xu4d10c3e2017-10-26 14:02:06 -070038 "brotli_decompressor.cc",
Alex Deymo831dc452017-09-07 21:09:58 +020039 "bspatch.cc",
Tianjie Xu65288122017-10-13 15:10:58 -070040 "bz2_decompressor.cc",
Alex Deymo831dc452017-09-07 21:09:58 +020041 "buffer_file.cc",
Tianjie Xu4d10c3e2017-10-26 14:02:06 -070042 "decompressor_interface.cc",
Alex Deymo831dc452017-09-07 21:09:58 +020043 "extents.cc",
44 "extents_file.cc",
45 "file.cc",
46 "memory_file.cc",
Tianjie Xu65288122017-10-13 15:10:58 -070047 "patch_reader.cc",
Alex Deymo831dc452017-09-07 21:09:58 +020048 "sink_file.cc",
Tianjie Xu65288122017-10-13 15:10:58 -070049 "utils.cc",
Alex Deymo831dc452017-09-07 21:09:58 +020050 ],
51}
52
53cc_library_static {
54 name: "libbsdiff",
55 defaults: ["bsdiff_defaults"],
56
Alex Deymoa28e0192017-09-08 14:21:05 +020057 srcs: [
Tianjie Xu1c26e2e2017-10-26 17:19:41 -070058 "brotli_compressor.cc",
Alex Deymoa28e0192017-09-08 14:21:05 +020059 "bsdiff.cc",
60 "bz2_compressor.cc",
Tianjie Xu1c26e2e2017-10-26 17:19:41 -070061 "compressor_buffer.cc",
62 "compressor_interface.cc",
Alex Deymo68c0e7f2017-10-02 20:38:12 +020063 "diff_encoder.cc",
Alex Deymo710b3da2017-10-26 13:13:28 +020064 "endsley_patch_writer.cc",
Alex Deymoa28e0192017-09-08 14:21:05 +020065 "patch_writer.cc",
Alex Deymo8a179e52017-10-26 17:10:20 +020066 "patch_writer_factory.cc",
Alex Deymoe1140a22017-10-02 21:01:15 +020067 "split_patch_writer.cc",
Alex Deymo48ad5ab2017-09-13 22:17:57 +020068 "suffix_array_index.cc",
Alex Deymoa28e0192017-09-08 14:21:05 +020069 ],
Alex Deymo831dc452017-09-07 21:09:58 +020070 static_libs: [
71 "libdivsufsort64",
72 "libdivsufsort",
Tianjie Xu1c26e2e2017-10-26 17:19:41 -070073 "libbrotli",
Alex Deymo831dc452017-09-07 21:09:58 +020074 ],
75}
76
77// Host and target Executables.
78cc_binary {
79 name: "bspatch",
80 defaults: ["bsdiff_defaults"],
81
82 srcs: ["bspatch_main.cc"],
83 static_libs: [
84 "libbspatch",
85 "libbz",
Tianjie Xu1c26e2e2017-10-26 17:19:41 -070086 "libbrotli",
Alex Deymo831dc452017-09-07 21:09:58 +020087 ],
88}
89
90// Host executables, bsdiff is only built for the host.
91cc_binary_host {
92 name: "bsdiff",
93 defaults: ["bsdiff_defaults"],
94
95 srcs: ["bsdiff_main.cc"],
96 static_libs: [
97 "libbsdiff",
98 "libdivsufsort64",
99 "libdivsufsort",
100 "libbz",
Tianjie Xu1c26e2e2017-10-26 17:19:41 -0700101 "libbrotli",
Alex Deymo831dc452017-09-07 21:09:58 +0200102 ],
103}
104
105// Unit tests.
106cc_test {
107 name: "bsdiff_unittest",
108 defaults: ["bsdiff_defaults"],
109 test_suites: ["device-tests"],
110 srcs: [
Tianjie Xu1c26e2e2017-10-26 17:19:41 -0700111 "brotli_compressor_unittest.cc",
Alex Deymo831dc452017-09-07 21:09:58 +0200112 "bsdiff_unittest.cc",
113 "bspatch_unittest.cc",
Alex Deymo68c0e7f2017-10-02 20:38:12 +0200114 "diff_encoder_unittest.cc",
Alex Deymo710b3da2017-10-26 13:13:28 +0200115 "endsley_patch_writer_unittest.cc",
Alex Deymo831dc452017-09-07 21:09:58 +0200116 "extents_file_unittest.cc",
117 "extents_unittest.cc",
Tianjie Xu65288122017-10-13 15:10:58 -0700118 "patch_reader_unittest.cc",
Alex Deymofb3b6322017-09-27 14:28:54 +0200119 "patch_writer_unittest.cc",
Alex Deymoe1140a22017-10-02 21:01:15 +0200120 "split_patch_writer_unittest.cc",
Alex Deymo48ad5ab2017-09-13 22:17:57 +0200121 "suffix_array_index_unittest.cc",
Alex Deymo831dc452017-09-07 21:09:58 +0200122 "test_utils.cc",
123 "testrunner.cc",
124 ],
Alex Deymo831dc452017-09-07 21:09:58 +0200125 static_libs: [
126 "libbsdiff",
127 "libbspatch",
128 "libgmock",
129 "libdivsufsort64",
130 "libdivsufsort",
131 "libbz",
Tianjie Xu1c26e2e2017-10-26 17:19:41 -0700132 "libbrotli",
Alex Deymo831dc452017-09-07 21:09:58 +0200133 ],
Alex Deymofb3b6322017-09-27 14:28:54 +0200134 target: {
135 android: {
136 cflags: ["-DBSDIFF_TARGET_UNITTEST"],
137 },
138 },
Alex Deymo831dc452017-09-07 21:09:58 +0200139}