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