blob: b546134408c6e1f7df0c78f40b1aca3473db701e [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,
18 static_libs: ["libbz"],
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 Deymo831dc452017-09-07 21:09:58 +020022 export_include_dirs: [
23 "include",
24 // TODO(deymo): Remove include/bsdiff when all callers use the "bsdiff/"
25 // prefix when including code.
26 "include/bsdiff",
27 ],
28 cflags: [
29 "-D_FILE_OFFSET_BITS=64",
30 "-Wall",
31 "-Werror",
32 "-Wextra",
33 "-Wno-unused-parameter",
34 ],
35}
36
37// Host and target static libraries.
38cc_library_static {
39 name: "libbspatch",
40 defaults: ["bsdiff_defaults"],
41
42 srcs: [
43 "bspatch.cc",
Tianjie Xu65288122017-10-13 15:10:58 -070044 "bz2_decompressor.cc",
Alex Deymo831dc452017-09-07 21:09:58 +020045 "buffer_file.cc",
46 "extents.cc",
47 "extents_file.cc",
48 "file.cc",
49 "memory_file.cc",
Tianjie Xu65288122017-10-13 15:10:58 -070050 "patch_reader.cc",
Alex Deymo831dc452017-09-07 21:09:58 +020051 "sink_file.cc",
Tianjie Xu65288122017-10-13 15:10:58 -070052 "utils.cc",
Alex Deymo831dc452017-09-07 21:09:58 +020053 ],
54}
55
56cc_library_static {
57 name: "libbsdiff",
58 defaults: ["bsdiff_defaults"],
59
Alex Deymoa28e0192017-09-08 14:21:05 +020060 srcs: [
61 "bsdiff.cc",
62 "bz2_compressor.cc",
Alex Deymo68c0e7f2017-10-02 20:38:12 +020063 "diff_encoder.cc",
Alex Deymoa28e0192017-09-08 14:21:05 +020064 "patch_writer.cc",
Alex Deymo8a179e52017-10-26 17:10:20 +020065 "patch_writer_factory.cc",
Alex Deymoe1140a22017-10-02 21:01:15 +020066 "split_patch_writer.cc",
Alex Deymo48ad5ab2017-09-13 22:17:57 +020067 "suffix_array_index.cc",
Alex Deymoa28e0192017-09-08 14:21:05 +020068 ],
Alex Deymo831dc452017-09-07 21:09:58 +020069 static_libs: [
70 "libdivsufsort64",
71 "libdivsufsort",
72 ],
73}
74
75// Host and target Executables.
76cc_binary {
77 name: "bspatch",
78 defaults: ["bsdiff_defaults"],
79
80 srcs: ["bspatch_main.cc"],
81 static_libs: [
82 "libbspatch",
83 "libbz",
84 ],
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",
98 ],
99}
100
101// Unit tests.
102cc_test {
103 name: "bsdiff_unittest",
104 defaults: ["bsdiff_defaults"],
105 test_suites: ["device-tests"],
106 srcs: [
107 "bsdiff_unittest.cc",
108 "bspatch_unittest.cc",
Alex Deymo68c0e7f2017-10-02 20:38:12 +0200109 "diff_encoder_unittest.cc",
Alex Deymo831dc452017-09-07 21:09:58 +0200110 "extents_file_unittest.cc",
111 "extents_unittest.cc",
Tianjie Xu65288122017-10-13 15:10:58 -0700112 "patch_reader_unittest.cc",
Alex Deymofb3b6322017-09-27 14:28:54 +0200113 "patch_writer_unittest.cc",
Alex Deymoe1140a22017-10-02 21:01:15 +0200114 "split_patch_writer_unittest.cc",
Alex Deymo48ad5ab2017-09-13 22:17:57 +0200115 "suffix_array_index_unittest.cc",
Alex Deymo831dc452017-09-07 21:09:58 +0200116 "test_utils.cc",
117 "testrunner.cc",
118 ],
Alex Deymo831dc452017-09-07 21:09:58 +0200119 static_libs: [
120 "libbsdiff",
121 "libbspatch",
122 "libgmock",
123 "libdivsufsort64",
124 "libdivsufsort",
125 "libbz",
126 ],
Alex Deymofb3b6322017-09-27 14:28:54 +0200127 target: {
128 android: {
129 cflags: ["-DBSDIFF_TARGET_UNITTEST"],
130 },
131 },
Alex Deymo831dc452017-09-07 21:09:58 +0200132}