David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 1 | // |
| 2 | // Copyright (C) 2011 The Android Open Source Project |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | // |
| 16 | |
| 17 | cc_defaults { |
| 18 | name: "libdexfile_defaults", |
| 19 | defaults: ["art_defaults"], |
| 20 | host_supported: true, |
| 21 | srcs: [ |
David Sehr | 1f01016 | 2018-05-15 08:59:32 -0700 | [diff] [blame] | 22 | "dex/art_dex_file_loader.cc", |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 23 | "dex/compact_dex_file.cc", |
Mathieu Chartier | 5e3cfa2 | 2018-02-20 16:53:37 -0800 | [diff] [blame] | 24 | "dex/compact_offset_table.cc", |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 25 | "dex/descriptors_names.cc", |
| 26 | "dex/dex_file.cc", |
| 27 | "dex/dex_file_exception_helpers.cc", |
David Sehr | c431b9d | 2018-03-02 12:01:51 -0800 | [diff] [blame] | 28 | "dex/dex_file_layout.cc", |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 29 | "dex/dex_file_loader.cc", |
| 30 | "dex/dex_file_tracking_registrar.cc", |
| 31 | "dex/dex_file_verifier.cc", |
| 32 | "dex/dex_instruction.cc", |
| 33 | "dex/modifiers.cc", |
David Sehr | 67bf42e | 2018-02-26 16:43:04 -0800 | [diff] [blame] | 34 | "dex/primitive.cc", |
Andreas Gampe | ad1aa63 | 2019-01-02 10:30:54 -0800 | [diff] [blame] | 35 | "dex/signature.cc", |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 36 | "dex/standard_dex_file.cc", |
David Sehr | 9c4a015 | 2018-04-05 12:23:54 -0700 | [diff] [blame] | 37 | "dex/type_lookup_table.cc", |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 38 | "dex/utf.cc", |
| 39 | ], |
| 40 | |
| 41 | target: { |
| 42 | android: { |
Nicolas Geoffray | 65ed42a | 2018-10-30 12:33:04 +0000 | [diff] [blame] | 43 | static_libs: [ |
| 44 | "libziparchive", |
| 45 | "libz", |
| 46 | ], |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 47 | shared_libs: [ |
| 48 | // For MemMap. |
| 49 | "libartbase", |
Orion Hodson | 119733d | 2019-01-30 15:14:41 +0000 | [diff] [blame] | 50 | "libartpalette", |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 51 | "liblog", |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 52 | // For common macros. |
| 53 | "libbase", |
| 54 | ], |
| 55 | export_shared_lib_headers: [ |
| 56 | "libartbase", |
| 57 | "libbase", |
| 58 | ], |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 59 | }, |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 60 | not_windows: { |
Nicolas Geoffray | 65ed42a | 2018-10-30 12:33:04 +0000 | [diff] [blame] | 61 | shared_libs: [ |
| 62 | "libziparchive", |
| 63 | "libz", |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 64 | // For MemMap. |
| 65 | "libartbase", |
Orion Hodson | 119733d | 2019-01-30 15:14:41 +0000 | [diff] [blame] | 66 | "libartpalette", |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 67 | "liblog", |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 68 | // For common macros. |
| 69 | "libbase", |
Nicolas Geoffray | 65ed42a | 2018-10-30 12:33:04 +0000 | [diff] [blame] | 70 | ], |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 71 | export_shared_lib_headers: [ |
| 72 | "libartbase", |
| 73 | "libbase", |
| 74 | ], |
| 75 | }, |
| 76 | windows: { |
| 77 | static_libs: [ |
| 78 | "libziparchive", |
| 79 | "libz", |
| 80 | // For MemMap. |
| 81 | "libartbase", |
Orion Hodson | 119733d | 2019-01-30 15:14:41 +0000 | [diff] [blame] | 82 | "libartpalette", |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 83 | "liblog", |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 84 | // For common macros. |
| 85 | "libbase", |
| 86 | ], |
| 87 | export_static_lib_headers: [ |
| 88 | "libartbase", |
| 89 | "libbase", |
| 90 | ], |
| 91 | cflags: ["-Wno-thread-safety"], |
Nicolas Geoffray | 65ed42a | 2018-10-30 12:33:04 +0000 | [diff] [blame] | 92 | }, |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 93 | }, |
| 94 | generated_sources: ["dexfile_operator_srcs"], |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 95 | export_include_dirs: ["."], |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 96 | } |
| 97 | |
Andreas Gampe | ec5ed06 | 2018-01-26 16:20:02 -0800 | [diff] [blame] | 98 | cc_defaults { |
| 99 | name: "libdexfile_static_base_defaults", |
| 100 | static_libs: [ |
| 101 | "libbase", |
Andreas Gampe | ec5ed06 | 2018-01-26 16:20:02 -0800 | [diff] [blame] | 102 | "liblog", |
Nicolas Geoffray | 65ed42a | 2018-10-30 12:33:04 +0000 | [diff] [blame] | 103 | "libz", |
| 104 | "libziparchive", |
Andreas Gampe | ec5ed06 | 2018-01-26 16:20:02 -0800 | [diff] [blame] | 105 | ], |
| 106 | } |
| 107 | |
| 108 | cc_defaults { |
| 109 | name: "libdexfile_static_defaults", |
| 110 | defaults: [ |
| 111 | "libartbase_static_defaults", |
| 112 | "libdexfile_static_base_defaults", |
| 113 | ], |
| 114 | static_libs: ["libdexfile"], |
| 115 | } |
| 116 | |
| 117 | cc_defaults { |
| 118 | name: "libdexfiled_static_defaults", |
| 119 | defaults: [ |
| 120 | "libartbased_static_defaults", |
| 121 | "libdexfile_static_base_defaults", |
| 122 | ], |
| 123 | static_libs: ["libdexfiled"], |
| 124 | } |
| 125 | |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 126 | gensrcs { |
| 127 | name: "dexfile_operator_srcs", |
Alex Light | b69d2d3 | 2018-02-21 13:37:17 -0800 | [diff] [blame] | 128 | cmd: "$(location generate_operator_out) art/libdexfile $(in) > $(out)", |
| 129 | tools: ["generate_operator_out"], |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 130 | srcs: [ |
| 131 | "dex/dex_file.h", |
David Sehr | c431b9d | 2018-03-02 12:01:51 -0800 | [diff] [blame] | 132 | "dex/dex_file_layout.h", |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 133 | "dex/dex_instruction.h", |
| 134 | "dex/dex_instruction_utils.h", |
| 135 | "dex/invoke_type.h", |
David Sehr | 312f3b2 | 2018-03-19 08:39:26 -0700 | [diff] [blame] | 136 | "dex/method_reference.h", |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 137 | ], |
| 138 | output_extension: "operator_out.cc", |
| 139 | } |
| 140 | |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 141 | art_cc_library { |
| 142 | name: "libdexfile", |
| 143 | defaults: ["libdexfile_defaults"], |
| 144 | // Leave the symbols in the shared library so that stack unwinders can |
| 145 | // produce meaningful name resolution. |
| 146 | strip: { |
| 147 | keep_symbols: true, |
| 148 | }, |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 149 | target: { |
| 150 | windows: { |
| 151 | enabled: true, |
| 152 | shared: { |
| 153 | enabled: false, |
| 154 | }, |
| 155 | }, |
| 156 | }, |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 157 | } |
| 158 | |
David Sehr | fcbe15c | 2018-02-15 09:41:13 -0800 | [diff] [blame] | 159 | art_cc_library { |
| 160 | name: "libdexfiled", |
| 161 | defaults: [ |
| 162 | "art_debug_defaults", |
| 163 | "libdexfile_defaults", |
| 164 | ], |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 165 | target: { |
| 166 | windows: { |
| 167 | enabled: true, |
| 168 | shared: { |
| 169 | enabled: false, |
| 170 | }, |
| 171 | }, |
| 172 | }, |
David Sehr | fcbe15c | 2018-02-15 09:41:13 -0800 | [diff] [blame] | 173 | } |
| 174 | |
Martin Stjernholm | fdb2f60 | 2019-01-09 14:47:00 +0000 | [diff] [blame] | 175 | art_cc_test { |
| 176 | name: "art_libdexfile_tests", |
| 177 | defaults: [ |
| 178 | "art_gtest_defaults", |
| 179 | ], |
| 180 | srcs: [ |
| 181 | "dex/art_dex_file_loader_test.cc", |
| 182 | "dex/class_accessor_test.cc", |
| 183 | "dex/code_item_accessors_test.cc", |
| 184 | "dex/compact_dex_file_test.cc", |
| 185 | "dex/compact_offset_table_test.cc", |
| 186 | "dex/descriptors_names_test.cc", |
| 187 | "dex/test_dex_file_builder_test.cc", |
| 188 | "dex/dex_file_loader_test.cc", |
| 189 | "dex/dex_file_verifier_test.cc", |
| 190 | "dex/dex_instruction_test.cc", |
| 191 | "dex/primitive_test.cc", |
| 192 | "dex/string_reference_test.cc", |
| 193 | "dex/type_lookup_table_test.cc", |
| 194 | "dex/utf_test.cc", |
| 195 | ], |
| 196 | shared_libs: [ |
| 197 | "libbacktrace", |
| 198 | "libziparchive", |
| 199 | ], |
| 200 | include_dirs: [ |
| 201 | "external/zlib", |
| 202 | ], |
| 203 | } |
| 204 | |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 205 | cc_library_headers { |
| 206 | name: "libdexfile_external_headers", |
| 207 | host_supported: true, |
| 208 | header_libs: ["libbase_headers"], |
| 209 | export_header_lib_headers: ["libbase_headers"], |
| 210 | export_include_dirs: ["external/include"], |
| 211 | |
| 212 | target: { |
| 213 | windows: { |
| 214 | enabled: true, |
| 215 | }, |
| 216 | }, |
| 217 | } |
| 218 | |
| 219 | cc_library { |
| 220 | name: "libdexfile_external", |
| 221 | host_supported: true, |
| 222 | srcs: [ |
| 223 | "external/dex_file_ext.cc", |
| 224 | ], |
| 225 | header_libs: ["libdexfile_external_headers"], |
| 226 | shared_libs: [ |
| 227 | "libbase", |
| 228 | "libdexfile", |
| 229 | ], |
| 230 | |
Martin Stjernholm | 7e7ab23 | 2019-02-01 12:58:08 +0000 | [diff] [blame^] | 231 | // TODO(b/120670568): Enable this when linking bug is fixed. |
| 232 | // stubs: { |
| 233 | // symbol_file: "external/libdexfile_external.map.txt", |
| 234 | // versions: ["1"], |
| 235 | // }, |
| 236 | |
| 237 | // Hide symbols using version scripts for targets that support it, i.e. all |
| 238 | // but Darwin. |
| 239 | // TODO(b/120670568): Clean this up when stubs above is enabled. |
| 240 | target: { |
| 241 | android: { |
| 242 | version_script: "external/libdexfile_external.map.txt", |
| 243 | }, |
| 244 | linux_bionic: { |
| 245 | version_script: "external/libdexfile_external.map.txt", |
| 246 | }, |
| 247 | linux_glibc: { |
| 248 | version_script: "external/libdexfile_external.map.txt", |
| 249 | }, |
| 250 | windows: { |
| 251 | version_script: "external/libdexfile_external.map.txt", |
| 252 | }, |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 253 | }, |
| 254 | } |
| 255 | |
Martin Stjernholm | fdb2f60 | 2019-01-09 14:47:00 +0000 | [diff] [blame] | 256 | art_cc_test { |
| 257 | name: "art_libdexfile_external_tests", |
| 258 | host_supported: true, |
| 259 | test_per_src: true, // For consistency with other ART gtests. |
| 260 | srcs: [ |
| 261 | "external/dex_file_ext_c_test.c", |
| 262 | ], |
| 263 | header_libs: ["libdexfile_external_headers"], |
| 264 | } |
| 265 | |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 266 | // Support library with a C++ API for accessing the libdexfile API for external |
| 267 | // (non-ART) users. They should link to their own instance of this (either |
| 268 | // statically or through linker namespaces). |
| 269 | cc_library { |
| 270 | name: "libdexfile_support", |
| 271 | host_supported: true, |
| 272 | srcs: [ |
| 273 | "external/dex_file_supp.cc", |
| 274 | ], |
| 275 | header_libs: ["libdexfile_external_headers"], |
| 276 | shared_libs: ["libdexfile_external"], |
| 277 | export_header_lib_headers: ["libdexfile_external_headers"], |
| 278 | } |
Martin Stjernholm | 750bf04 | 2019-01-09 22:51:12 +0000 | [diff] [blame] | 279 | |
| 280 | art_cc_test { |
| 281 | name: "art_libdexfile_support_tests", |
| 282 | host_supported: true, |
| 283 | test_per_src: true, // For consistency with other ART gtests. |
| 284 | srcs: [ |
| 285 | "external/dex_file_supp_test.cc", |
| 286 | ], |
| 287 | shared_libs: [ |
| 288 | "libartbase", |
| 289 | "libbase", |
| 290 | "libdexfile_external", |
| 291 | "libdexfile_support", |
| 292 | ], |
| 293 | } |