• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// 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", "libbrotli"],
19    // Allow internal includes to be referenced with the "bsdiff/" prefix in the
20    // path.
21    include_dirs: ["external"],
22    export_include_dirs: ["include"],
23    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    recovery_available: true,
37
38    srcs: [
39        "brotli_decompressor.cc",
40        "bspatch.cc",
41        "bz2_decompressor.cc",
42        "buffer_file.cc",
43        "decompressor_interface.cc",
44        "extents.cc",
45        "extents_file.cc",
46        "file.cc",
47        "logging.cc",
48        "memory_file.cc",
49        "patch_reader.cc",
50        "sink_file.cc",
51        "utils.cc",
52    ],
53}
54
55cc_library_static {
56    name: "libbsdiff",
57    defaults: ["bsdiff_defaults"],
58
59    srcs: [
60        "brotli_compressor.cc",
61        "bsdiff.cc",
62        "bz2_compressor.cc",
63        "compressor_buffer.cc",
64        "diff_encoder.cc",
65        "endsley_patch_writer.cc",
66        "logging.cc",
67        "patch_writer.cc",
68        "patch_writer_factory.cc",
69        "split_patch_writer.cc",
70        "suffix_array_index.cc",
71    ],
72    static_libs: [
73        "libdivsufsort64",
74        "libdivsufsort",
75        "libbrotli",
76    ],
77}
78
79// Host executables: bsdiff and bspatch are only built for the host.
80cc_binary_host {
81    name: "bspatch",
82    defaults: ["bsdiff_defaults"],
83
84    srcs: ["bspatch_main.cc"],
85    static_libs: [
86        "libbspatch",
87        "libbz",
88        "libbrotli",
89    ],
90}
91
92cc_binary_host {
93    name: "bsdiff",
94    defaults: ["bsdiff_defaults"],
95
96    srcs: [
97        "bsdiff_arguments.cc",
98        "bsdiff_main.cc",
99    ],
100    static_libs: [
101        "libbsdiff",
102        "libdivsufsort64",
103        "libdivsufsort",
104        "libbz",
105        "libbrotli",
106    ],
107}
108
109// Unit tests.
110cc_test {
111    name: "bsdiff_unittest",
112    defaults: ["bsdiff_defaults"],
113    test_suites: ["device-tests"],
114    srcs: [
115        "brotli_compressor_unittest.cc",
116        "brotli_decompressor_unittest.cc",
117        "bsdiff_arguments.cc",
118        "bsdiff_arguments_unittest.cc",
119        "bsdiff_unittest.cc",
120        "bspatch_unittest.cc",
121        "bz2_decompressor_unittest.cc",
122        "diff_encoder_unittest.cc",
123        "endsley_patch_writer_unittest.cc",
124        "extents_file_unittest.cc",
125        "extents_unittest.cc",
126        "patch_reader_unittest.cc",
127        "patch_writer_unittest.cc",
128        "split_patch_writer_unittest.cc",
129        "suffix_array_index_unittest.cc",
130        "test_utils.cc",
131        "testrunner.cc",
132    ],
133    static_libs: [
134        "libbsdiff",
135        "libbspatch",
136        "libgmock",
137        "libdivsufsort64",
138        "libdivsufsort",
139        "libbz",
140        "libbrotli",
141    ],
142    target: {
143        android: {
144            cflags: ["-DBSDIFF_TARGET_UNITTEST"],
145        },
146    },
147}
148