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