Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 1 | // Copyright (C) 2010 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 | // libandroidfw is partially built for the host (used by obbtool, aapt, and others) |
| 16 | |
Adam Lesinski | 873ef0e | 2017-10-11 16:50:37 -0700 | [diff] [blame] | 17 | cc_defaults { |
| 18 | name: "libandroidfw_defaults", |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 19 | cflags: [ |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 20 | "-Werror", |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 21 | "-Wunreachable-code", |
| 22 | ], |
Adam Lesinski | 873ef0e | 2017-10-11 16:50:37 -0700 | [diff] [blame] | 23 | target: { |
| 24 | windows: { |
| 25 | // The Windows compiler warns incorrectly for value initialization with {}. |
| 26 | cppflags: ["-Wno-missing-field-initializers"], |
| 27 | }, |
| 28 | host: { |
| 29 | cflags: ["-DSTATIC_ANDROIDFW_FOR_TOOLS"], |
| 30 | }, |
| 31 | }, |
| 32 | } |
| 33 | |
| 34 | cc_library { |
| 35 | name: "libandroidfw", |
| 36 | defaults: ["libandroidfw_defaults"], |
| 37 | host_supported: true, |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 38 | srcs: [ |
Adam Lesinski | 7ad1110 | 2016-10-28 16:39:15 -0700 | [diff] [blame] | 39 | "ApkAssets.cpp", |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 40 | "Asset.cpp", |
| 41 | "AssetDir.cpp", |
| 42 | "AssetManager.cpp", |
Adam Lesinski | 7ad1110 | 2016-10-28 16:39:15 -0700 | [diff] [blame] | 43 | "AssetManager2.cpp", |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 44 | "AttributeResolution.cpp", |
Adam Lesinski | 7ad1110 | 2016-10-28 16:39:15 -0700 | [diff] [blame] | 45 | "ChunkIterator.cpp", |
Adam Lesinski | 970bd8d | 2017-09-25 13:21:55 -0700 | [diff] [blame] | 46 | "Idmap.cpp", |
Adam Lesinski | 7ad1110 | 2016-10-28 16:39:15 -0700 | [diff] [blame] | 47 | "LoadedArsc.cpp", |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 48 | "LocaleData.cpp", |
| 49 | "misc.cpp", |
| 50 | "ObbFile.cpp", |
| 51 | "ResourceTypes.cpp", |
Adam Lesinski | 929d651 | 2017-01-16 19:11:19 -0800 | [diff] [blame] | 52 | "ResourceUtils.cpp", |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 53 | "StreamingZipInflater.cpp", |
| 54 | "TypeWrappers.cpp", |
Adam Lesinski | da431a2 | 2016-12-29 16:08:16 -0500 | [diff] [blame] | 55 | "Util.cpp", |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 56 | "ZipFileRO.cpp", |
| 57 | "ZipUtils.cpp", |
| 58 | ], |
| 59 | export_include_dirs: ["include"], |
| 60 | target: { |
| 61 | android: { |
| 62 | srcs: [ |
| 63 | "BackupData.cpp", |
| 64 | "BackupHelpers.cpp", |
| 65 | "CursorWindow.cpp", |
| 66 | "DisplayEventDispatcher.cpp", |
| 67 | ], |
| 68 | shared_libs: [ |
| 69 | "libziparchive", |
| 70 | "libbase", |
| 71 | "libbinder", |
| 72 | "liblog", |
| 73 | "libcutils", |
| 74 | "libgui", |
| 75 | "libutils", |
| 76 | "libz", |
| 77 | ], |
| 78 | static: { |
| 79 | enabled: false, |
| 80 | }, |
| 81 | }, |
| 82 | host: { |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 83 | shared: { |
| 84 | enabled: false, |
| 85 | }, |
Adam Lesinski | 7ad1110 | 2016-10-28 16:39:15 -0700 | [diff] [blame] | 86 | static_libs: [ |
| 87 | "libziparchive", |
| 88 | "libbase", |
| 89 | "liblog", |
| 90 | "libcutils", |
| 91 | "libutils", |
| 92 | ], |
| 93 | shared_libs: [ |
Dan Willemsen | a2902e3 | 2017-09-27 16:20:31 -0700 | [diff] [blame] | 94 | "libz", |
Adam Lesinski | 7ad1110 | 2016-10-28 16:39:15 -0700 | [diff] [blame] | 95 | ], |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 96 | }, |
| 97 | windows: { |
| 98 | enabled: true, |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 99 | }, |
| 100 | }, |
Ivan Lozano | 0282874 | 2017-11-07 13:26:27 -0800 | [diff] [blame^] | 101 | sanitize: { |
| 102 | blacklist: "libandroidfw_blacklist.txt", |
| 103 | }, |
Colin Cross | 4f8d9e6 | 2016-12-01 15:55:00 -0800 | [diff] [blame] | 104 | } |
Adam Lesinski | 873ef0e | 2017-10-11 16:50:37 -0700 | [diff] [blame] | 105 | |
| 106 | common_test_libs = [ |
| 107 | "libandroidfw", |
| 108 | "libbase", |
| 109 | "libcutils", |
| 110 | "libutils", |
| 111 | "libziparchive", |
| 112 | ] |
| 113 | |
| 114 | cc_test { |
| 115 | name: "libandroidfw_tests", |
| 116 | host_supported: true, |
| 117 | defaults: ["libandroidfw_defaults"], |
| 118 | cppflags: [ |
| 119 | // This is to suppress warnings/errors from gtest |
| 120 | "-Wno-unnamed-type-template-args", |
| 121 | ], |
| 122 | srcs: [ |
| 123 | // Helpers/infra for testing. |
| 124 | "tests/CommonHelpers.cpp", |
| 125 | "tests/TestHelpers.cpp", |
| 126 | "tests/TestMain.cpp", |
| 127 | |
| 128 | // Actual tests. |
| 129 | "tests/ApkAssets_test.cpp", |
| 130 | "tests/AppAsLib_test.cpp", |
| 131 | "tests/Asset_test.cpp", |
| 132 | "tests/AssetManager2_test.cpp", |
| 133 | "tests/AttributeFinder_test.cpp", |
| 134 | "tests/AttributeResolution_test.cpp", |
| 135 | "tests/ByteBucketArray_test.cpp", |
| 136 | "tests/Config_test.cpp", |
| 137 | "tests/ConfigLocale_test.cpp", |
| 138 | "tests/Idmap_test.cpp", |
| 139 | "tests/LoadedArsc_test.cpp", |
| 140 | "tests/ResourceUtils_test.cpp", |
| 141 | "tests/ResTable_test.cpp", |
| 142 | "tests/Split_test.cpp", |
| 143 | "tests/StringPiece_test.cpp", |
| 144 | "tests/Theme_test.cpp", |
| 145 | "tests/TypeWrappers_test.cpp", |
| 146 | "tests/ZipUtils_test.cpp", |
| 147 | ], |
| 148 | target: { |
| 149 | android: { |
| 150 | srcs: [ |
| 151 | "tests/BackupData_test.cpp", |
| 152 | "tests/ObbFile_test.cpp", |
| 153 | ], |
| 154 | shared_libs: common_test_libs + ["libui"], |
| 155 | }, |
| 156 | host: { |
| 157 | static_libs: common_test_libs + ["liblog", "libz"], |
| 158 | }, |
| 159 | }, |
| 160 | data: ["tests/data/**/*.apk"], |
| 161 | } |
| 162 | |
| 163 | cc_benchmark { |
| 164 | name: "libandroidfw_benchmarks", |
| 165 | defaults: ["libandroidfw_defaults"], |
| 166 | srcs: [ |
| 167 | // Helpers/infra for benchmarking. |
| 168 | "tests/BenchMain.cpp", |
| 169 | "tests/BenchmarkHelpers.cpp", |
| 170 | "tests/CommonHelpers.cpp", |
| 171 | |
| 172 | // Actual benchmarks. |
| 173 | "tests/AssetManager2_bench.cpp", |
| 174 | "tests/SparseEntry_bench.cpp", |
| 175 | "tests/Theme_bench.cpp", |
| 176 | ], |
| 177 | shared_libs: common_test_libs, |
| 178 | data: ["tests/data/**/*.apk"], |
| 179 | } |
| 180 | |