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 | |
| 19 | // libcore is divided into modules. |
| 20 | // |
| 21 | // The structure of each module is: |
| 22 | // |
| 23 | // src/ |
| 24 | // main/ # To be shipped on every device. |
| 25 | // java/ # Java source for library code. |
| 26 | // native/ # C++ source for library code. |
| 27 | // resources/ # Support files. |
| 28 | // test/ # Built only on demand, for testing. |
| 29 | // java/ # Java source for tests. |
| 30 | // native/ # C++ source for tests (rare). |
| 31 | // resources/ # Support files. |
| 32 | // |
| 33 | // All subdirectories are optional |
| 34 | |
| 35 | build = [ |
| 36 | "openjdk_java_files.bp", |
| 37 | "non_openjdk_java_files.bp", |
Colin Cross | fb7218e | 2017-10-27 17:50:42 +0000 | [diff] [blame] | 38 | "annotated_java_files.bp", |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 39 | ] |
| 40 | |
| 41 | // The Java files and their associated resources. |
| 42 | core_resource_dirs = [ |
| 43 | "luni/src/main/java", |
| 44 | "ojluni/src/main/resources/", |
| 45 | ] |
| 46 | |
| 47 | java_defaults { |
| 48 | name: "libcore_java_defaults", |
| 49 | javacflags: [ |
| 50 | //"-Xlint:all", |
| 51 | //"-Xlint:-serial,-deprecation,-unchecked", |
| 52 | ], |
| 53 | dxflags: ["--core-library"], |
| 54 | no_standard_libs: true, |
Andreas Gampe | 66b3173 | 2018-02-20 09:22:16 -0800 | [diff] [blame] | 55 | errorprone: { |
| 56 | javacflags: [ |
| 57 | "-Xep:MissingOverride:OFF", // Ignore missing @Override. |
Andreas Gampe | 24a2017 | 2018-06-13 11:28:45 -0700 | [diff] [blame^] | 58 | "-Xep:ConstantOverflow:WARN", // Known constant overflow in SplittableRandom |
Andreas Gampe | 66b3173 | 2018-02-20 09:22:16 -0800 | [diff] [blame] | 59 | ], |
| 60 | }, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 61 | } |
| 62 | |
| 63 | // |
| 64 | // Build for the target (device). |
| 65 | // |
| 66 | |
| 67 | java_library { |
| 68 | name: "core-all", |
| 69 | defaults: ["libcore_java_defaults"], |
| 70 | |
| 71 | srcs: [ |
| 72 | ":openjdk_java_files", |
| 73 | ":non_openjdk_java_files", |
| 74 | ":android_icu4j_src_files", |
| 75 | ":openjdk_lambda_stub_files", |
| 76 | ], |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 77 | openjdk9: { |
| 78 | srcs: ["luni/src/module/java/module-info.java"], |
| 79 | javacflags: ["--patch-module=java.base=."], |
| 80 | }, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 81 | java_resource_dirs: core_resource_dirs, |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 82 | java_resources: [":android_icu4j_resources"], |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 83 | |
| 84 | required: [ |
| 85 | "tzdata", |
| 86 | "tzlookup.xml", |
| 87 | ], |
| 88 | |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 89 | system_modules: "none", |
| 90 | |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 91 | installable: false, |
| 92 | } |
| 93 | |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 94 | java_system_modules { |
| 95 | name: "core-all-system-modules", |
| 96 | libs: ["core-all"], |
| 97 | } |
| 98 | |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 99 | java_library { |
| 100 | name: "core-oj", |
| 101 | defaults: ["libcore_java_defaults"], |
Colin Cross | bb180be | 2017-10-09 14:54:53 -0700 | [diff] [blame] | 102 | hostdex: true, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 103 | |
| 104 | srcs: [":openjdk_java_files"], |
| 105 | java_resource_dirs: core_resource_dirs, |
| 106 | libs: ["core-all"], |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 107 | system_modules: "core-all-system-modules", |
| 108 | openjdk9: { |
| 109 | javacflags: ["--patch-module=java.base=."], |
| 110 | }, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 111 | |
| 112 | notice: "ojluni/NOTICE", |
| 113 | |
| 114 | required: [ |
| 115 | "tzdata", |
| 116 | "tzlookup.xml", |
| 117 | ], |
Colin Cross | bb180be | 2017-10-09 14:54:53 -0700 | [diff] [blame] | 118 | |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 119 | } |
| 120 | |
| 121 | // Definitions to make the core library. |
| 122 | java_library { |
| 123 | name: "core-libart", |
| 124 | defaults: ["libcore_java_defaults"], |
Colin Cross | bb180be | 2017-10-09 14:54:53 -0700 | [diff] [blame] | 125 | hostdex: true, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 126 | |
| 127 | srcs: [ |
| 128 | ":non_openjdk_java_files", |
| 129 | ":android_icu4j_src_files", |
| 130 | ], |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 131 | java_resources: [":android_icu4j_resources"], |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 132 | |
| 133 | libs: ["core-all"], |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 134 | system_modules: "core-all-system-modules", |
| 135 | openjdk9: { |
| 136 | javacflags: ["--patch-module=java.base=."], |
| 137 | }, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 138 | |
| 139 | required: [ |
| 140 | "tzdata", |
| 141 | "tzlookup.xml", |
| 142 | ], |
| 143 | } |
| 144 | |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 145 | // A guaranteed unstripped version of core-oj and core-libart. |
| 146 | // The build system may or may not strip the core-oj and core-libart jars, |
| 147 | // but these will not be stripped. See b/24535627. |
| 148 | java_library { |
| 149 | name: "core-oj-testdex", |
| 150 | static_libs: ["core-oj"], |
| 151 | no_standard_libs: true, |
| 152 | libs: ["core-all"], |
| 153 | system_modules: "core-all-system-modules", |
| 154 | dxflags: ["--core-library"], |
Colin Cross | 485ed36 | 2017-12-05 17:24:22 -0800 | [diff] [blame] | 155 | dex_preopt: { |
| 156 | enabled: false, |
| 157 | }, |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 158 | notice: "ojluni/NOTICE", |
| 159 | required: [ |
| 160 | "tzdata", |
| 161 | "tzlookup.xml", |
| 162 | ], |
| 163 | } |
| 164 | |
| 165 | java_library { |
| 166 | name: "core-libart-testdex", |
| 167 | static_libs: ["core-libart"], |
| 168 | no_standard_libs: true, |
| 169 | libs: ["core-all"], |
| 170 | system_modules: "core-all-system-modules", |
| 171 | dxflags: ["--core-library"], |
Colin Cross | 485ed36 | 2017-12-05 17:24:22 -0800 | [diff] [blame] | 172 | dex_preopt: { |
| 173 | enabled: false, |
| 174 | }, |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 175 | notice: "ojluni/NOTICE", |
| 176 | required: [ |
| 177 | "tzdata", |
| 178 | "tzlookup.xml", |
| 179 | ], |
| 180 | } |
| 181 | |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 182 | // A library that exists to satisfy javac when |
| 183 | // compiling source code that contains lambdas. |
| 184 | java_library { |
| 185 | name: "core-lambda-stubs", |
| 186 | defaults: ["libcore_java_defaults"], |
| 187 | |
| 188 | srcs: [ |
| 189 | ":openjdk_lambda_stub_files", |
| 190 | ":openjdk_lambda_duplicate_stub_files", |
| 191 | ], |
| 192 | |
| 193 | libs: ["core-all"], |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 194 | system_modules: "core-all-system-modules", |
| 195 | openjdk9: { |
| 196 | javacflags: ["--patch-module=java.base=."], |
| 197 | }, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 198 | |
| 199 | notice: "ojluni/NOTICE", |
| 200 | |
| 201 | installable: false, |
| 202 | include_srcs: true, |
| 203 | } |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 204 | |
| 205 | java_system_modules { |
| 206 | name: "core-system-modules", |
| 207 | libs: [ |
| 208 | "core-oj", |
| 209 | "core-libart", |
| 210 | "core-lambda-stubs", |
| 211 | ], |
| 212 | } |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 213 | |
| 214 | // Build libcore test rules |
| 215 | java_library_static { |
| 216 | name: "core-test-rules", |
| 217 | hostdex: true, |
| 218 | no_framework_libs: true, |
| 219 | srcs: [ |
| 220 | "dalvik/test-rules/src/main/**/*.java", |
| 221 | "test-rules/src/main/**/*.java", |
| 222 | ], |
| 223 | static_libs: ["junit"], |
| 224 | } |
| 225 | |
| 226 | // Make the core-tests-support library. |
| 227 | java_library_static { |
| 228 | name: "core-tests-support", |
| 229 | hostdex: true, |
| 230 | no_framework_libs: true, |
| 231 | srcs: ["support/src/test/java/**/*.java"], |
| 232 | libs: [ |
| 233 | "junit", |
| 234 | "bouncycastle", |
| 235 | ], |
| 236 | static_libs: [ |
| 237 | "bouncycastle-bcpkix", |
| 238 | "bouncycastle-ocsp", |
| 239 | ], |
| 240 | } |
| 241 | |
| 242 | // Make the jsr166-tests library. |
| 243 | java_library_static { |
| 244 | name: "jsr166-tests", |
| 245 | srcs: ["jsr166-tests/src/test/java/**/*.java"], |
| 246 | no_framework_libs: true, |
| 247 | libs: [ |
| 248 | "junit", |
| 249 | ], |
| 250 | } |
Nan Zhang | 65f27a3 | 2018-01-05 10:41:46 -0800 | [diff] [blame] | 251 | |
| 252 | genrule { |
| 253 | name: "gen-ojluni-jaif-annotated-srcs", |
| 254 | tools: [ |
| 255 | "gen-annotated-java-files-bp", |
| 256 | "soong_zip", |
| 257 | ], |
| 258 | tool_files: [ |
| 259 | ":insert-annotations-to-source", |
| 260 | "annotations/ojluni.jaif", |
| 261 | ], |
| 262 | srcs: [ |
| 263 | ":annotated_ojluni_files", |
| 264 | ], |
| 265 | cmd: "($(location gen-annotated-java-files-bp) $(location annotations/ojluni.jaif) > $(genDir)/annotated_java_files.bp.tmp) && " + |
Nan Zhang | 8c56144 | 2018-02-27 17:21:49 -0800 | [diff] [blame] | 266 | "(diff -u `pwd`/libcore/annotated_java_files.bp $(genDir)/annotated_java_files.bp.tmp || " + |
Nan Zhang | 65f27a3 | 2018-01-05 10:41:46 -0800 | [diff] [blame] | 267 | "(echo -e \"********************\" >&2; " + |
| 268 | " echo -e \"annotated_java_files.bp needs regenerating. Please run:\" >&2; " + |
| 269 | " echo -e \"libcore/annotations/generate_annotated_java_files.py libcore/annotations/ojluni.jaif > libcore/annotated_java_files.bp\" >&2; " + |
Nan Zhang | 8c56144 | 2018-02-27 17:21:49 -0800 | [diff] [blame] | 270 | " echo -e \"********************\" >&2; exit 1) ) && " + |
Nan Zhang | 65f27a3 | 2018-01-05 10:41:46 -0800 | [diff] [blame] | 271 | "(rm $(genDir)/annotated_java_files.bp.tmp) && " + |
Nan Zhang | 8c56144 | 2018-02-27 17:21:49 -0800 | [diff] [blame] | 272 | "(external/annotation-tools/annotation-file-utilities/scripts/insert-annotations-to-source -d $(genDir) $(location annotations/ojluni.jaif) $(in)) && " + |
Nan Zhang | 65f27a3 | 2018-01-05 10:41:46 -0800 | [diff] [blame] | 273 | "($(location soong_zip) -o $(out) -C $(genDir) -D $(genDir))", |
| 274 | out: [ |
| 275 | "ojluni_jaif_annotated_srcs.srcjar", |
| 276 | ], |
| 277 | } |
| 278 | |
Nan Zhang | 3824a82 | 2018-03-21 21:41:02 +0000 | [diff] [blame] | 279 | // |
| 280 | // Local droiddoc for faster libcore testing |
| 281 | // |
| 282 | // Run with: |
| 283 | // mm -j32 core-docs |
| 284 | // |
| 285 | // Main output: |
| 286 | // ../out/soong/.intermediates/libcore/core-docs/android_common/docs/out/reference/packages.html |
| 287 | // |
| 288 | // All text for proofreading (or running tools over): |
| 289 | // ../out/soong/.intermediates/libcore/core-docs/android_common/core-docs-proofread.txt |
| 290 | // |
| 291 | // TODO list of missing javadoc, etc: |
| 292 | // ../out/soong/.intermediates/libcore/core-docs/android_common/docs/out/core-docs-todo.html |
| 293 | // |
Nan Zhang | 65f27a3 | 2018-01-05 10:41:46 -0800 | [diff] [blame] | 294 | droiddoc { |
| 295 | name: "core-docs", |
| 296 | srcs: [ |
| 297 | ":openjdk_javadoc_files", |
| 298 | ":non_openjdk_javadoc_files", |
| 299 | ":android_icu4j_src_files_for_docs", |
| 300 | ":gen-ojluni-jaif-annotated-srcs", |
| 301 | ], |
| 302 | exclude_srcs: [ |
| 303 | ":annotated_ojluni_files", |
| 304 | ], |
Dan Willemsen | f2b0458 | 2018-02-26 14:36:32 -0800 | [diff] [blame] | 305 | custom_template: "droiddoc-templates-sdk", |
Nan Zhang | 65f27a3 | 2018-01-05 10:41:46 -0800 | [diff] [blame] | 306 | hdf: [ |
| 307 | "android.whichdoc offline", |
| 308 | ], |
| 309 | knowntags: [ |
| 310 | "known_oj_tags.txt", |
| 311 | ], |
| 312 | proofread_file: "core-docs-proofread.txt", |
| 313 | todo_file: "core-docs-todo.html", |
| 314 | args: "-offlinemode -title \"libcore\"", |
| 315 | } |
Nan Zhang | d55722b | 2018-02-27 15:08:20 -0800 | [diff] [blame] | 316 | |
| 317 | filegroup { |
| 318 | name: "known-oj-tags", |
| 319 | srcs: [ |
| 320 | "known_oj_tags.txt", |
| 321 | ], |
| 322 | } |
Nan Zhang | 602fc0e | 2018-03-22 16:14:22 -0700 | [diff] [blame] | 323 | |
| 324 | droiddoc { |
| 325 | name: "core-current-stubs-gen-docs", |
| 326 | srcs: [ |
| 327 | ":openjdk_javadoc_files", |
| 328 | ":non_openjdk_javadoc_files", |
| 329 | ":android_icu4j_src_files_for_docs", |
| 330 | ":gen-ojluni-jaif-annotated-srcs", |
| 331 | ], |
| 332 | exclude_srcs: [ |
| 333 | ":annotated_ojluni_files", |
| 334 | ], |
| 335 | custom_template: "droiddoc-templates-sdk", |
| 336 | installable: false, |
| 337 | no_framework_libs: true, |
| 338 | args: "-nodocs", |
| 339 | } |
| 340 | |
| 341 | java_library_static { |
| 342 | name: "core.current.stubs", |
| 343 | srcs: [ |
| 344 | ":core-current-stubs-gen-docs", |
| 345 | ], |
| 346 | errorprone: { |
| 347 | javacflags: [ |
| 348 | "-Xep:MissingOverride:OFF", |
| 349 | ], |
| 350 | }, |
| 351 | no_standard_libs: true, |
| 352 | system_modules: "none", |
| 353 | } |