| Bob Badour | 9150de6 | 2021-02-26 03:22:24 -0800 | [diff] [blame] | 1 | package { |
| 2 | // See: http://go/android-license-faq |
| 3 | // A large-scale-change added 'default_applicable_licenses' to import |
| 4 | // all of the 'license_kinds' from "art_license" |
| 5 | // to get the below license kinds: |
| 6 | // SPDX-license-identifier-Apache-2.0 |
| 7 | default_applicable_licenses: ["art_license"], |
| 8 | } |
| 9 | |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 10 | bootstrap_go_package { |
| 11 | name: "soong-art", |
| 12 | pkgPath: "android/soong/art", |
| 13 | deps: [ |
| 14 | "blueprint", |
| 15 | "blueprint-pathtools", |
| Colin Cross | 84b6933 | 2017-11-01 14:23:17 -0700 | [diff] [blame] | 16 | "blueprint-proptools", |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 17 | "soong", |
| 18 | "soong-android", |
| Alex Light | da948ce | 2018-12-06 17:05:41 +0000 | [diff] [blame] | 19 | "soong-apex", |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 20 | "soong-cc", |
| 21 | ], |
| 22 | srcs: [ |
| 23 | "art.go", |
| 24 | "codegen.go", |
| 25 | "makevars.go", |
| 26 | ], |
| 27 | pluginFor: ["soong_build"], |
| 28 | } |
| 29 | |
| Andreas Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 30 | art_clang_tidy_errors = [ |
| Andreas Gampe | dfcd82c | 2018-10-16 20:22:37 -0700 | [diff] [blame] | 31 | "android-cloexec-dup", |
| 32 | "android-cloexec-open", |
| Andreas Gampe | 6cd8390 | 2018-10-03 20:03:03 -0700 | [diff] [blame] | 33 | "bugprone-argument-comment", |
| Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame] | 34 | "bugprone-lambda-function-name", |
| Andreas Gampe | 0dc93b1 | 2019-05-15 10:30:22 -0700 | [diff] [blame] | 35 | "bugprone-unused-raii", // Protect scoped things like MutexLock. |
| Andreas Gampe | afaf7f8 | 2018-10-16 11:32:38 -0700 | [diff] [blame] | 36 | "bugprone-unused-return-value", |
| Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame] | 37 | "bugprone-virtual-near-miss", |
| Andreas Gampe | 8351aac | 2018-09-10 12:37:49 -0700 | [diff] [blame] | 38 | "modernize-use-bool-literals", |
| Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame] | 39 | "modernize-use-nullptr", |
| Andreas Gampe | c55bb39 | 2018-09-21 00:02:02 +0000 | [diff] [blame] | 40 | "modernize-use-using", |
| Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame] | 41 | "performance-faster-string-find", |
| Andreas Gampe | 6f4cf6e | 2018-06-19 17:10:48 -0700 | [diff] [blame] | 42 | "performance-for-range-copy", |
| Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame] | 43 | "performance-implicit-conversion-in-loop", |
| Andreas Gampe | 44b3174 | 2018-10-01 19:30:57 -0700 | [diff] [blame] | 44 | "performance-noexcept-move-constructor", |
| Andreas Gampe | 6f4cf6e | 2018-06-19 17:10:48 -0700 | [diff] [blame] | 45 | "performance-unnecessary-copy-initialization", |
| 46 | "performance-unnecessary-value-param", |
| Andreas Gampe | bd39d14 | 2018-07-19 11:14:42 -0700 | [diff] [blame] | 47 | "misc-unused-using-decls", |
| Andreas Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 48 | ] |
| Andreas Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 49 | |
| 50 | art_clang_tidy_disabled = [ |
| 51 | "-google-default-arguments", |
| 52 | // We have local stores that are only used for debug checks. |
| 53 | "-clang-analyzer-deadcode.DeadStores", |
| 54 | // We are OK with some static globals and that they can, in theory, throw. |
| 55 | "-cert-err58-cpp", |
| 56 | // We have lots of C-style variadic functions, and are OK with them. JNI ensures |
| 57 | // that working around this warning would be extra-painful. |
| 58 | "-cert-dcl50-cpp", |
| Andreas Gampe | 322c089 | 2018-09-18 13:50:29 -0700 | [diff] [blame] | 59 | // "Modernization" we don't agree with. |
| 60 | "-modernize-use-auto", |
| 61 | "-modernize-return-braced-init-list", |
| 62 | "-modernize-use-default-member-init", |
| 63 | "-modernize-pass-by-value", |
| Andreas Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 64 | ] |
| 65 | |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 66 | art_global_defaults { |
| 67 | // Additional flags are computed by art.go |
| 68 | |
| 69 | name: "art_defaults", |
| Martin Stjernholm | b4abe0a | 2019-05-17 19:22:55 +0100 | [diff] [blame] | 70 | |
| 71 | // This is the default visibility for the //art package, but we repeat it |
| 72 | // here so that it gets merged with other visibility rules in modules |
| 73 | // extending these defaults. |
| 74 | visibility: ["//art:__subpackages__"], |
| 75 | |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 76 | cflags: [ |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 77 | // Base set of cflags used by all things ART. |
| 78 | "-fno-rtti", |
| 79 | "-ggdb3", |
| 80 | "-Wall", |
| 81 | "-Werror", |
| 82 | "-Wextra", |
| 83 | "-Wstrict-aliasing", |
| 84 | "-fstrict-aliasing", |
| 85 | "-Wunreachable-code", |
| 86 | "-Wredundant-decls", |
| 87 | "-Wshadow", |
| 88 | "-Wunused", |
| 89 | "-fvisibility=protected", |
| 90 | |
| 91 | // Warn about thread safety violations with clang. |
| 92 | "-Wthread-safety", |
| Colin Cross | 62f62f3 | 2019-11-05 15:55:45 -0800 | [diff] [blame] | 93 | // TODO(b/144045034): turn on -Wthread-safety-negative |
| 94 | //"-Wthread-safety-negative", |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 95 | |
| 96 | // Warn if switch fallthroughs aren't annotated. |
| 97 | "-Wimplicit-fallthrough", |
| 98 | |
| 99 | // Enable float equality warnings. |
| 100 | "-Wfloat-equal", |
| 101 | |
| 102 | // Enable warning of converting ints to void*. |
| 103 | "-Wint-to-void-pointer-cast", |
| 104 | |
| 105 | // Enable warning of wrong unused annotations. |
| 106 | "-Wused-but-marked-unused", |
| 107 | |
| 108 | // Enable warning for deprecated language features. |
| 109 | "-Wdeprecated", |
| 110 | |
| 111 | // Enable warning for unreachable break & return. |
| 112 | "-Wunreachable-code-break", |
| 113 | "-Wunreachable-code-return", |
| 114 | |
| David Srbecky | 56de89a | 2018-10-01 15:32:20 +0100 | [diff] [blame] | 115 | // Disable warning for use of offsetof on non-standard layout type. |
| 116 | // We use it to implement OFFSETOF_MEMBER - see macros.h. |
| 117 | "-Wno-invalid-offsetof", |
| 118 | |
| Yi Kong | 3940254 | 2019-03-24 02:47:16 -0700 | [diff] [blame] | 119 | // Enable inconsistent-missing-override warning. This warning is disabled by default in |
| 120 | // Android. |
| 121 | "-Winconsistent-missing-override", |
| 122 | |
| David Sehr | ae3bcac | 2017-02-03 15:19:00 -0800 | [diff] [blame] | 123 | // Enable thread annotations for std::mutex, etc. |
| 124 | "-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS", |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 125 | ], |
| 126 | |
| jaishank | bf7ce25 | 2019-06-10 16:16:47 +0530 | [diff] [blame] | 127 | arch: { |
| 128 | x86: { |
| 129 | avx2: { |
| 130 | cflags: [ |
| 131 | "-mavx2", |
| 132 | "-mfma", |
| 133 | ], |
| 134 | }, |
| 135 | }, |
| 136 | x86_64: { |
| 137 | avx2: { |
| 138 | cflags: [ |
| 139 | "-mavx2", |
| 140 | "-mfma", |
| 141 | ], |
| 142 | }, |
| 143 | }, |
| 144 | }, |
| 145 | |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 146 | target: { |
| 147 | android: { |
| 148 | cflags: [ |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 149 | // To use oprofile_android --callgraph, uncomment this and recompile with |
| 150 | // mmma -j art |
| 151 | // "-fno-omit-frame-pointer", |
| 152 | // "-marm", |
| 153 | // "-mapcs", |
| 154 | ], |
| Paul Duffin | 34ac9f7 | 2019-07-18 13:03:24 +0100 | [diff] [blame] | 155 | header_libs: [ |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 156 | // We optimize Thread::Current() with a direct TLS access. This requires access to a |
| Christopher Ferris | fd64e56 | 2019-09-25 17:58:26 -0700 | [diff] [blame] | 157 | // platform specific Bionic header. |
| 158 | "bionic_libc_platform_headers", |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 159 | ], |
| 160 | }, |
| Dan Willemsen | 057f1e4 | 2017-10-03 14:11:48 -0700 | [diff] [blame] | 161 | linux: { |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 162 | cflags: [ |
| 163 | // Enable missing-noreturn only on non-Mac. As lots of things are not implemented for |
| 164 | // Apple, it's a pain. |
| 165 | "-Wmissing-noreturn", |
| 166 | ], |
| 167 | }, |
| Andreas Gampe | a47a6e8 | 2019-07-24 09:46:16 -0700 | [diff] [blame] | 168 | linux_bionic: { |
| 169 | header_libs: [ |
| 170 | // We optimize Thread::Current() with a direct TLS access. This requires access to a |
| Christopher Ferris | fd64e56 | 2019-09-25 17:58:26 -0700 | [diff] [blame] | 171 | // platform specific Bionic header. |
| 172 | "bionic_libc_platform_headers", |
| Andreas Gampe | a47a6e8 | 2019-07-24 09:46:16 -0700 | [diff] [blame] | 173 | ], |
| Calin Juravle | 542e393 | 2019-12-09 19:54:18 -0800 | [diff] [blame] | 174 | strip: { |
| Calin Juravle | 3bdb977 | 2019-12-10 11:31:53 -0800 | [diff] [blame] | 175 | // Do not strip art libs when building for linux-bionic. |
| 176 | // Otherwise we can't get any symbols out of crashes. |
| Calin Juravle | 542e393 | 2019-12-09 19:54:18 -0800 | [diff] [blame] | 177 | none: true, |
| 178 | }, |
| Andreas Gampe | a47a6e8 | 2019-07-24 09:46:16 -0700 | [diff] [blame] | 179 | }, |
| David Srbecky | d53f606 | 2019-03-22 14:55:21 +0000 | [diff] [blame] | 180 | darwin: { |
| 181 | enabled: false, |
| 182 | }, |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 183 | host: { |
| 184 | cflags: [ |
| 185 | // Bug: 15446488. We don't omit the frame pointer to work around |
| 186 | // clang/libunwind bugs that cause SEGVs in run-test-004-ThreadStress. |
| 187 | "-fno-omit-frame-pointer", |
| Aart Bik | f605257 | 2017-07-20 16:47:45 -0700 | [diff] [blame] | 188 | // The build assumes that all our x86/x86_64 hosts (such as buildbots and developer |
| 189 | // desktops) support at least sse4.2/popcount. This firstly implies that the ART |
| 190 | // runtime binary itself may exploit these features. Secondly, this implies that |
| 191 | // the ART runtime passes these feature flags to dex2oat and JIT by calling the |
| 192 | // method InstructionSetFeatures::FromCppDefines(). Since invoking dex2oat directly |
| 193 | // does not pick up these flags, cross-compiling from a x86/x86_64 host to a |
| 194 | // x86/x86_64 target should not be affected. |
| 195 | "-msse4.2", |
| 196 | "-mpopcnt", |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 197 | ], |
| 198 | }, |
| 199 | }, |
| 200 | |
| 201 | codegen: { |
| 202 | arm: { |
| 203 | cflags: ["-DART_ENABLE_CODEGEN_arm"], |
| 204 | }, |
| 205 | arm64: { |
| 206 | cflags: ["-DART_ENABLE_CODEGEN_arm64"], |
| 207 | }, |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 208 | x86: { |
| 209 | cflags: ["-DART_ENABLE_CODEGEN_x86"], |
| 210 | }, |
| 211 | x86_64: { |
| 212 | cflags: ["-DART_ENABLE_CODEGEN_x86_64"], |
| 213 | }, |
| 214 | }, |
| 215 | |
| Andreas Gampe | 896583e | 2018-06-15 13:31:58 -0700 | [diff] [blame] | 216 | tidy_checks: art_clang_tidy_errors + art_clang_tidy_disabled, |
| Nikita Ioffe | 0841735 | 2019-03-28 12:47:38 +0000 | [diff] [blame] | 217 | tidy_checks_as_errors: art_clang_tidy_errors, |
| George Burgess IV | 7fb4665 | 2017-06-16 15:35:33 -0700 | [diff] [blame] | 218 | |
| 219 | tidy_flags: [ |
| 220 | // The static analyzer treats DCHECK as always enabled; we sometimes get |
| 221 | // false positives when we use DCHECKs with code that relies on NDEBUG. |
| 222 | "-extra-arg=-UNDEBUG", |
| George Burgess IV | dd8aa32 | 2017-06-21 16:34:35 -0700 | [diff] [blame] | 223 | // clang-tidy complains about functions like: |
| 224 | // void foo() { CHECK(kIsFooEnabled); /* do foo... */ } |
| 225 | // not being marked noreturn if kIsFooEnabled is false. |
| 226 | "-extra-arg=-Wno-missing-noreturn", |
| Andreas Gampe | 020020f | 2018-07-10 12:34:23 -0700 | [diff] [blame] | 227 | // Because tidy doesn't like our flow checks for compile-time configuration and thinks that |
| 228 | // the following code is dead (it is, but not for all configurations), disable unreachable |
| 229 | // code detection in Clang for tidy builds. It is still on for regular build steps, so we |
| 230 | // will still get the "real" errors. |
| 231 | "-extra-arg=-Wno-unreachable-code", |
| George Burgess IV | 7fb4665 | 2017-06-16 15:35:33 -0700 | [diff] [blame] | 232 | ], |
| Nicolas Geoffray | ec388c0 | 2021-03-03 22:09:06 +0000 | [diff] [blame^] | 233 | |
| 234 | min_sdk_version: "S", |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 235 | } |
| 236 | |
| Yi Kong | f579b06 | 2020-10-24 22:54:39 +0800 | [diff] [blame] | 237 | cc_defaults { |
| 238 | name: "art_pgo_defaults", |
| 239 | visibility: ["//art:__subpackages__"], |
| 240 | pgo: { |
| 241 | sampling: true, |
| 242 | }, |
| 243 | target: { |
| 244 | android_arm64: { |
| 245 | pgo: { |
| 246 | profile_file: "art/art_arm_arm64.profdata", |
| 247 | }, |
| 248 | }, |
| 249 | android_arm: { |
| 250 | pgo: { |
| 251 | profile_file: "art/art_arm_arm64.profdata", |
| 252 | }, |
| 253 | }, |
| 254 | android_x86_64: { |
| 255 | pgo: { |
| 256 | profile_file: "art/art_x86_x86_64.profdata", |
| 257 | }, |
| 258 | }, |
| 259 | android_x86: { |
| 260 | pgo: { |
| 261 | profile_file: "art/art_x86_x86_64.profdata", |
| 262 | }, |
| 263 | }, |
| 264 | }, |
| 265 | } |
| 266 | |
| Colin Cross | be332ed | 2016-09-21 13:23:53 -0700 | [diff] [blame] | 267 | art_debug_defaults { |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 268 | name: "art_debug_defaults", |
| Martin Stjernholm | b4abe0a | 2019-05-17 19:22:55 +0100 | [diff] [blame] | 269 | visibility: ["//art:__subpackages__"], |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 270 | cflags: [ |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 271 | "-DDYNAMIC_ANNOTATIONS_ENABLED=1", |
| 272 | "-DVIXL_DEBUG", |
| 273 | "-UNDEBUG", |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 274 | ], |
| 275 | asflags: [ |
| 276 | "-UNDEBUG", |
| 277 | ], |
| Colin Cross | c564406 | 2016-08-30 15:41:08 -0700 | [diff] [blame] | 278 | target: { |
| 279 | // This has to be duplicated for android and host to make sure it |
| 280 | // comes after the -Wframe-larger-than warnings inserted by art.go |
| 281 | // target-specific properties |
| 282 | android: { |
| 283 | cflags: ["-Wno-frame-larger-than="], |
| 284 | }, |
| 285 | host: { |
| 286 | cflags: ["-Wno-frame-larger-than="], |
| 287 | }, |
| 288 | }, |
| Nicolas Geoffray | ec388c0 | 2021-03-03 22:09:06 +0000 | [diff] [blame^] | 289 | |
| 290 | min_sdk_version: "S", |
| Colin Cross | 1f7f3bd | 2016-07-27 10:12:38 -0700 | [diff] [blame] | 291 | } |
| Nicolas Geoffray | f6c3784 | 2020-03-31 14:00:47 +0100 | [diff] [blame] | 292 | |
| Martin Stjernholm | 90b2661 | 2021-03-03 09:49:27 +0000 | [diff] [blame] | 293 | soong_config_module_type_import { |
| 294 | from: "art/build/SoongConfig.bp", |
| 295 | module_types: ["art_module_cc_defaults"], |
| 296 | } |
| 297 | |
| 298 | // Use this to enable a cc_* module only when building ART from sources. |
| 299 | // TODO(b/172480617): Clean up when sources are gone from the platform tree and |
| 300 | // we no longer need to support sources present when prebuilts are used. |
| 301 | art_module_cc_defaults { |
| 302 | name: "art_module_source_build_defaults", |
| 303 | defaults_visibility: [ |
| 304 | "//art:__subpackages__", |
| 305 | "//libnativehelper:__subpackages__", |
| 306 | ], |
| 307 | |
| 308 | enabled: false, |
| 309 | soong_config_variables: { |
| 310 | source_build: { |
| 311 | enabled: true, |
| 312 | }, |
| 313 | }, |
| 314 | target: { |
| 315 | windows: { |
| 316 | // Windows is disabled by default, but if we set enabled:true |
| 317 | // globally above we need to disable it explicitly. |
| 318 | enabled: false, |
| 319 | }, |
| 320 | }, |
| 321 | } |
| 322 | |
| Nicolas Geoffray | f6c3784 | 2020-03-31 14:00:47 +0100 | [diff] [blame] | 323 | // A version of conscrypt only for enabling the "-hostdex" version to test ART on host. |
| 324 | java_library { |
| Victor Chang | d20e51d | 2020-05-05 16:01:19 +0100 | [diff] [blame] | 325 | // We need our own name to not clash with the conscrypt library. |
| Nicolas Geoffray | f6c3784 | 2020-03-31 14:00:47 +0100 | [diff] [blame] | 326 | name: "conscrypt-host", |
| 327 | installable: true, |
| 328 | hostdex: true, |
| 329 | static_libs: ["conscrypt"], |
| 330 | |
| 331 | // Tests and build files rely on this file to be installed as "conscrypt-hostdex", |
| 332 | // therefore set a stem. Without it, the file would be installed as |
| 333 | // "conscrypt-host-hostdex". |
| 334 | stem: "conscrypt", |
| 335 | sdk_version: "core_platform", |
| 336 | target: { |
| 337 | hostdex: { |
| 338 | required: ["libjavacrypto"], |
| 339 | }, |
| Yo Chiang | e492f7e | 2020-08-07 04:22:18 +0000 | [diff] [blame] | 340 | darwin: { |
| 341 | // required module "libjavacrypto" is disabled on darwin |
| 342 | enabled: false, |
| 343 | }, |
| Nicolas Geoffray | f6c3784 | 2020-03-31 14:00:47 +0100 | [diff] [blame] | 344 | }, |
| 345 | } |
| Victor Chang | d20e51d | 2020-05-05 16:01:19 +0100 | [diff] [blame] | 346 | |
| 347 | // A version of core-icu4j only for enabling the "-hostdex" version to test ART on host. |
| 348 | java_library { |
| 349 | // We need our own name to not clash with the core-icu4j library. |
| 350 | name: "core-icu4j-host", |
| 351 | installable: true, |
| 352 | hostdex: true, |
| 353 | static_libs: ["core-icu4j"], |
| 354 | |
| 355 | // Tests and build files rely on this file to be installed as "core-icu4j-hostdex", |
| 356 | // therefore set a stem. Without it, the file would be installed as |
| 357 | // "core-icu4j-host-hostdex". |
| 358 | stem: "core-icu4j", |
| 359 | sdk_version: "core_platform", |
| 360 | target: { |
| 361 | hostdex: { |
| 362 | required: ["libicu_jni"], |
| 363 | }, |
| 364 | }, |
| 365 | } |