blob: 3d042d836690a698fd2bd1dbc2444d30d9c7b2c8 [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",
44 "buffer_file.cc",
45 "extents.cc",
46 "extents_file.cc",
47 "file.cc",
48 "memory_file.cc",
49 "sink_file.cc",
50 ],
51}
52
53cc_library_static {
54 name: "libbsdiff",
55 defaults: ["bsdiff_defaults"],
56
Alex Deymoa28e0192017-09-08 14:21:05 +020057 srcs: [
58 "bsdiff.cc",
59 "bz2_compressor.cc",
Alex Deymo68c0e7f2017-10-02 20:38:12 +020060 "diff_encoder.cc",
Alex Deymoa28e0192017-09-08 14:21:05 +020061 "patch_writer.cc",
Alex Deymoe1140a22017-10-02 21:01:15 +020062 "split_patch_writer.cc",
Alex Deymo48ad5ab2017-09-13 22:17:57 +020063 "suffix_array_index.cc",
Alex Deymoa28e0192017-09-08 14:21:05 +020064 ],
Alex Deymo831dc452017-09-07 21:09:58 +020065 static_libs: [
66 "libdivsufsort64",
67 "libdivsufsort",
68 ],
69}
70
71// Host and target Executables.
72cc_binary {
73 name: "bspatch",
74 defaults: ["bsdiff_defaults"],
75
76 srcs: ["bspatch_main.cc"],
77 static_libs: [
78 "libbspatch",
79 "libbz",
80 ],
81}
82
83// Host executables, bsdiff is only built for the host.
84cc_binary_host {
85 name: "bsdiff",
86 defaults: ["bsdiff_defaults"],
87
88 srcs: ["bsdiff_main.cc"],
89 static_libs: [
90 "libbsdiff",
91 "libdivsufsort64",
92 "libdivsufsort",
93 "libbz",
94 ],
95}
96
97// Unit tests.
98cc_test {
99 name: "bsdiff_unittest",
100 defaults: ["bsdiff_defaults"],
101 test_suites: ["device-tests"],
102 srcs: [
103 "bsdiff_unittest.cc",
104 "bspatch_unittest.cc",
Alex Deymo68c0e7f2017-10-02 20:38:12 +0200105 "diff_encoder_unittest.cc",
Alex Deymo831dc452017-09-07 21:09:58 +0200106 "extents_file_unittest.cc",
107 "extents_unittest.cc",
Alex Deymofb3b6322017-09-27 14:28:54 +0200108 "patch_writer_unittest.cc",
Alex Deymoe1140a22017-10-02 21:01:15 +0200109 "split_patch_writer_unittest.cc",
Alex Deymo48ad5ab2017-09-13 22:17:57 +0200110 "suffix_array_index_unittest.cc",
Alex Deymo831dc452017-09-07 21:09:58 +0200111 "test_utils.cc",
112 "testrunner.cc",
113 ],
Alex Deymo831dc452017-09-07 21:09:58 +0200114 static_libs: [
115 "libbsdiff",
116 "libbspatch",
117 "libgmock",
118 "libdivsufsort64",
119 "libdivsufsort",
120 "libbz",
121 ],
Alex Deymofb3b6322017-09-27 14:28:54 +0200122 target: {
123 android: {
124 cflags: ["-DBSDIFF_TARGET_UNITTEST"],
125 },
126 },
Alex Deymo831dc452017-09-07 21:09:58 +0200127}