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 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 301 | // Creates a jar that exists to satisfy javac when compiling source code that |
| 302 | // contains lambdas. |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 303 | java_library { |
| 304 | name: "core-lambda-stubs", |
| 305 | defaults: ["libcore_java_defaults"], |
Neil Fuller | 4207c7f | 2018-10-10 14:01:40 +0100 | [diff] [blame] | 306 | hostdex: true, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 307 | |
| 308 | srcs: [ |
| 309 | ":openjdk_lambda_stub_files", |
| 310 | ":openjdk_lambda_duplicate_stub_files", |
| 311 | ], |
| 312 | |
Colin Cross | ec80f4f | 2018-08-15 21:17:11 -0700 | [diff] [blame] | 313 | no_standard_libs: true, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 314 | libs: ["core-all"], |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 315 | system_modules: "core-all-system-modules", |
| 316 | openjdk9: { |
| 317 | javacflags: ["--patch-module=java.base=."], |
| 318 | }, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 319 | |
| 320 | notice: "ojluni/NOTICE", |
| 321 | |
| 322 | installable: false, |
| 323 | include_srcs: true, |
| 324 | } |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 325 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 326 | // A system modules definition containing the implementations for the various |
| 327 | // parts that make up the core library. |
| 328 | // |
| 329 | // This system module is intended for use by tests that may need access to |
| 330 | // core library internals. It should not be generally used; most of the |
| 331 | // platform build should build against API stubs instead. See |
| 332 | // "core-platform-api-stubs-system-modules", which is the default used by the |
| 333 | // Android build. |
| 334 | // |
| 335 | // This module also includes lambda stubs for compiling source containing |
| 336 | // Java lambdas. |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 337 | java_system_modules { |
| 338 | name: "core-system-modules", |
| 339 | libs: [ |
| 340 | "core-oj", |
| 341 | "core-libart", |
Neil Fuller | 866ed4a | 2018-09-06 12:05:46 +0100 | [diff] [blame] | 342 | "core-simple", |
Neil Fuller | b669ccb | 2018-10-04 23:10:27 +0100 | [diff] [blame] | 343 | "bouncycastle", |
| 344 | "conscrypt", |
| 345 | "okhttp", |
Neil Fuller | 05723a5 | 2018-10-19 10:55:05 +0100 | [diff] [blame^] | 346 | "apache-xml", |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 347 | // This one is not on device but it's needed when javac compiles code |
| 348 | // containing lambdas. |
| 349 | "core-lambda-stubs", |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 350 | ], |
| 351 | } |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 352 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 353 | // Builds libcore test rules |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 354 | java_library_static { |
| 355 | name: "core-test-rules", |
| 356 | hostdex: true, |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 357 | srcs: [ |
| 358 | "dalvik/test-rules/src/main/**/*.java", |
| 359 | "test-rules/src/main/**/*.java", |
| 360 | ], |
| 361 | static_libs: ["junit"], |
Neil Fuller | 4207c7f | 2018-10-10 14:01:40 +0100 | [diff] [blame] | 362 | |
| 363 | no_standard_libs: true, |
| 364 | libs: ["core-all"], |
| 365 | system_modules: "core-all-system-modules", |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 366 | } |
| 367 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 368 | // Builds the core-tests-support library used by various tests. |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 369 | java_library_static { |
| 370 | name: "core-tests-support", |
| 371 | hostdex: true, |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 372 | srcs: ["support/src/test/java/**/*.java"], |
Neil Fuller | 4207c7f | 2018-10-10 14:01:40 +0100 | [diff] [blame] | 373 | |
Neil Fuller | de8b086 | 2018-10-12 21:53:31 +0100 | [diff] [blame] | 374 | sdk_version: "core_platform_current", |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 375 | libs: [ |
| 376 | "junit", |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 377 | ], |
| 378 | static_libs: [ |
Neil Fuller | de8b086 | 2018-10-12 21:53:31 +0100 | [diff] [blame] | 379 | "bouncycastle-unbundled", |
| 380 | "bouncycastle-bcpkix-unbundled", |
| 381 | "bouncycastle-ocsp-unbundled", |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 382 | ], |
| 383 | } |
| 384 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 385 | // Builds the jsr166-tests library. |
Colin Cross | ec80f4f | 2018-08-15 21:17:11 -0700 | [diff] [blame] | 386 | java_test { |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 387 | name: "jsr166-tests", |
| 388 | srcs: ["jsr166-tests/src/test/java/**/*.java"], |
Neil Fuller | 4207c7f | 2018-10-10 14:01:40 +0100 | [diff] [blame] | 389 | no_standard_libs: true, |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 390 | libs: [ |
Neil Fuller | 4207c7f | 2018-10-10 14:01:40 +0100 | [diff] [blame] | 391 | "core-all", |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 392 | "junit", |
| 393 | ], |
Neil Fuller | 4207c7f | 2018-10-10 14:01:40 +0100 | [diff] [blame] | 394 | system_modules: "core-all-system-modules", |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 395 | } |
Nan Zhang | 65f27a3 | 2018-01-05 10:41:46 -0800 | [diff] [blame] | 396 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 397 | // Builds a library just containing files from luni/src/test/filesystems |
| 398 | // for use in tests. |
Colin Cross | ec80f4f | 2018-08-15 21:17:11 -0700 | [diff] [blame] | 399 | java_library { |
| 400 | name: "filesystemstest", |
| 401 | compile_dex: true, |
| 402 | srcs: ["luni/src/test/filesystems/src/**/*.java"], |
| 403 | java_resource_dirs: ["luni/src/test/filesystems/resources"], |
| 404 | no_framework_libs: true, |
| 405 | errorprone: { |
| 406 | javacflags: ["-Xep:MissingOverride:OFF"], |
| 407 | }, |
| 408 | } |
| 409 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 410 | // Builds a library just containing files from luni/src/test/parameter_metadata |
| 411 | // for use in tests. |
Colin Cross | ec80f4f | 2018-08-15 21:17:11 -0700 | [diff] [blame] | 412 | java_library { |
| 413 | name: "parameter-metadata-test", |
| 414 | compile_dex: true, |
| 415 | srcs: ["luni/src/test/parameter_metadata/src/**/*.java"], |
| 416 | no_framework_libs: true, |
| 417 | javacflags: ["-parameters"], |
| 418 | errorprone: { |
| 419 | javacflags: ["-Xep:MissingOverride:OFF"], |
| 420 | }, |
| 421 | } |
| 422 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 423 | // Builds the core-tests library. |
Colin Cross | ec80f4f | 2018-08-15 21:17:11 -0700 | [diff] [blame] | 424 | java_test { |
| 425 | name: "core-tests", |
| 426 | defaults: ["libcore_java_defaults"], |
| 427 | hostdex: true, |
| 428 | srcs: [ |
| 429 | "dalvik/src/test/java/**/*.java", |
| 430 | "dalvik/test-rules/src/test/java/**/*.java", |
| 431 | "dom/src/test/java/**/*.java", |
| 432 | "harmony-tests/src/test/java/**/*.java", |
| 433 | "json/src/test/java/**/*.java", |
| 434 | "luni/src/test/java/**/*.java", |
| 435 | "xml/src/test/java/**/*.java", |
| 436 | ], |
| 437 | exclude_srcs: [ |
| 438 | "luni/src/test/java/libcore/java/util/zip/Zip64Test.java", |
| 439 | "luni/src/test/java/libcore/java/util/zip/Zip64FileTest.java", |
| 440 | ], |
| 441 | |
| 442 | java_resource_dirs: [ |
| 443 | "*/src/test/java", |
| 444 | "*/src/test/resources", |
| 445 | ], |
| 446 | exclude_java_resource_dirs: [ |
| 447 | "ojluni/src/test/java", |
| 448 | "ojluni/src/test/resources", |
| 449 | ], |
| 450 | |
| 451 | java_resources: [ |
| 452 | ":filesystemstest", |
| 453 | ":parameter-metadata-test", |
| 454 | ], |
| 455 | |
Neil Fuller | 4207c7f | 2018-10-10 14:01:40 +0100 | [diff] [blame] | 456 | no_standard_libs: true, |
| 457 | libs: [ |
| 458 | "core-all", |
| 459 | "okhttp", |
| 460 | "bouncycastle", |
| 461 | ], |
| 462 | system_modules: "core-all-system-modules", |
| 463 | |
Colin Cross | ec80f4f | 2018-08-15 21:17:11 -0700 | [diff] [blame] | 464 | static_libs: [ |
| 465 | "archive-patcher", |
| 466 | "core-test-rules", |
| 467 | "core-tests-support", |
| 468 | "junit-params", |
| 469 | "mockftpserver", |
| 470 | "mockito-target", |
| 471 | "mockwebserver", |
| 472 | "nist-pkix-tests", |
| 473 | "slf4j-jdk14", |
| 474 | "sqlite-jdbc", |
| 475 | "tzdata-testing", |
| 476 | ], |
| 477 | |
| 478 | errorprone: { |
| 479 | javacflags: [ |
| 480 | "-Xep:TryFailThrowable:ERROR", |
| 481 | "-Xep:ComparisonOutOfRange:ERROR", |
| 482 | ], |
| 483 | }, |
Simran Basi | 3be01e0 | 2018-08-21 17:53:49 -0700 | [diff] [blame] | 484 | |
| 485 | test_config: "AndroidTest-core-tests.xml", |
Colin Cross | ec80f4f | 2018-08-15 21:17:11 -0700 | [diff] [blame] | 486 | } |
| 487 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 488 | // Builds the core-ojtests library that contains test code from OpenJDK. |
Colin Cross | ec80f4f | 2018-08-15 21:17:11 -0700 | [diff] [blame] | 489 | java_test { |
| 490 | name: "core-ojtests", |
| 491 | defaults: ["libcore_java_defaults"], |
| 492 | hostdex: true, |
| 493 | |
| 494 | srcs: [ |
| 495 | "ojluni/src/test/java/**/*.java", |
| 496 | ], |
| 497 | java_resource_dirs: [ |
| 498 | "ojluni/src/test/java", |
| 499 | "ojluni/src/test/resources", |
| 500 | ], |
Neil Fuller | b669ccb | 2018-10-04 23:10:27 +0100 | [diff] [blame] | 501 | |
Neil Fuller | 4207c7f | 2018-10-10 14:01:40 +0100 | [diff] [blame] | 502 | no_standard_libs: true, |
| 503 | libs: [ |
| 504 | "core-all", |
| 505 | "okhttp", |
| 506 | "bouncycastle", |
| 507 | ], |
| 508 | system_modules: "core-all-system-modules", |
| 509 | |
Colin Cross | ec80f4f | 2018-08-15 21:17:11 -0700 | [diff] [blame] | 510 | static_libs: ["testng"], |
| 511 | |
| 512 | // ojluni/src/test/java/util/stream/{bootlib,boottest} |
| 513 | // contains tests that are in packages from java.base; |
| 514 | // By default, OpenJDK 9's javac will only compile such |
| 515 | // code if it's declared to also be in java.base at |
| 516 | // compile time. |
| 517 | // |
| 518 | // For now, we use --patch-module to put all sources |
| 519 | // and dependencies from this make target into java.base; |
| 520 | // other source directories in this make target are in |
| 521 | // packages not from java.base; if this becomes a problem |
| 522 | // in future, this could be addressed eg. by splitting |
| 523 | // boot{lib,test} out into a separate make target, |
| 524 | // deleting those tests or moving them to a different |
| 525 | // package. |
| 526 | patch_module: "java.base", |
| 527 | } |
| 528 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 529 | // Builds the core-ojtests-public library. Excludes any private API tests. |
| 530 | // Like core-ojtests but smaller. |
Colin Cross | ec80f4f | 2018-08-15 21:17:11 -0700 | [diff] [blame] | 531 | java_test { |
| 532 | name: "core-ojtests-public", |
| 533 | defaults: ["libcore_java_defaults"], |
| 534 | srcs: [ |
| 535 | "ojluni/src/test/java/**/*.java", |
| 536 | ], |
| 537 | // Filter out the following: |
| 538 | // 1.) DeserializeMethodTest and SerializedLambdaTest, because they depends on stub classes |
| 539 | // and won't actually run, and |
| 540 | // 2.) util/stream/boot*. Those directories contain classes in the package java.util.stream; |
| 541 | // excluding them means we don't need patch_module: "java.base" |
| 542 | exclude_srcs: [ |
| 543 | "**/DeserializeMethodTest.java", |
| 544 | "**/SerializedLambdaTest.java", |
| 545 | "ojluni/src/test/java/util/stream/boot*/**/*", |
| 546 | ], |
| 547 | java_resource_dirs: [ |
| 548 | "ojluni/src/test/java", |
| 549 | "ojluni/src/test/resources", |
| 550 | // Include source code as part of JAR |
| 551 | "ojluni/src/test/dist", |
| 552 | ], |
Neil Fuller | 4207c7f | 2018-10-10 14:01:40 +0100 | [diff] [blame] | 553 | |
| 554 | no_standard_libs: true, |
| 555 | libs: [ |
| 556 | "core-all", |
| 557 | "bouncycastle", |
| 558 | "okhttp", |
| 559 | "testng", |
| 560 | ], |
| 561 | system_modules: "core-all-system-modules", |
Colin Cross | ec80f4f | 2018-08-15 21:17:11 -0700 | [diff] [blame] | 562 | } |
| 563 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 564 | // Exports annotated stubs source files in ojluni/annotations/sdk to make them |
| 565 | // available to metalava. Used for nullability annotations in OpenJDK source. |
Pete Gillin | 7db7faa | 2018-07-31 13:29:35 +0100 | [diff] [blame] | 566 | droiddoc_exported_dir { |
Pete Gillin | 0728b74 | 2018-09-17 15:41:45 +0100 | [diff] [blame] | 567 | name: "ojluni-annotated-sdk-stubs", |
| 568 | path: "ojluni/annotations/sdk", |
Pete Gillin | 7db7faa | 2018-07-31 13:29:35 +0100 | [diff] [blame] | 569 | } |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 570 | |
| 571 | // Exports annotated stubs source files in ojluni/annotations/mmodules to make |
| 572 | // them available to metalava. Used for core platform API and intra-code API |
| 573 | // annotations in OpenJDK source. |
Pete Gillin | c9935b6 | 2018-09-25 14:42:40 +0100 | [diff] [blame] | 574 | droiddoc_exported_dir { |
| 575 | name: "ojluni-annotated-mmodule-stubs", |
| 576 | path: "ojluni/annotations/mmodule", |
| 577 | } |
Pete Gillin | 7db7faa | 2018-07-31 13:29:35 +0100 | [diff] [blame] | 578 | |
Neil Fuller | 6f16b46 | 2018-09-04 15:40:39 +0100 | [diff] [blame] | 579 | // A file containing the list of tags that are "known" to us from the OpenJdk |
| 580 | // source code and so should not cause an error or warning. |
Nan Zhang | d55722b | 2018-02-27 15:08:20 -0800 | [diff] [blame] | 581 | filegroup { |
| 582 | name: "known-oj-tags", |
| 583 | srcs: [ |
| 584 | "known_oj_tags.txt", |
| 585 | ], |
| 586 | } |
Nan Zhang | 602fc0e | 2018-03-22 16:14:22 -0700 | [diff] [blame] | 587 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 588 | // Generates stubs for the parts of the public SDK API provided by the core |
| 589 | // library. |
Nan Zhang | f020760 | 2018-09-10 18:57:38 -0700 | [diff] [blame] | 590 | droidstubs { |
| 591 | name: "core-current-stubs-gen", |
Neil Fuller | 866ed4a | 2018-09-06 12:05:46 +0100 | [diff] [blame] | 592 | srcs: [":core_api_files"], |
Nan Zhang | 602fc0e | 2018-03-22 16:14:22 -0700 | [diff] [blame] | 593 | installable: false, |
| 594 | no_framework_libs: true, |
Neil Fuller | be9258e | 2018-09-24 17:11:27 +0100 | [diff] [blame] | 595 | args: " --exclude-annotations " |
| 596 | + "--hide-annotation libcore.api.Hide", |
| 597 | merge_inclusion_annotations_dirs: ["ojluni-annotated-mmodule-stubs"], |
Nan Zhang | 602fc0e | 2018-03-22 16:14:22 -0700 | [diff] [blame] | 598 | } |
| 599 | |
Neil Fuller | 77e3f3b | 2018-10-19 10:22:32 +0100 | [diff] [blame] | 600 | // A stubs target containing the parts of the public SDK API provided by the |
| 601 | // core library. |
| 602 | // |
Neil Fuller | a6ba359 | 2018-09-21 13:19:37 +0100 | [diff] [blame] | 603 | // Don't use this directly, use "sdk_version: core_current". |
| 604 | java_library { |
Nan Zhang | 602fc0e | 2018-03-22 16:14:22 -0700 | [diff] [blame] | 605 | name: "core.current.stubs", |
Nan Zhang | f020760 | 2018-09-10 18:57:38 -0700 | [diff] [blame] | 606 | srcs: [":core-current-stubs-gen"], |
Nan Zhang | 602fc0e | 2018-03-22 16:14:22 -0700 | [diff] [blame] | 607 | errorprone: { |
| 608 | javacflags: [ |
| 609 | "-Xep:MissingOverride:OFF", |
| 610 | ], |
| 611 | }, |
Tobias Thierer | 496a938 | 2018-06-12 14:09:11 +0100 | [diff] [blame] | 612 | openjdk9: { |
| 613 | javacflags: ["--patch-module=java.base=."], |
| 614 | }, |
Nan Zhang | 602fc0e | 2018-03-22 16:14:22 -0700 | [diff] [blame] | 615 | no_standard_libs: true, |
| 616 | system_modules: "none", |
| 617 | } |