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, |
| 18 | static_libs: ["libbz"], |
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 | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 22 | 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. |
| 38 | cc_library_static { |
| 39 | name: "libbspatch", |
| 40 | defaults: ["bsdiff_defaults"], |
| 41 | |
| 42 | srcs: [ |
| 43 | "bspatch.cc", |
Tianjie Xu | 6528812 | 2017-10-13 15:10:58 -0700 | [diff] [blame] | 44 | "bz2_decompressor.cc", |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 45 | "buffer_file.cc", |
| 46 | "extents.cc", |
| 47 | "extents_file.cc", |
| 48 | "file.cc", |
| 49 | "memory_file.cc", |
Tianjie Xu | 6528812 | 2017-10-13 15:10:58 -0700 | [diff] [blame] | 50 | "patch_reader.cc", |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 51 | "sink_file.cc", |
Tianjie Xu | 6528812 | 2017-10-13 15:10:58 -0700 | [diff] [blame] | 52 | "utils.cc", |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 53 | ], |
| 54 | } |
| 55 | |
| 56 | cc_library_static { |
| 57 | name: "libbsdiff", |
| 58 | defaults: ["bsdiff_defaults"], |
| 59 | |
Alex Deymo | a28e019 | 2017-09-08 14:21:05 +0200 | [diff] [blame] | 60 | srcs: [ |
| 61 | "bsdiff.cc", |
| 62 | "bz2_compressor.cc", |
Alex Deymo | 68c0e7f | 2017-10-02 20:38:12 +0200 | [diff] [blame] | 63 | "diff_encoder.cc", |
Alex Deymo | a28e019 | 2017-09-08 14:21:05 +0200 | [diff] [blame] | 64 | "patch_writer.cc", |
Alex Deymo | e1140a2 | 2017-10-02 21:01:15 +0200 | [diff] [blame] | 65 | "split_patch_writer.cc", |
Alex Deymo | 48ad5ab | 2017-09-13 22:17:57 +0200 | [diff] [blame] | 66 | "suffix_array_index.cc", |
Alex Deymo | a28e019 | 2017-09-08 14:21:05 +0200 | [diff] [blame] | 67 | ], |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 68 | static_libs: [ |
| 69 | "libdivsufsort64", |
| 70 | "libdivsufsort", |
| 71 | ], |
| 72 | } |
| 73 | |
| 74 | // Host and target Executables. |
| 75 | cc_binary { |
| 76 | name: "bspatch", |
| 77 | defaults: ["bsdiff_defaults"], |
| 78 | |
| 79 | srcs: ["bspatch_main.cc"], |
| 80 | static_libs: [ |
| 81 | "libbspatch", |
| 82 | "libbz", |
| 83 | ], |
| 84 | } |
| 85 | |
| 86 | // Host executables, bsdiff is only built for the host. |
| 87 | cc_binary_host { |
| 88 | name: "bsdiff", |
| 89 | defaults: ["bsdiff_defaults"], |
| 90 | |
| 91 | srcs: ["bsdiff_main.cc"], |
| 92 | static_libs: [ |
| 93 | "libbsdiff", |
| 94 | "libdivsufsort64", |
| 95 | "libdivsufsort", |
| 96 | "libbz", |
| 97 | ], |
| 98 | } |
| 99 | |
| 100 | // Unit tests. |
| 101 | cc_test { |
| 102 | name: "bsdiff_unittest", |
| 103 | defaults: ["bsdiff_defaults"], |
| 104 | test_suites: ["device-tests"], |
| 105 | srcs: [ |
| 106 | "bsdiff_unittest.cc", |
| 107 | "bspatch_unittest.cc", |
Alex Deymo | 68c0e7f | 2017-10-02 20:38:12 +0200 | [diff] [blame] | 108 | "diff_encoder_unittest.cc", |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 109 | "extents_file_unittest.cc", |
| 110 | "extents_unittest.cc", |
Tianjie Xu | 6528812 | 2017-10-13 15:10:58 -0700 | [diff] [blame] | 111 | "patch_reader_unittest.cc", |
Alex Deymo | fb3b632 | 2017-09-27 14:28:54 +0200 | [diff] [blame] | 112 | "patch_writer_unittest.cc", |
Alex Deymo | e1140a2 | 2017-10-02 21:01:15 +0200 | [diff] [blame] | 113 | "split_patch_writer_unittest.cc", |
Alex Deymo | 48ad5ab | 2017-09-13 22:17:57 +0200 | [diff] [blame] | 114 | "suffix_array_index_unittest.cc", |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 115 | "test_utils.cc", |
| 116 | "testrunner.cc", |
| 117 | ], |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 118 | static_libs: [ |
| 119 | "libbsdiff", |
| 120 | "libbspatch", |
| 121 | "libgmock", |
| 122 | "libdivsufsort64", |
| 123 | "libdivsufsort", |
| 124 | "libbz", |
| 125 | ], |
Alex Deymo | fb3b632 | 2017-09-27 14:28:54 +0200 | [diff] [blame] | 126 | target: { |
| 127 | android: { |
| 128 | cflags: ["-DBSDIFF_TARGET_UNITTEST"], |
| 129 | }, |
| 130 | }, |
Alex Deymo | 831dc45 | 2017-09-07 21:09:58 +0200 | [diff] [blame] | 131 | } |