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, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 55 | } |
| 56 | |
| 57 | // |
| 58 | // Build for the target (device). |
| 59 | // |
| 60 | |
| 61 | java_library { |
| 62 | name: "core-all", |
| 63 | defaults: ["libcore_java_defaults"], |
| 64 | |
| 65 | srcs: [ |
| 66 | ":openjdk_java_files", |
| 67 | ":non_openjdk_java_files", |
| 68 | ":android_icu4j_src_files", |
| 69 | ":openjdk_lambda_stub_files", |
| 70 | ], |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 71 | openjdk9: { |
| 72 | srcs: ["luni/src/module/java/module-info.java"], |
| 73 | javacflags: ["--patch-module=java.base=."], |
| 74 | }, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 75 | java_resource_dirs: core_resource_dirs, |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 76 | java_resources: [":android_icu4j_resources"], |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 77 | |
| 78 | required: [ |
| 79 | "tzdata", |
| 80 | "tzlookup.xml", |
| 81 | ], |
| 82 | |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 83 | system_modules: "none", |
| 84 | |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 85 | installable: false, |
| 86 | } |
| 87 | |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 88 | java_system_modules { |
| 89 | name: "core-all-system-modules", |
| 90 | libs: ["core-all"], |
| 91 | } |
| 92 | |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 93 | java_library { |
| 94 | name: "core-oj", |
| 95 | defaults: ["libcore_java_defaults"], |
Colin Cross | bb180be | 2017-10-09 14:54:53 -0700 | [diff] [blame] | 96 | hostdex: true, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 97 | |
| 98 | srcs: [":openjdk_java_files"], |
| 99 | java_resource_dirs: core_resource_dirs, |
| 100 | libs: ["core-all"], |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 101 | system_modules: "core-all-system-modules", |
| 102 | openjdk9: { |
| 103 | javacflags: ["--patch-module=java.base=."], |
| 104 | }, |
Pete Gillin | 7a7a6d2 | 2017-12-19 14:56:03 +0000 | [diff] [blame] | 105 | jacoco: { |
Pete Gillin | 27ca058 | 2018-01-10 17:04:17 +0000 | [diff] [blame] | 106 | exclude_filter: [ |
Pete Gillin | 3f59bad | 2018-01-30 11:20:29 +0000 | [diff] [blame^] | 107 | "java.lang.Class", |
| 108 | "java.lang.Long", |
| 109 | "java.lang.Number", |
| 110 | "java.lang.Object", |
| 111 | "java.lang.String", |
| 112 | "java.lang.invoke.MethodHandle", |
| 113 | "java.lang.ref.Reference", |
| 114 | "java.lang.reflect.Proxy", |
Pete Gillin | b1868ada | 2018-01-17 11:03:10 +0000 | [diff] [blame] | 115 | "java.util.AbstractMap", |
Pete Gillin | 3f59bad | 2018-01-30 11:20:29 +0000 | [diff] [blame^] | 116 | "java.util.HashMap", |
| 117 | "java.util.HashMap$Node", |
Pete Gillin | b1868ada | 2018-01-17 11:03:10 +0000 | [diff] [blame] | 118 | "java.util.Map", |
Pete Gillin | 7a7a6d2 | 2017-12-19 14:56:03 +0000 | [diff] [blame] | 119 | ], |
| 120 | }, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 121 | |
| 122 | notice: "ojluni/NOTICE", |
| 123 | |
| 124 | required: [ |
| 125 | "tzdata", |
| 126 | "tzlookup.xml", |
| 127 | ], |
Colin Cross | bb180be | 2017-10-09 14:54:53 -0700 | [diff] [blame] | 128 | |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 129 | } |
| 130 | |
| 131 | // Definitions to make the core library. |
| 132 | java_library { |
| 133 | name: "core-libart", |
| 134 | defaults: ["libcore_java_defaults"], |
Colin Cross | bb180be | 2017-10-09 14:54:53 -0700 | [diff] [blame] | 135 | hostdex: true, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 136 | |
| 137 | srcs: [ |
| 138 | ":non_openjdk_java_files", |
| 139 | ":android_icu4j_src_files", |
| 140 | ], |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 141 | java_resources: [":android_icu4j_resources"], |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 142 | |
| 143 | libs: ["core-all"], |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 144 | system_modules: "core-all-system-modules", |
| 145 | openjdk9: { |
| 146 | javacflags: ["--patch-module=java.base=."], |
| 147 | }, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 148 | |
| 149 | required: [ |
| 150 | "tzdata", |
| 151 | "tzlookup.xml", |
| 152 | ], |
| 153 | } |
| 154 | |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 155 | // A guaranteed unstripped version of core-oj and core-libart. |
| 156 | // The build system may or may not strip the core-oj and core-libart jars, |
| 157 | // but these will not be stripped. See b/24535627. |
| 158 | java_library { |
| 159 | name: "core-oj-testdex", |
| 160 | static_libs: ["core-oj"], |
| 161 | no_standard_libs: true, |
| 162 | libs: ["core-all"], |
| 163 | system_modules: "core-all-system-modules", |
| 164 | dxflags: ["--core-library"], |
Colin Cross | 485ed36 | 2017-12-05 17:24:22 -0800 | [diff] [blame] | 165 | dex_preopt: { |
| 166 | enabled: false, |
| 167 | }, |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 168 | notice: "ojluni/NOTICE", |
| 169 | required: [ |
| 170 | "tzdata", |
| 171 | "tzlookup.xml", |
| 172 | ], |
| 173 | } |
| 174 | |
| 175 | java_library { |
| 176 | name: "core-libart-testdex", |
| 177 | static_libs: ["core-libart"], |
| 178 | no_standard_libs: true, |
| 179 | libs: ["core-all"], |
| 180 | system_modules: "core-all-system-modules", |
| 181 | dxflags: ["--core-library"], |
Colin Cross | 485ed36 | 2017-12-05 17:24:22 -0800 | [diff] [blame] | 182 | dex_preopt: { |
| 183 | enabled: false, |
| 184 | }, |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 185 | notice: "ojluni/NOTICE", |
| 186 | required: [ |
| 187 | "tzdata", |
| 188 | "tzlookup.xml", |
| 189 | ], |
| 190 | } |
| 191 | |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 192 | // A library that exists to satisfy javac when |
| 193 | // compiling source code that contains lambdas. |
| 194 | java_library { |
| 195 | name: "core-lambda-stubs", |
| 196 | defaults: ["libcore_java_defaults"], |
| 197 | |
| 198 | srcs: [ |
| 199 | ":openjdk_lambda_stub_files", |
| 200 | ":openjdk_lambda_duplicate_stub_files", |
| 201 | ], |
| 202 | |
| 203 | libs: ["core-all"], |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 204 | system_modules: "core-all-system-modules", |
| 205 | openjdk9: { |
| 206 | javacflags: ["--patch-module=java.base=."], |
| 207 | }, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 208 | |
| 209 | notice: "ojluni/NOTICE", |
| 210 | |
| 211 | installable: false, |
| 212 | include_srcs: true, |
| 213 | } |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 214 | |
| 215 | java_system_modules { |
| 216 | name: "core-system-modules", |
| 217 | libs: [ |
| 218 | "core-oj", |
| 219 | "core-libart", |
| 220 | "core-lambda-stubs", |
| 221 | ], |
| 222 | } |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 223 | |
| 224 | // Build libcore test rules |
| 225 | java_library_static { |
| 226 | name: "core-test-rules", |
| 227 | hostdex: true, |
| 228 | no_framework_libs: true, |
| 229 | srcs: [ |
| 230 | "dalvik/test-rules/src/main/**/*.java", |
| 231 | "test-rules/src/main/**/*.java", |
| 232 | ], |
| 233 | static_libs: ["junit"], |
| 234 | } |
| 235 | |
| 236 | // Make the core-tests-support library. |
| 237 | java_library_static { |
| 238 | name: "core-tests-support", |
| 239 | hostdex: true, |
| 240 | no_framework_libs: true, |
| 241 | srcs: ["support/src/test/java/**/*.java"], |
| 242 | libs: [ |
| 243 | "junit", |
| 244 | "bouncycastle", |
| 245 | ], |
| 246 | static_libs: [ |
| 247 | "bouncycastle-bcpkix", |
| 248 | "bouncycastle-ocsp", |
| 249 | ], |
| 250 | } |
| 251 | |
| 252 | // Make the jsr166-tests library. |
| 253 | java_library_static { |
| 254 | name: "jsr166-tests", |
| 255 | srcs: ["jsr166-tests/src/test/java/**/*.java"], |
| 256 | no_framework_libs: true, |
| 257 | libs: [ |
| 258 | "junit", |
| 259 | ], |
| 260 | } |