blob: 4566caaa831b8e0e0d1ae5ac7966a1bcdf209811 [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: [
38 "bspatch.cc",
Tianjie Xu65288122017-10-13 15:10:58 -070039 "bz2_decompressor.cc",
Alex Deymo831dc452017-09-07 21:09:58 +020040 "buffer_file.cc",
41 "extents.cc",
42 "extents_file.cc",
43 "file.cc",
44 "memory_file.cc",
Tianjie Xu65288122017-10-13 15:10:58 -070045 "patch_reader.cc",
Alex Deymo831dc452017-09-07 21:09:58 +020046 "sink_file.cc",
Tianjie Xu65288122017-10-13 15:10:58 -070047 "utils.cc",
Alex Deymo831dc452017-09-07 21:09:58 +020048 ],
49}
50
51cc_library_static {
52 name: "libbsdiff",
53 defaults: ["bsdiff_defaults"],
54
Alex Deymoa28e0192017-09-08 14:21:05 +020055 srcs: [
Tianjie Xu1c26e2e2017-10-26 17:19:41 -070056 "brotli_compressor.cc",
Alex Deymoa28e0192017-09-08 14:21:05 +020057 "bsdiff.cc",
58 "bz2_compressor.cc",
Tianjie Xu1c26e2e2017-10-26 17:19:41 -070059 "compressor_buffer.cc",
60 "compressor_interface.cc",
Alex Deymo68c0e7f2017-10-02 20:38:12 +020061 "diff_encoder.cc",
Alex Deymoa28e0192017-09-08 14:21:05 +020062 "patch_writer.cc",
Alex Deymo8a179e52017-10-26 17:10:20 +020063 "patch_writer_factory.cc",
Alex Deymoe1140a22017-10-02 21:01:15 +020064 "split_patch_writer.cc",
Alex Deymo48ad5ab2017-09-13 22:17:57 +020065 "suffix_array_index.cc",
Alex Deymoa28e0192017-09-08 14:21:05 +020066 ],
Alex Deymo831dc452017-09-07 21:09:58 +020067 static_libs: [
68 "libdivsufsort64",
69 "libdivsufsort",
Tianjie Xu1c26e2e2017-10-26 17:19:41 -070070 "libbrotli",
Alex Deymo831dc452017-09-07 21:09:58 +020071 ],
72}
73
74// Host and target Executables.
75cc_binary {
76 name: "bspatch",
77 defaults: ["bsdiff_defaults"],
78
79 srcs: ["bspatch_main.cc"],
80 static_libs: [
81 "libbspatch",
82 "libbz",
Tianjie Xu1c26e2e2017-10-26 17:19:41 -070083 "libbrotli",
Alex Deymo831dc452017-09-07 21:09:58 +020084 ],
85}
86
87// Host executables, bsdiff is only built for the host.
88cc_binary_host {
89 name: "bsdiff",
90 defaults: ["bsdiff_defaults"],
91
92 srcs: ["bsdiff_main.cc"],
93 static_libs: [
94 "libbsdiff",
95 "libdivsufsort64",
96 "libdivsufsort",
97 "libbz",
Tianjie Xu1c26e2e2017-10-26 17:19:41 -070098 "libbrotli",
Alex Deymo831dc452017-09-07 21:09:58 +020099 ],
100}
101
102// Unit tests.
103cc_test {
104 name: "bsdiff_unittest",
105 defaults: ["bsdiff_defaults"],
106 test_suites: ["device-tests"],
107 srcs: [
Tianjie Xu1c26e2e2017-10-26 17:19:41 -0700108 "brotli_compressor_unittest.cc",
Alex Deymo831dc452017-09-07 21:09:58 +0200109 "bsdiff_unittest.cc",
110 "bspatch_unittest.cc",
Alex Deymo68c0e7f2017-10-02 20:38:12 +0200111 "diff_encoder_unittest.cc",
Alex Deymo831dc452017-09-07 21:09:58 +0200112 "extents_file_unittest.cc",
113 "extents_unittest.cc",
Tianjie Xu65288122017-10-13 15:10:58 -0700114 "patch_reader_unittest.cc",
Alex Deymofb3b6322017-09-27 14:28:54 +0200115 "patch_writer_unittest.cc",
Alex Deymoe1140a22017-10-02 21:01:15 +0200116 "split_patch_writer_unittest.cc",
Alex Deymo48ad5ab2017-09-13 22:17:57 +0200117 "suffix_array_index_unittest.cc",
Alex Deymo831dc452017-09-07 21:09:58 +0200118 "test_utils.cc",
119 "testrunner.cc",
120 ],
Alex Deymo831dc452017-09-07 21:09:58 +0200121 static_libs: [
122 "libbsdiff",
123 "libbspatch",
124 "libgmock",
125 "libdivsufsort64",
126 "libdivsufsort",
127 "libbz",
Tianjie Xu1c26e2e2017-10-26 17:19:41 -0700128 "libbrotli",
Alex Deymo831dc452017-09-07 21:09:58 +0200129 ],
Alex Deymofb3b6322017-09-27 14:28:54 +0200130 target: {
131 android: {
132 cflags: ["-DBSDIFF_TARGET_UNITTEST"],
133 },
134 },
Alex Deymo831dc452017-09-07 21:09:58 +0200135}