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