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 Srbecky | d53f606 | 2019-03-22 14:55:21 +0000 | [diff] [blame^] | 93 | darwin: { |
| 94 | enabled: true, |
| 95 | }, |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 96 | }, |
| 97 | generated_sources: ["dexfile_operator_srcs"], |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 98 | export_include_dirs: ["."], |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 99 | } |
| 100 | |
Andreas Gampe | ec5ed06 | 2018-01-26 16:20:02 -0800 | [diff] [blame] | 101 | cc_defaults { |
| 102 | name: "libdexfile_static_base_defaults", |
| 103 | static_libs: [ |
| 104 | "libbase", |
Andreas Gampe | ec5ed06 | 2018-01-26 16:20:02 -0800 | [diff] [blame] | 105 | "liblog", |
Nicolas Geoffray | 65ed42a | 2018-10-30 12:33:04 +0000 | [diff] [blame] | 106 | "libz", |
| 107 | "libziparchive", |
Andreas Gampe | ec5ed06 | 2018-01-26 16:20:02 -0800 | [diff] [blame] | 108 | ], |
| 109 | } |
| 110 | |
| 111 | cc_defaults { |
| 112 | name: "libdexfile_static_defaults", |
| 113 | defaults: [ |
| 114 | "libartbase_static_defaults", |
| 115 | "libdexfile_static_base_defaults", |
| 116 | ], |
| 117 | static_libs: ["libdexfile"], |
| 118 | } |
| 119 | |
| 120 | cc_defaults { |
| 121 | name: "libdexfiled_static_defaults", |
| 122 | defaults: [ |
| 123 | "libartbased_static_defaults", |
| 124 | "libdexfile_static_base_defaults", |
| 125 | ], |
| 126 | static_libs: ["libdexfiled"], |
| 127 | } |
| 128 | |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 129 | gensrcs { |
| 130 | name: "dexfile_operator_srcs", |
Alex Light | b69d2d3 | 2018-02-21 13:37:17 -0800 | [diff] [blame] | 131 | cmd: "$(location generate_operator_out) art/libdexfile $(in) > $(out)", |
| 132 | tools: ["generate_operator_out"], |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 133 | srcs: [ |
| 134 | "dex/dex_file.h", |
David Sehr | c431b9d | 2018-03-02 12:01:51 -0800 | [diff] [blame] | 135 | "dex/dex_file_layout.h", |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 136 | "dex/dex_instruction.h", |
| 137 | "dex/dex_instruction_utils.h", |
| 138 | "dex/invoke_type.h", |
David Sehr | 312f3b2 | 2018-03-19 08:39:26 -0700 | [diff] [blame] | 139 | "dex/method_reference.h", |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 140 | ], |
| 141 | output_extension: "operator_out.cc", |
| 142 | } |
| 143 | |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 144 | art_cc_library { |
| 145 | name: "libdexfile", |
| 146 | defaults: ["libdexfile_defaults"], |
| 147 | // Leave the symbols in the shared library so that stack unwinders can |
| 148 | // produce meaningful name resolution. |
| 149 | strip: { |
| 150 | keep_symbols: true, |
| 151 | }, |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 152 | target: { |
| 153 | windows: { |
| 154 | enabled: true, |
| 155 | shared: { |
| 156 | enabled: false, |
| 157 | }, |
| 158 | }, |
| 159 | }, |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 160 | } |
| 161 | |
David Sehr | fcbe15c | 2018-02-15 09:41:13 -0800 | [diff] [blame] | 162 | art_cc_library { |
| 163 | name: "libdexfiled", |
| 164 | defaults: [ |
| 165 | "art_debug_defaults", |
| 166 | "libdexfile_defaults", |
| 167 | ], |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 168 | target: { |
| 169 | windows: { |
| 170 | enabled: true, |
| 171 | shared: { |
| 172 | enabled: false, |
| 173 | }, |
| 174 | }, |
| 175 | }, |
David Sehr | fcbe15c | 2018-02-15 09:41:13 -0800 | [diff] [blame] | 176 | } |
| 177 | |
Martin Stjernholm | fdb2f60 | 2019-01-09 14:47:00 +0000 | [diff] [blame] | 178 | art_cc_test { |
| 179 | name: "art_libdexfile_tests", |
| 180 | defaults: [ |
| 181 | "art_gtest_defaults", |
| 182 | ], |
| 183 | srcs: [ |
| 184 | "dex/art_dex_file_loader_test.cc", |
| 185 | "dex/class_accessor_test.cc", |
| 186 | "dex/code_item_accessors_test.cc", |
| 187 | "dex/compact_dex_file_test.cc", |
| 188 | "dex/compact_offset_table_test.cc", |
| 189 | "dex/descriptors_names_test.cc", |
| 190 | "dex/test_dex_file_builder_test.cc", |
| 191 | "dex/dex_file_loader_test.cc", |
| 192 | "dex/dex_file_verifier_test.cc", |
| 193 | "dex/dex_instruction_test.cc", |
| 194 | "dex/primitive_test.cc", |
| 195 | "dex/string_reference_test.cc", |
| 196 | "dex/type_lookup_table_test.cc", |
| 197 | "dex/utf_test.cc", |
| 198 | ], |
| 199 | shared_libs: [ |
| 200 | "libbacktrace", |
| 201 | "libziparchive", |
| 202 | ], |
| 203 | include_dirs: [ |
| 204 | "external/zlib", |
| 205 | ], |
| 206 | } |
| 207 | |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 208 | cc_library_headers { |
| 209 | name: "libdexfile_external_headers", |
| 210 | host_supported: true, |
Martin Stjernholm | fe94b1c | 2019-01-31 17:40:39 +0000 | [diff] [blame] | 211 | vendor_available: true, |
| 212 | recovery_available: true, |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 213 | header_libs: ["libbase_headers"], |
| 214 | export_header_lib_headers: ["libbase_headers"], |
| 215 | export_include_dirs: ["external/include"], |
| 216 | |
| 217 | target: { |
| 218 | windows: { |
| 219 | enabled: true, |
| 220 | }, |
| 221 | }, |
| 222 | } |
| 223 | |
| 224 | cc_library { |
| 225 | name: "libdexfile_external", |
| 226 | host_supported: true, |
| 227 | srcs: [ |
| 228 | "external/dex_file_ext.cc", |
| 229 | ], |
| 230 | header_libs: ["libdexfile_external_headers"], |
| 231 | shared_libs: [ |
| 232 | "libbase", |
| 233 | "libdexfile", |
| 234 | ], |
| 235 | |
Martin Stjernholm | 84bf698 | 2019-02-05 15:07:57 +0000 | [diff] [blame] | 236 | stubs: { |
| 237 | symbol_file: "external/libdexfile_external.map.txt", |
| 238 | versions: ["1"], |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 239 | }, |
| 240 | } |
| 241 | |
Martin Stjernholm | fdb2f60 | 2019-01-09 14:47:00 +0000 | [diff] [blame] | 242 | art_cc_test { |
| 243 | name: "art_libdexfile_external_tests", |
| 244 | host_supported: true, |
| 245 | test_per_src: true, // For consistency with other ART gtests. |
| 246 | srcs: [ |
| 247 | "external/dex_file_ext_c_test.c", |
| 248 | ], |
| 249 | header_libs: ["libdexfile_external_headers"], |
| 250 | } |
| 251 | |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 252 | // Support library with a C++ API for accessing the libdexfile API for external |
Martin Stjernholm | fe94b1c | 2019-01-31 17:40:39 +0000 | [diff] [blame] | 253 | // (non-ART) users. |
| 254 | // |
| 255 | // This library dlopens libdexfile_external on first use, so there is no build |
| 256 | // time dependency on dex file logic. It is therefore safe to use from binaries |
| 257 | // compiled without dex file support, given they won't encounter any dex file |
| 258 | // stack frames. |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 259 | cc_library { |
| 260 | name: "libdexfile_support", |
| 261 | host_supported: true, |
Martin Stjernholm | fe94b1c | 2019-01-31 17:40:39 +0000 | [diff] [blame] | 262 | vendor_available: true, |
| 263 | recovery_available: true, |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 264 | srcs: [ |
| 265 | "external/dex_file_supp.cc", |
| 266 | ], |
Martin Stjernholm | fe94b1c | 2019-01-31 17:40:39 +0000 | [diff] [blame] | 267 | required: ["libdexfile_external"], |
| 268 | shared_libs: ["liblog"], |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 269 | header_libs: ["libdexfile_external_headers"], |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 270 | export_header_lib_headers: ["libdexfile_external_headers"], |
Martin Stjernholm | fe94b1c | 2019-01-31 17:40:39 +0000 | [diff] [blame] | 271 | target: { |
| 272 | recovery: { |
| 273 | cflags: ["-DNO_DEXFILE_SUPPORT"], |
| 274 | }, |
| 275 | vendor: { |
| 276 | cflags: ["-DNO_DEXFILE_SUPPORT"], |
| 277 | }, |
| 278 | }, |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 279 | } |
Martin Stjernholm | 750bf04 | 2019-01-09 22:51:12 +0000 | [diff] [blame] | 280 | |
Martin Stjernholm | 70ae00d | 2019-02-15 22:41:14 +0000 | [diff] [blame] | 281 | // The same source file is used in two tests here, so unlike other ART gtests it |
| 282 | // doesn't use test_per_src. Its test target is |
| 283 | // test-art-{host,target}-gtest-art_libdexfile_support_tests. |
Martin Stjernholm | 750bf04 | 2019-01-09 22:51:12 +0000 | [diff] [blame] | 284 | art_cc_test { |
| 285 | name: "art_libdexfile_support_tests", |
| 286 | host_supported: true, |
Martin Stjernholm | 750bf04 | 2019-01-09 22:51:12 +0000 | [diff] [blame] | 287 | srcs: [ |
| 288 | "external/dex_file_supp_test.cc", |
| 289 | ], |
| 290 | shared_libs: [ |
| 291 | "libartbase", |
| 292 | "libbase", |
| 293 | "libdexfile_external", |
| 294 | "libdexfile_support", |
| 295 | ], |
| 296 | } |
Martin Stjernholm | fe94b1c | 2019-01-31 17:40:39 +0000 | [diff] [blame] | 297 | |
| 298 | cc_library_static { |
| 299 | name: "libdexfile_support_static", |
| 300 | host_supported: true, |
| 301 | defaults: ["libdexfile_static_defaults"], |
| 302 | srcs: [ |
| 303 | "external/dex_file_supp.cc", |
| 304 | ], |
| 305 | cflags: ["-DSTATIC_LIB"], |
| 306 | // Using whole_static_libs here only as a "poor man's transitivity" kludge. |
| 307 | whole_static_libs: [ |
| 308 | "libbase", |
| 309 | "libdexfile", |
| 310 | "libdexfile_external", |
| 311 | "liblog", |
| 312 | "libz", |
| 313 | "libziparchive", |
| 314 | ], |
| 315 | header_libs: ["libdexfile_external_headers"], |
| 316 | export_header_lib_headers: ["libdexfile_external_headers"], |
| 317 | } |
| 318 | |
Martin Stjernholm | 70ae00d | 2019-02-15 22:41:14 +0000 | [diff] [blame] | 319 | // The same source file is used in two tests here, so unlike other ART gtests it |
| 320 | // doesn't use test_per_src. Its test target is |
| 321 | // test-art-{host,target}-gtest-art_libdexfile_support_static_tests. |
Martin Stjernholm | fe94b1c | 2019-01-31 17:40:39 +0000 | [diff] [blame] | 322 | art_cc_test { |
| 323 | name: "art_libdexfile_support_static_tests", |
| 324 | host_supported: true, |
| 325 | srcs: [ |
| 326 | "external/dex_file_supp_test.cc", |
| 327 | ], |
| 328 | static_libs: [ |
| 329 | "libbase", |
| 330 | "libdexfile_support_static", |
| 331 | ], |
| 332 | } |