Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 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 | |
| 15 | cc_defaults { |
| 16 | name: "bsdiff_defaults", |
| 17 | host_supported: true, |
Tianjie Xu | 1c26e2e | 2017-10-26 17:19:41 -0700 | [diff] [blame] | 18 | static_libs: ["libbz", "libbrotli"], |
Alex Deymo | dcd423b | 2017-09-13 20:54:24 +0200 | [diff] [blame] | 19 | // Allow internal includes to be referenced with the "bsdiff/" prefix in the |
| 20 | // path. |
| 21 | include_dirs: ["external"], |
Alex Deymo | cb620ca | 2017-10-30 11:51:38 +0100 | [diff] [blame] | 22 | export_include_dirs: ["include"], |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 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. |
| 33 | cc_library_static { |
| 34 | name: "libbspatch", |
| 35 | defaults: ["bsdiff_defaults"], |
Dan Willemsen | 141f70a | 2018-10-23 13:44:38 -0700 | [diff] [blame] | 36 | recovery_available: true, |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 37 | |
| 38 | srcs: [ |
Tianjie Xu | 4d10c3e | 2017-10-26 14:02:06 -0700 | [diff] [blame] | 39 | "brotli_decompressor.cc", |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 40 | "bspatch.cc", |
Tianjie Xu | 6528812 | 2017-10-13 15:10:58 -0700 | [diff] [blame] | 41 | "bz2_decompressor.cc", |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 42 | "buffer_file.cc", |
Tianjie Xu | 4d10c3e | 2017-10-26 14:02:06 -0700 | [diff] [blame] | 43 | "decompressor_interface.cc", |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 44 | "extents.cc", |
| 45 | "extents_file.cc", |
| 46 | "file.cc", |
Tianjie Xu | 18480eb | 2017-11-29 16:21:43 -0800 | [diff] [blame] | 47 | "logging.cc", |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 48 | "memory_file.cc", |
Tianjie Xu | 6528812 | 2017-10-13 15:10:58 -0700 | [diff] [blame] | 49 | "patch_reader.cc", |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 50 | "sink_file.cc", |
Tianjie Xu | 6528812 | 2017-10-13 15:10:58 -0700 | [diff] [blame] | 51 | "utils.cc", |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 52 | ], |
| 53 | } |
| 54 | |
| 55 | cc_library_static { |
| 56 | name: "libbsdiff", |
| 57 | defaults: ["bsdiff_defaults"], |
| 58 | |
Alex Deymo | a28e019 | 2017-09-08 14:21:05 +0200 | [diff] [blame] | 59 | srcs: [ |
Tianjie Xu | 1c26e2e | 2017-10-26 17:19:41 -0700 | [diff] [blame] | 60 | "brotli_compressor.cc", |
Alex Deymo | a28e019 | 2017-09-08 14:21:05 +0200 | [diff] [blame] | 61 | "bsdiff.cc", |
| 62 | "bz2_compressor.cc", |
Tianjie Xu | 1c26e2e | 2017-10-26 17:19:41 -0700 | [diff] [blame] | 63 | "compressor_buffer.cc", |
Alex Deymo | 68c0e7f | 2017-10-02 20:38:12 +0200 | [diff] [blame] | 64 | "diff_encoder.cc", |
Alex Deymo | 710b3da | 2017-10-26 13:13:28 +0200 | [diff] [blame] | 65 | "endsley_patch_writer.cc", |
Tianjie Xu | 18480eb | 2017-11-29 16:21:43 -0800 | [diff] [blame] | 66 | "logging.cc", |
Alex Deymo | a28e019 | 2017-09-08 14:21:05 +0200 | [diff] [blame] | 67 | "patch_writer.cc", |
Alex Deymo | 8a179e5 | 2017-10-26 17:10:20 +0200 | [diff] [blame] | 68 | "patch_writer_factory.cc", |
Alex Deymo | e1140a2 | 2017-10-02 21:01:15 +0200 | [diff] [blame] | 69 | "split_patch_writer.cc", |
Alex Deymo | 48ad5ab | 2017-09-13 22:17:57 +0200 | [diff] [blame] | 70 | "suffix_array_index.cc", |
Alex Deymo | a28e019 | 2017-09-08 14:21:05 +0200 | [diff] [blame] | 71 | ], |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 72 | static_libs: [ |
| 73 | "libdivsufsort64", |
| 74 | "libdivsufsort", |
Tianjie Xu | 1c26e2e | 2017-10-26 17:19:41 -0700 | [diff] [blame] | 75 | "libbrotli", |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 76 | ], |
| 77 | } |
| 78 | |
Tao Bao | 1c1bce9 | 2019-01-10 11:28:53 -0800 | [diff] [blame] | 79 | // Host executables: bsdiff and bspatch are only built for the host. |
| 80 | cc_binary_host { |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 81 | name: "bspatch", |
| 82 | defaults: ["bsdiff_defaults"], |
| 83 | |
| 84 | srcs: ["bspatch_main.cc"], |
| 85 | static_libs: [ |
| 86 | "libbspatch", |
| 87 | "libbz", |
Tianjie Xu | 1c26e2e | 2017-10-26 17:19:41 -0700 | [diff] [blame] | 88 | "libbrotli", |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 89 | ], |
| 90 | } |
| 91 | |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 92 | cc_binary_host { |
| 93 | name: "bsdiff", |
| 94 | defaults: ["bsdiff_defaults"], |
| 95 | |
Tianjie Xu | 1f1cdb2 | 2017-11-20 11:05:55 -0800 | [diff] [blame] | 96 | srcs: [ |
| 97 | "bsdiff_arguments.cc", |
| 98 | "bsdiff_main.cc", |
| 99 | ], |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 100 | static_libs: [ |
| 101 | "libbsdiff", |
| 102 | "libdivsufsort64", |
| 103 | "libdivsufsort", |
| 104 | "libbz", |
Tianjie Xu | 1c26e2e | 2017-10-26 17:19:41 -0700 | [diff] [blame] | 105 | "libbrotli", |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 106 | ], |
| 107 | } |
| 108 | |
| 109 | // Unit tests. |
| 110 | cc_test { |
| 111 | name: "bsdiff_unittest", |
| 112 | defaults: ["bsdiff_defaults"], |
| 113 | test_suites: ["device-tests"], |
| 114 | srcs: [ |
Tianjie Xu | 1c26e2e | 2017-10-26 17:19:41 -0700 | [diff] [blame] | 115 | "brotli_compressor_unittest.cc", |
Alex Deymo | 338f340 | 2018-03-23 13:40:17 +0100 | [diff] [blame] | 116 | "brotli_decompressor_unittest.cc", |
Tianjie Xu | 1f1cdb2 | 2017-11-20 11:05:55 -0800 | [diff] [blame] | 117 | "bsdiff_arguments.cc", |
| 118 | "bsdiff_arguments_unittest.cc", |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 119 | "bsdiff_unittest.cc", |
| 120 | "bspatch_unittest.cc", |
Alex Deymo | 64d5cd8 | 2018-03-12 20:00:04 +0100 | [diff] [blame] | 121 | "bz2_decompressor_unittest.cc", |
Alex Deymo | 68c0e7f | 2017-10-02 20:38:12 +0200 | [diff] [blame] | 122 | "diff_encoder_unittest.cc", |
Alex Deymo | 710b3da | 2017-10-26 13:13:28 +0200 | [diff] [blame] | 123 | "endsley_patch_writer_unittest.cc", |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 124 | "extents_file_unittest.cc", |
| 125 | "extents_unittest.cc", |
Tianjie Xu | 6528812 | 2017-10-13 15:10:58 -0700 | [diff] [blame] | 126 | "patch_reader_unittest.cc", |
Alex Deymo | fb3b632 | 2017-09-27 14:28:54 +0200 | [diff] [blame] | 127 | "patch_writer_unittest.cc", |
Alex Deymo | e1140a2 | 2017-10-02 21:01:15 +0200 | [diff] [blame] | 128 | "split_patch_writer_unittest.cc", |
Alex Deymo | 48ad5ab | 2017-09-13 22:17:57 +0200 | [diff] [blame] | 129 | "suffix_array_index_unittest.cc", |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 130 | "test_utils.cc", |
| 131 | "testrunner.cc", |
| 132 | ], |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 133 | static_libs: [ |
| 134 | "libbsdiff", |
| 135 | "libbspatch", |
| 136 | "libgmock", |
| 137 | "libdivsufsort64", |
| 138 | "libdivsufsort", |
| 139 | "libbz", |
Tianjie Xu | 1c26e2e | 2017-10-26 17:19:41 -0700 | [diff] [blame] | 140 | "libbrotli", |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 141 | ], |
Alex Deymo | fb3b632 | 2017-09-27 14:28:54 +0200 | [diff] [blame] | 142 | target: { |
| 143 | android: { |
| 144 | cflags: ["-DBSDIFF_TARGET_UNITTEST"], |
| 145 | }, |
| 146 | }, |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 147 | } |