Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 1 | // Copyright (C) 2007 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 | // |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 16 | // Definitions for building the Android core library and associated tests. |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 17 | // |
| 18 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 19 | // The Android core library provides low-level APIs for use by the rest of the |
| 20 | // Android software stack. It is made up of various parts, some of which can be |
| 21 | // found in libcore/ and other parts that can be found in various external/ |
| 22 | // directories. See the "core-system-modules" definition for the parts. |
| 23 | |
Neil Fuller | cf75688 | 2018-08-28 18:42:22 +0100 | [diff] [blame] | 24 | // libcore has some sub-directories that follow a common structure: |
| 25 | // e.g. dalvik, dom, harmony-tests, json, jsr166-tests, luni, libart, ojluni, |
| 26 | // support, xml, xmlpull. |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 27 | // |
Neil Fuller | cf75688 | 2018-08-28 18:42:22 +0100 | [diff] [blame] | 28 | // The structure of these is generally: |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 29 | // |
| 30 | // src/ |
| 31 | // main/ # To be shipped on every device. |
| 32 | // java/ # Java source for library code. |
Neil Fuller | cf75688 | 2018-08-28 18:42:22 +0100 | [diff] [blame] | 33 | // native/ # C/C++ source for library code. |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 34 | // resources/ # Support files. |
| 35 | // test/ # Built only on demand, for testing. |
| 36 | // java/ # Java source for tests. |
Neil Fuller | cf75688 | 2018-08-28 18:42:22 +0100 | [diff] [blame] | 37 | // native/ # C/C++ source for tests (rare). |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 38 | // resources/ # Support files. |
| 39 | // |
Neil Fuller | cf75688 | 2018-08-28 18:42:22 +0100 | [diff] [blame] | 40 | // All subdirectories are optional. |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 41 | |
| 42 | build = [ |
| 43 | "openjdk_java_files.bp", |
| 44 | "non_openjdk_java_files.bp", |
| 45 | ] |
| 46 | |
| 47 | // The Java files and their associated resources. |
| 48 | core_resource_dirs = [ |
| 49 | "luni/src/main/java", |
| 50 | "ojluni/src/main/resources/", |
| 51 | ] |
| 52 | |
Neil Fuller | 866ed4a | 2018-09-06 12:05:46 +0100 | [diff] [blame] | 53 | // The source files that go into core-oj. |
| 54 | filegroup { |
| 55 | name: "core_oj_java_files", |
| 56 | srcs: [":openjdk_java_files"], |
| 57 | } |
| 58 | |
| 59 | // OpenJDK source is not annotated with @hide so we need a separate |
| 60 | // filegroup for just the parts that contribute to the API. |
| 61 | filegroup { |
| 62 | name: "core_oj_api_files", |
| 63 | srcs: [":openjdk_javadoc_files"], |
| 64 | } |
| 65 | |
| 66 | // The source files that go into core-libart. |
| 67 | filegroup { |
| 68 | name: "core_libart_java_files", |
| 69 | srcs: [ |
| 70 | ":non_openjdk_java_files", |
| 71 | ":android_icu4j_src_files", |
| 72 | ], |
| 73 | } |
| 74 | |
| 75 | // Some parts of libart are not annotated with @hide so we need a separate |
| 76 | // filegroup for just the parts that contribute to the API. |
| 77 | filegroup { |
| 78 | name: "core_libart_api_files", |
| 79 | srcs: [ |
| 80 | ":non_openjdk_javadoc_files", |
| 81 | ":android_icu4j_src_files", |
| 82 | ], |
| 83 | } |
| 84 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 85 | // The set of files for the core library that have been marked up with @hide and |
| 86 | // API-related annotations. Note that this includes the intra-core and |
| 87 | // core-platform APIs as well as the public APIs. |
| 88 | // |
| 89 | // Some source files in :openjdk_mmodule_extra_files are annotated by applying |
| 90 | // annotations to the .annotated.java stubs files in ojluni/annotated/mmodules |
| 91 | // and rather than in the original source. See the comments in |
| 92 | // openjdk_java_files.bp for more details. |
Neil Fuller | 866ed4a | 2018-09-06 12:05:46 +0100 | [diff] [blame] | 93 | filegroup { |
| 94 | name: "core_api_files", |
| 95 | srcs: [ |
Neil Fuller | d129bc9 | 2018-09-26 11:12:58 +0100 | [diff] [blame] | 96 | ":apache-xml_api_files", |
Neil Fuller | a77f710 | 2018-09-21 19:04:41 +0100 | [diff] [blame] | 97 | ":bouncycastle_java_files", |
Neil Fuller | 603e1a7 | 2018-09-25 11:55:41 +0100 | [diff] [blame] | 98 | ":conscrypt_java_files", |
Neil Fuller | 866ed4a | 2018-09-06 12:05:46 +0100 | [diff] [blame] | 99 | ":core_oj_api_files", |
| 100 | ":core_libart_api_files", |
Neil Fuller | 641d5f9 | 2018-09-24 15:40:39 +0100 | [diff] [blame] | 101 | ":okhttp_api_files", |
Pete Gillin | c9935b6 | 2018-09-25 14:42:40 +0100 | [diff] [blame] | 102 | ":openjdk_mmodule_extra_files", |
Neil Fuller | 866ed4a | 2018-09-06 12:05:46 +0100 | [diff] [blame] | 103 | ], |
| 104 | } |
| 105 | |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 106 | java_defaults { |
| 107 | name: "libcore_java_defaults", |
| 108 | javacflags: [ |
| 109 | //"-Xlint:all", |
| 110 | //"-Xlint:-serial,-deprecation,-unchecked", |
| 111 | ], |
| 112 | dxflags: ["--core-library"], |
Andreas Gampe | 66b3173 | 2018-02-20 09:22:16 -0800 | [diff] [blame] | 113 | errorprone: { |
| 114 | javacflags: [ |
| 115 | "-Xep:MissingOverride:OFF", // Ignore missing @Override. |
Andreas Gampe | 24a2017 | 2018-06-13 11:28:45 -0700 | [diff] [blame] | 116 | "-Xep:ConstantOverflow:WARN", // Known constant overflow in SplittableRandom |
Andreas Gampe | 66b3173 | 2018-02-20 09:22:16 -0800 | [diff] [blame] | 117 | ], |
| 118 | }, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 119 | } |
| 120 | |
| 121 | // |
| 122 | // Build for the target (device). |
| 123 | // |
| 124 | |
Victor Chang | 7fef405 | 2018-09-25 14:12:03 +0100 | [diff] [blame] | 125 | // Rule generating resource lib for android_icu4j. |
| 126 | // In the downstream branch master-icu-dev, the resource files are generated. |
| 127 | // This rule can't be moved external/icu because soong enforces that no_standard_libs:true can only |
| 128 | // be used in libcore/ or development/ |
| 129 | java_library { |
| 130 | name: "android_icu4j_resources_lib", |
| 131 | java_resources: [":android_icu4j_resources"], |
| 132 | no_standard_libs: true, |
| 133 | system_modules: "none", |
| 134 | } |
| 135 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 136 | // A target used to bootstrap compilation for the core library. |
| 137 | // See core-all-system-modules for more details. |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 138 | java_library { |
| 139 | name: "core-all", |
| 140 | defaults: ["libcore_java_defaults"], |
| 141 | |
| 142 | srcs: [ |
Neil Fuller | 866ed4a | 2018-09-06 12:05:46 +0100 | [diff] [blame] | 143 | ":core_oj_java_files", |
| 144 | ":core_libart_java_files", |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 145 | ":openjdk_lambda_stub_files", |
| 146 | ], |
Colin Cross | ec80f4f | 2018-08-15 21:17:11 -0700 | [diff] [blame] | 147 | |
| 148 | no_standard_libs: true, |
| 149 | system_modules: "none", |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 150 | openjdk9: { |
| 151 | srcs: ["luni/src/module/java/module-info.java"], |
| 152 | javacflags: ["--patch-module=java.base=."], |
| 153 | }, |
Colin Cross | ec80f4f | 2018-08-15 21:17:11 -0700 | [diff] [blame] | 154 | |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 155 | java_resource_dirs: core_resource_dirs, |
Victor Chang | 7fef405 | 2018-09-25 14:12:03 +0100 | [diff] [blame] | 156 | static_libs: ["android_icu4j_resources_lib"], |
Tobias Thierer | de99123 | 2018-03-07 15:10:46 +0000 | [diff] [blame] | 157 | java_version: "1.9", |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 158 | |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 159 | installable: false, |
| 160 | } |
| 161 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 162 | // A system modules definition for use by core library targets only. It only |
| 163 | // contains the core-all jar, which contains the classes that end up in core-oj, |
| 164 | // core-libart as well as the lambda stubs needed to compile Java lambda code. |
| 165 | // It does not contain other parts of core library like conscrypt, bouncycastle, |
| 166 | // etc. This system_modules definition is used to bootstrap compilation for |
| 167 | // other parts of the core library like core-oj, core-libart, conscrypt, |
| 168 | // bouncycastle, etc. |
| 169 | // |
| 170 | // If you want to compile against the entire core library implementation, for |
| 171 | // example to build core library tests, see "core-system-modules" instead. |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 172 | java_system_modules { |
| 173 | name: "core-all-system-modules", |
| 174 | libs: ["core-all"], |
| 175 | } |
| 176 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 177 | // Contains the parts of core library associated with OpenJDK. |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 178 | java_library { |
| 179 | name: "core-oj", |
| 180 | defaults: ["libcore_java_defaults"], |
Colin Cross | 5b75cdd | 2018-06-27 11:00:13 -0700 | [diff] [blame] | 181 | installable: true, |
Colin Cross | bb180be | 2017-10-09 14:54:53 -0700 | [diff] [blame] | 182 | hostdex: true, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 183 | |
Neil Fuller | 866ed4a | 2018-09-06 12:05:46 +0100 | [diff] [blame] | 184 | srcs: [":core_oj_java_files"], |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 185 | java_resource_dirs: core_resource_dirs, |
Colin Cross | ec80f4f | 2018-08-15 21:17:11 -0700 | [diff] [blame] | 186 | |
| 187 | no_standard_libs: true, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 188 | libs: ["core-all"], |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 189 | system_modules: "core-all-system-modules", |
| 190 | openjdk9: { |
| 191 | javacflags: ["--patch-module=java.base=."], |
| 192 | }, |
Colin Cross | ec80f4f | 2018-08-15 21:17:11 -0700 | [diff] [blame] | 193 | |
Pete Gillin | 7a7a6d2 | 2017-12-19 14:56:03 +0000 | [diff] [blame] | 194 | jacoco: { |
Pete Gillin | 27ca058 | 2018-01-10 17:04:17 +0000 | [diff] [blame] | 195 | exclude_filter: [ |
Pete Gillin | 3f59bad | 2018-01-30 11:20:29 +0000 | [diff] [blame] | 196 | "java.lang.Class", |
| 197 | "java.lang.Long", |
| 198 | "java.lang.Number", |
| 199 | "java.lang.Object", |
| 200 | "java.lang.String", |
| 201 | "java.lang.invoke.MethodHandle", |
| 202 | "java.lang.ref.Reference", |
| 203 | "java.lang.reflect.Proxy", |
Pete Gillin | b1868ada | 2018-01-17 11:03:10 +0000 | [diff] [blame] | 204 | "java.util.AbstractMap", |
Pete Gillin | 3f59bad | 2018-01-30 11:20:29 +0000 | [diff] [blame] | 205 | "java.util.HashMap", |
| 206 | "java.util.HashMap$Node", |
Pete Gillin | b1868ada | 2018-01-17 11:03:10 +0000 | [diff] [blame] | 207 | "java.util.Map", |
Pete Gillin | 7a7a6d2 | 2017-12-19 14:56:03 +0000 | [diff] [blame] | 208 | ], |
| 209 | }, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 210 | |
| 211 | notice: "ojluni/NOTICE", |
| 212 | |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 213 | } |
| 214 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 215 | // Contains parts of core library not associated with OpenJDK. Contains not |
| 216 | // just java.*, javax.* code but also android.icu.*, android.system.* and |
| 217 | // various internal libcore.* packages. |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 218 | java_library { |
| 219 | name: "core-libart", |
| 220 | defaults: ["libcore_java_defaults"], |
Colin Cross | 5b75cdd | 2018-06-27 11:00:13 -0700 | [diff] [blame] | 221 | installable: true, |
Colin Cross | bb180be | 2017-10-09 14:54:53 -0700 | [diff] [blame] | 222 | hostdex: true, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 223 | |
Neil Fuller | 866ed4a | 2018-09-06 12:05:46 +0100 | [diff] [blame] | 224 | srcs: [":core_libart_java_files"], |
Victor Chang | 7fef405 | 2018-09-25 14:12:03 +0100 | [diff] [blame] | 225 | static_libs: ["android_icu4j_resources_lib"], |
Tobias Thierer | de99123 | 2018-03-07 15:10:46 +0000 | [diff] [blame] | 226 | java_version: "1.9", |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 227 | |
Colin Cross | ec80f4f | 2018-08-15 21:17:11 -0700 | [diff] [blame] | 228 | no_standard_libs: true, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 229 | libs: ["core-all"], |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 230 | system_modules: "core-all-system-modules", |
| 231 | openjdk9: { |
| 232 | javacflags: ["--patch-module=java.base=."], |
| 233 | }, |
Colin Cross | ec80f4f | 2018-08-15 21:17:11 -0700 | [diff] [blame] | 234 | |
Pete Gillin | 80ebe87 | 2018-02-13 15:21:20 +0000 | [diff] [blame] | 235 | jacoco: { |
| 236 | exclude_filter: [ |
| 237 | "java.lang.DexCache", |
| 238 | "dalvik.system.ClassExt", |
| 239 | ], |
| 240 | }, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 241 | |
| 242 | required: [ |
Neil Fuller | 3b8c055 | 2018-12-14 22:19:07 +0000 | [diff] [blame] | 243 | // Device files put in /system. |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 244 | "tzdata", |
Neil Fuller | 7a4d3db | 2018-11-20 19:43:10 +0000 | [diff] [blame] | 245 | "tz_version", |
Neil Fuller | 3b8c055 | 2018-12-14 22:19:07 +0000 | [diff] [blame] | 246 | // Files used to simulate the /system and runtime APEX dir |
| 247 | // structure on host. |
| 248 | "tzdata_host", |
| 249 | "tzdata_host_runtime_apex", |
| 250 | "tzlookup.xml_host_runtime_apex", |
| 251 | "tz_version_host", |
| 252 | "tz_version_host_runtime_apex", |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 253 | ], |
| 254 | } |
| 255 | |
Paul Duffin | 7bb8d23 | 2018-10-23 11:48:38 +0100 | [diff] [blame] | 256 | // Provided solely to contribute information about which hidden parts of the |
| 257 | // core-oj API are used by apps. |
| 258 | java_library { |
| 259 | name: "core-oj-hiddenapi", |
| 260 | defaults: ["libcore_java_defaults"], |
| 261 | compile_dex: true, |
| 262 | |
| 263 | srcs: [":openjdk_hiddenapi_javadoc_files"], |
| 264 | |
| 265 | no_standard_libs: true, |
| 266 | libs: ["core-all"], |
| 267 | system_modules: "core-all-system-modules", |
| 268 | openjdk9: { |
| 269 | javacflags: ["--patch-module=java.base=."], |
| 270 | }, |
| 271 | } |
| 272 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 273 | // |
| 274 | // Guaranteed unstripped versions of core-oj and core-libart. |
| 275 | // |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 276 | // The build system may or may not strip the core-oj and core-libart jars, |
| 277 | // but these will not be stripped. See b/24535627. |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 278 | // |
| 279 | |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 280 | java_library { |
| 281 | name: "core-oj-testdex", |
Colin Cross | 5b75cdd | 2018-06-27 11:00:13 -0700 | [diff] [blame] | 282 | installable: true, |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 283 | static_libs: ["core-oj"], |
| 284 | no_standard_libs: true, |
| 285 | libs: ["core-all"], |
| 286 | system_modules: "core-all-system-modules", |
| 287 | dxflags: ["--core-library"], |
Colin Cross | 485ed36 | 2017-12-05 17:24:22 -0800 | [diff] [blame] | 288 | dex_preopt: { |
| 289 | enabled: false, |
| 290 | }, |
Tobias Thierer | de99123 | 2018-03-07 15:10:46 +0000 | [diff] [blame] | 291 | java_version: "1.9", |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 292 | notice: "ojluni/NOTICE", |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 293 | } |
| 294 | |
| 295 | java_library { |
| 296 | name: "core-libart-testdex", |
Colin Cross | 5b75cdd | 2018-06-27 11:00:13 -0700 | [diff] [blame] | 297 | installable: true, |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 298 | static_libs: ["core-libart"], |
| 299 | no_standard_libs: true, |
| 300 | libs: ["core-all"], |
| 301 | system_modules: "core-all-system-modules", |
| 302 | dxflags: ["--core-library"], |
Colin Cross | 485ed36 | 2017-12-05 17:24:22 -0800 | [diff] [blame] | 303 | dex_preopt: { |
| 304 | enabled: false, |
| 305 | }, |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 306 | notice: "ojluni/NOTICE", |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 307 | } |
| 308 | |
Tobias Thierer | e0f8b31 | 2018-10-23 23:12:30 +0100 | [diff] [blame] | 309 | |
| 310 | java_defaults { |
| 311 | name: "core_lambda_stubs_defaults", |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 312 | defaults: ["libcore_java_defaults"], |
Neil Fuller | 4207c7f | 2018-10-10 14:01:40 +0100 | [diff] [blame] | 313 | hostdex: true, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 314 | |
Colin Cross | ec80f4f | 2018-08-15 21:17:11 -0700 | [diff] [blame] | 315 | no_standard_libs: true, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 316 | libs: ["core-all"], |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 317 | system_modules: "core-all-system-modules", |
| 318 | openjdk9: { |
| 319 | javacflags: ["--patch-module=java.base=."], |
| 320 | }, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 321 | |
| 322 | notice: "ojluni/NOTICE", |
| 323 | |
| 324 | installable: false, |
| 325 | include_srcs: true, |
| 326 | } |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 327 | |
Tobias Thierer | e0f8b31 | 2018-10-23 23:12:30 +0100 | [diff] [blame] | 328 | // Creates a jar that exists to satisfy javac when compiling source code that |
| 329 | // contains lambdas. This contains all classes / methods required by javac |
| 330 | // when generating invoke-dynamic lambda implementation code, even those that |
| 331 | // are also in the public SDK API from API level 26 onwards. |
| 332 | java_library { |
| 333 | name: "core-lambda-stubs", |
| 334 | defaults: ["core_lambda_stubs_defaults"], |
| 335 | srcs: [ |
| 336 | ":openjdk_lambda_stub_files", |
| 337 | ":openjdk_lambda_duplicate_stub_files", |
| 338 | ], |
| 339 | } |
| 340 | |
| 341 | // An alternative to core-lambda-stubs that omits openjdk_lambda_duplicate_stub_files |
| 342 | // because those classes are also part of the core library public SDK API |
| 343 | // (since API level 26). |
| 344 | java_library { |
| 345 | name: "core-lambda-stubs-for-system-modules", |
| 346 | defaults: ["core_lambda_stubs_defaults"], |
| 347 | srcs: [ |
| 348 | ":openjdk_lambda_stub_files", |
| 349 | ], |
| 350 | } |
| 351 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 352 | // A system modules definition containing the implementations for the various |
| 353 | // parts that make up the core library. |
| 354 | // |
| 355 | // This system module is intended for use by tests that may need access to |
| 356 | // core library internals. It should not be generally used; most of the |
| 357 | // platform build should build against API stubs instead. See |
| 358 | // "core-platform-api-stubs-system-modules", which is the default used by the |
| 359 | // Android build. |
| 360 | // |
| 361 | // This module also includes lambda stubs for compiling source containing |
| 362 | // Java lambdas. |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 363 | java_system_modules { |
| 364 | name: "core-system-modules", |
| 365 | libs: [ |
| 366 | "core-oj", |
| 367 | "core-libart", |
Neil Fuller | b669ccb | 2018-10-04 23:10:27 +0100 | [diff] [blame] | 368 | "bouncycastle", |
| 369 | "conscrypt", |
| 370 | "okhttp", |
Neil Fuller | 05723a5 | 2018-10-19 10:55:05 +0100 | [diff] [blame] | 371 | "apache-xml", |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 372 | // This one is not on device but it's needed when javac compiles code |
| 373 | // containing lambdas. |
Tobias Thierer | e0f8b31 | 2018-10-23 23:12:30 +0100 | [diff] [blame] | 374 | "core-lambda-stubs-for-system-modules", |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 375 | ], |
| 376 | } |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 377 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 378 | // Builds libcore test rules |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 379 | java_library_static { |
| 380 | name: "core-test-rules", |
| 381 | hostdex: true, |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 382 | srcs: [ |
| 383 | "dalvik/test-rules/src/main/**/*.java", |
| 384 | "test-rules/src/main/**/*.java", |
| 385 | ], |
| 386 | static_libs: ["junit"], |
Neil Fuller | 4207c7f | 2018-10-10 14:01:40 +0100 | [diff] [blame] | 387 | |
| 388 | no_standard_libs: true, |
| 389 | libs: ["core-all"], |
| 390 | system_modules: "core-all-system-modules", |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 391 | } |
| 392 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 393 | // Builds the core-tests-support library used by various tests. |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 394 | java_library_static { |
| 395 | name: "core-tests-support", |
| 396 | hostdex: true, |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 397 | srcs: ["support/src/test/java/**/*.java"], |
Neil Fuller | 4207c7f | 2018-10-10 14:01:40 +0100 | [diff] [blame] | 398 | |
Neil Fuller | 4380ab2 | 2018-10-18 19:38:53 +0100 | [diff] [blame] | 399 | no_framework_libs: true, |
| 400 | libs: ["junit"], |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 401 | static_libs: [ |
Neil Fuller | de8b086 | 2018-10-12 21:53:31 +0100 | [diff] [blame] | 402 | "bouncycastle-unbundled", |
| 403 | "bouncycastle-bcpkix-unbundled", |
| 404 | "bouncycastle-ocsp-unbundled", |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 405 | ], |
| 406 | } |
| 407 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 408 | // Builds the jsr166-tests library. |
Colin Cross | ec80f4f | 2018-08-15 21:17:11 -0700 | [diff] [blame] | 409 | java_test { |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 410 | name: "jsr166-tests", |
| 411 | srcs: ["jsr166-tests/src/test/java/**/*.java"], |
Neil Fuller | 4207c7f | 2018-10-10 14:01:40 +0100 | [diff] [blame] | 412 | no_standard_libs: true, |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 413 | libs: [ |
Neil Fuller | 4207c7f | 2018-10-10 14:01:40 +0100 | [diff] [blame] | 414 | "core-all", |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 415 | "junit", |
| 416 | ], |
Neil Fuller | 4207c7f | 2018-10-10 14:01:40 +0100 | [diff] [blame] | 417 | system_modules: "core-all-system-modules", |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 418 | } |
Nan Zhang | 65f27a3 | 2018-01-05 10:41:46 -0800 | [diff] [blame] | 419 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 420 | // Builds a library just containing files from luni/src/test/filesystems |
| 421 | // for use in tests. |
Colin Cross | ec80f4f | 2018-08-15 21:17:11 -0700 | [diff] [blame] | 422 | java_library { |
| 423 | name: "filesystemstest", |
| 424 | compile_dex: true, |
| 425 | srcs: ["luni/src/test/filesystems/src/**/*.java"], |
| 426 | java_resource_dirs: ["luni/src/test/filesystems/resources"], |
| 427 | no_framework_libs: true, |
| 428 | errorprone: { |
| 429 | javacflags: ["-Xep:MissingOverride:OFF"], |
| 430 | }, |
| 431 | } |
| 432 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 433 | // Builds a library just containing files from luni/src/test/parameter_metadata |
| 434 | // for use in tests. |
Colin Cross | ec80f4f | 2018-08-15 21:17:11 -0700 | [diff] [blame] | 435 | java_library { |
| 436 | name: "parameter-metadata-test", |
| 437 | compile_dex: true, |
| 438 | srcs: ["luni/src/test/parameter_metadata/src/**/*.java"], |
| 439 | no_framework_libs: true, |
| 440 | javacflags: ["-parameters"], |
| 441 | errorprone: { |
| 442 | javacflags: ["-Xep:MissingOverride:OFF"], |
| 443 | }, |
| 444 | } |
| 445 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 446 | // Builds the core-tests library. |
Colin Cross | ec80f4f | 2018-08-15 21:17:11 -0700 | [diff] [blame] | 447 | java_test { |
| 448 | name: "core-tests", |
| 449 | defaults: ["libcore_java_defaults"], |
| 450 | hostdex: true, |
| 451 | srcs: [ |
| 452 | "dalvik/src/test/java/**/*.java", |
| 453 | "dalvik/test-rules/src/test/java/**/*.java", |
| 454 | "dom/src/test/java/**/*.java", |
| 455 | "harmony-tests/src/test/java/**/*.java", |
| 456 | "json/src/test/java/**/*.java", |
| 457 | "luni/src/test/java/**/*.java", |
| 458 | "xml/src/test/java/**/*.java", |
| 459 | ], |
| 460 | exclude_srcs: [ |
| 461 | "luni/src/test/java/libcore/java/util/zip/Zip64Test.java", |
| 462 | "luni/src/test/java/libcore/java/util/zip/Zip64FileTest.java", |
| 463 | ], |
| 464 | |
| 465 | java_resource_dirs: [ |
| 466 | "*/src/test/java", |
| 467 | "*/src/test/resources", |
| 468 | ], |
| 469 | exclude_java_resource_dirs: [ |
| 470 | "ojluni/src/test/java", |
| 471 | "ojluni/src/test/resources", |
| 472 | ], |
| 473 | |
| 474 | java_resources: [ |
| 475 | ":filesystemstest", |
| 476 | ":parameter-metadata-test", |
| 477 | ], |
| 478 | |
Neil Fuller | 4207c7f | 2018-10-10 14:01:40 +0100 | [diff] [blame] | 479 | no_standard_libs: true, |
| 480 | libs: [ |
| 481 | "core-all", |
| 482 | "okhttp", |
| 483 | "bouncycastle", |
| 484 | ], |
| 485 | system_modules: "core-all-system-modules", |
| 486 | |
Colin Cross | ec80f4f | 2018-08-15 21:17:11 -0700 | [diff] [blame] | 487 | static_libs: [ |
| 488 | "archive-patcher", |
| 489 | "core-test-rules", |
| 490 | "core-tests-support", |
| 491 | "junit-params", |
| 492 | "mockftpserver", |
| 493 | "mockito-target", |
| 494 | "mockwebserver", |
| 495 | "nist-pkix-tests", |
| 496 | "slf4j-jdk14", |
| 497 | "sqlite-jdbc", |
| 498 | "tzdata-testing", |
Paul Duffin | a4df237 | 2018-12-10 15:48:01 +0000 | [diff] [blame] | 499 | "truth-prebuilt", |
Colin Cross | ec80f4f | 2018-08-15 21:17:11 -0700 | [diff] [blame] | 500 | ], |
| 501 | |
| 502 | errorprone: { |
| 503 | javacflags: [ |
| 504 | "-Xep:TryFailThrowable:ERROR", |
| 505 | "-Xep:ComparisonOutOfRange:ERROR", |
| 506 | ], |
| 507 | }, |
Simran Basi | 3be01e0 | 2018-08-21 17:53:49 -0700 | [diff] [blame] | 508 | |
| 509 | test_config: "AndroidTest-core-tests.xml", |
Colin Cross | ec80f4f | 2018-08-15 21:17:11 -0700 | [diff] [blame] | 510 | } |
| 511 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 512 | // Builds the core-ojtests library that contains test code from OpenJDK. |
Colin Cross | ec80f4f | 2018-08-15 21:17:11 -0700 | [diff] [blame] | 513 | java_test { |
| 514 | name: "core-ojtests", |
| 515 | defaults: ["libcore_java_defaults"], |
| 516 | hostdex: true, |
| 517 | |
| 518 | srcs: [ |
| 519 | "ojluni/src/test/java/**/*.java", |
| 520 | ], |
| 521 | java_resource_dirs: [ |
| 522 | "ojluni/src/test/java", |
| 523 | "ojluni/src/test/resources", |
| 524 | ], |
Neil Fuller | b669ccb | 2018-10-04 23:10:27 +0100 | [diff] [blame] | 525 | |
Neil Fuller | 4207c7f | 2018-10-10 14:01:40 +0100 | [diff] [blame] | 526 | no_standard_libs: true, |
| 527 | libs: [ |
| 528 | "core-all", |
| 529 | "okhttp", |
| 530 | "bouncycastle", |
| 531 | ], |
| 532 | system_modules: "core-all-system-modules", |
| 533 | |
Colin Cross | ec80f4f | 2018-08-15 21:17:11 -0700 | [diff] [blame] | 534 | static_libs: ["testng"], |
| 535 | |
| 536 | // ojluni/src/test/java/util/stream/{bootlib,boottest} |
| 537 | // contains tests that are in packages from java.base; |
| 538 | // By default, OpenJDK 9's javac will only compile such |
| 539 | // code if it's declared to also be in java.base at |
| 540 | // compile time. |
| 541 | // |
| 542 | // For now, we use --patch-module to put all sources |
| 543 | // and dependencies from this make target into java.base; |
| 544 | // other source directories in this make target are in |
| 545 | // packages not from java.base; if this becomes a problem |
| 546 | // in future, this could be addressed eg. by splitting |
| 547 | // boot{lib,test} out into a separate make target, |
| 548 | // deleting those tests or moving them to a different |
| 549 | // package. |
| 550 | patch_module: "java.base", |
| 551 | } |
| 552 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 553 | // Builds the core-ojtests-public library. Excludes any private API tests. |
| 554 | // Like core-ojtests but smaller. |
Colin Cross | ec80f4f | 2018-08-15 21:17:11 -0700 | [diff] [blame] | 555 | java_test { |
| 556 | name: "core-ojtests-public", |
| 557 | defaults: ["libcore_java_defaults"], |
| 558 | srcs: [ |
| 559 | "ojluni/src/test/java/**/*.java", |
| 560 | ], |
| 561 | // Filter out the following: |
| 562 | // 1.) DeserializeMethodTest and SerializedLambdaTest, because they depends on stub classes |
| 563 | // and won't actually run, and |
| 564 | // 2.) util/stream/boot*. Those directories contain classes in the package java.util.stream; |
| 565 | // excluding them means we don't need patch_module: "java.base" |
| 566 | exclude_srcs: [ |
| 567 | "**/DeserializeMethodTest.java", |
| 568 | "**/SerializedLambdaTest.java", |
| 569 | "ojluni/src/test/java/util/stream/boot*/**/*", |
| 570 | ], |
| 571 | java_resource_dirs: [ |
| 572 | "ojluni/src/test/java", |
| 573 | "ojluni/src/test/resources", |
| 574 | // Include source code as part of JAR |
| 575 | "ojluni/src/test/dist", |
| 576 | ], |
Neil Fuller | 4207c7f | 2018-10-10 14:01:40 +0100 | [diff] [blame] | 577 | |
| 578 | no_standard_libs: true, |
| 579 | libs: [ |
| 580 | "core-all", |
| 581 | "bouncycastle", |
| 582 | "okhttp", |
| 583 | "testng", |
| 584 | ], |
| 585 | system_modules: "core-all-system-modules", |
Colin Cross | ec80f4f | 2018-08-15 21:17:11 -0700 | [diff] [blame] | 586 | } |
| 587 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 588 | // Exports annotated stubs source files in ojluni/annotations/sdk to make them |
| 589 | // available to metalava. Used for nullability annotations in OpenJDK source. |
Pete Gillin | 7db7faa | 2018-07-31 13:29:35 +0100 | [diff] [blame] | 590 | droiddoc_exported_dir { |
Pete Gillin | 0728b74 | 2018-09-17 15:41:45 +0100 | [diff] [blame] | 591 | name: "ojluni-annotated-sdk-stubs", |
| 592 | path: "ojluni/annotations/sdk", |
Pete Gillin | 7db7faa | 2018-07-31 13:29:35 +0100 | [diff] [blame] | 593 | } |
Pete Gillin | 600c7cf | 2018-08-16 19:28:38 +0100 | [diff] [blame] | 594 | droiddoc_exported_dir { |
| 595 | name: "ojluni-annotated-nullability-stubs", |
| 596 | path: "ojluni/annotations/sdk/nullability", |
| 597 | } |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 598 | |
| 599 | // Exports annotated stubs source files in ojluni/annotations/mmodules to make |
| 600 | // them available to metalava. Used for core platform API and intra-code API |
| 601 | // annotations in OpenJDK source. |
Pete Gillin | c9935b6 | 2018-09-25 14:42:40 +0100 | [diff] [blame] | 602 | droiddoc_exported_dir { |
| 603 | name: "ojluni-annotated-mmodule-stubs", |
| 604 | path: "ojluni/annotations/mmodule", |
| 605 | } |
Pete Gillin | 7db7faa | 2018-07-31 13:29:35 +0100 | [diff] [blame] | 606 | |
Neil Fuller | 6f16b46 | 2018-09-04 15:40:39 +0100 | [diff] [blame] | 607 | // A file containing the list of tags that are "known" to us from the OpenJdk |
| 608 | // source code and so should not cause an error or warning. |
Nan Zhang | d55722b | 2018-02-27 15:08:20 -0800 | [diff] [blame] | 609 | filegroup { |
| 610 | name: "known-oj-tags", |
| 611 | srcs: [ |
| 612 | "known_oj_tags.txt", |
| 613 | ], |
| 614 | } |
Nan Zhang | 602fc0e | 2018-03-22 16:14:22 -0700 | [diff] [blame] | 615 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 616 | // Generates stubs for the parts of the public SDK API provided by the core |
| 617 | // library. |
Nan Zhang | f020760 | 2018-09-10 18:57:38 -0700 | [diff] [blame] | 618 | droidstubs { |
| 619 | name: "core-current-stubs-gen", |
Neil Fuller | 866ed4a | 2018-09-06 12:05:46 +0100 | [diff] [blame] | 620 | srcs: [":core_api_files"], |
Tobias Thierer | de99123 | 2018-03-07 15:10:46 +0000 | [diff] [blame] | 621 | java_version: "1.9", |
Nan Zhang | 602fc0e | 2018-03-22 16:14:22 -0700 | [diff] [blame] | 622 | installable: false, |
| 623 | no_framework_libs: true, |
Neil Fuller | be9258e | 2018-09-24 17:11:27 +0100 | [diff] [blame] | 624 | args: " --exclude-annotations " |
| 625 | + "--hide-annotation libcore.api.Hide", |
| 626 | merge_inclusion_annotations_dirs: ["ojluni-annotated-mmodule-stubs"], |
Nan Zhang | 602fc0e | 2018-03-22 16:14:22 -0700 | [diff] [blame] | 627 | } |
| 628 | |
Pete Gillin | 600c7cf | 2018-08-16 19:28:38 +0100 | [diff] [blame] | 629 | // Target for validating nullability annotations for correctness and |
| 630 | // completeness. To check that there are no nullability errors: |
| 631 | // make core-current-stubs-nullability-validation |
| 632 | // To check that there are only the expected nullability warnings: |
| 633 | // make core-current-stubs-nullability-validation-check-nullability-warnings |
| 634 | // To update the the list of known expected nullability warnings: |
| 635 | // make core-current-stubs-nullability-validation-update-nullability-warnings |
| 636 | droidstubs { |
| 637 | name: "core-current-stubs-nullability-validation", |
| 638 | srcs: [":core_api_files"], |
| 639 | installable: false, |
| 640 | no_framework_libs: true, |
| 641 | annotations_enabled: true, |
| 642 | args: "--hide-annotation libcore.api.Hide " + |
| 643 | "--validate-nullability-from-merged-stubs ", |
| 644 | merge_inclusion_annotations_dirs: ["ojluni-annotated-mmodule-stubs"], |
| 645 | merge_annotations_dirs: [ |
| 646 | "metalava-manual", |
| 647 | // N.B. Stubs in this filegroup will be validated: |
| 648 | "ojluni-annotated-nullability-stubs", |
| 649 | ], |
Pete Gillin | c5f179b | 2018-11-14 18:42:19 +0000 | [diff] [blame] | 650 | // The list of classes which have nullability annotations included in the source. |
| 651 | // (This is in addition to those which have annotations in the merged stubs.) |
| 652 | validate_nullability_from_list: "nullability_annotated_classes.txt", |
Pete Gillin | 600c7cf | 2018-08-16 19:28:38 +0100 | [diff] [blame] | 653 | // The expected set of warnings about missing annotations: |
| 654 | check_nullability_warnings: "nullability_warnings.txt", |
| 655 | } |
| 656 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 657 | // A stubs target containing the parts of the public SDK API provided by the |
| 658 | // core library. |
| 659 | // |
Neil Fuller | a6ba359 | 2018-09-21 13:19:37 +0100 | [diff] [blame] | 660 | // Don't use this directly, use "sdk_version: core_current". |
| 661 | java_library { |
Nan Zhang | 602fc0e | 2018-03-22 16:14:22 -0700 | [diff] [blame] | 662 | name: "core.current.stubs", |
Nan Zhang | f020760 | 2018-09-10 18:57:38 -0700 | [diff] [blame] | 663 | srcs: [":core-current-stubs-gen"], |
Nan Zhang | 602fc0e | 2018-03-22 16:14:22 -0700 | [diff] [blame] | 664 | errorprone: { |
| 665 | javacflags: [ |
| 666 | "-Xep:MissingOverride:OFF", |
| 667 | ], |
| 668 | }, |
Tobias Thierer | 496a938 | 2018-06-12 14:09:11 +0100 | [diff] [blame] | 669 | openjdk9: { |
| 670 | javacflags: ["--patch-module=java.base=."], |
| 671 | }, |
Nan Zhang | 602fc0e | 2018-03-22 16:14:22 -0700 | [diff] [blame] | 672 | no_standard_libs: true, |
| 673 | system_modules: "none", |
| 674 | } |
Neil Fuller | e784ef2 | 2018-11-16 15:54:30 +0000 | [diff] [blame] | 675 | |
| 676 | // A host library containing time zone related classes. Used for |
| 677 | // host-side tools and tests that have to deal with Android |
| 678 | // time zone data. |
| 679 | java_library_host { |
| 680 | name: "timezone-host", |
| 681 | srcs: [":timezone_host_files"], |
| 682 | } |