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, |
| 55 | |
| 56 | // For user / userdebug builds, strip the local variable table and the local variable |
| 57 | // type table. This has no bearing on stack traces, but will leave less information |
| 58 | // available via JDWP. |
| 59 | // |
| 60 | // TODO: Should this be conditioned on a PRODUCT_ flag or should we just turn this |
| 61 | // on for all builds. Also, name of the flag TBD. |
| 62 | // TODO(ccross): PRODUCT_MINIMIZE_JAVA_DEBUG_INFO |
| 63 | // local_javac_flags += ["-g:source,lines"] |
| 64 | } |
| 65 | |
| 66 | // |
| 67 | // Build for the target (device). |
| 68 | // |
| 69 | |
| 70 | java_library { |
| 71 | name: "core-all", |
| 72 | defaults: ["libcore_java_defaults"], |
| 73 | |
| 74 | srcs: [ |
| 75 | ":openjdk_java_files", |
| 76 | ":non_openjdk_java_files", |
| 77 | ":android_icu4j_src_files", |
| 78 | ":openjdk_lambda_stub_files", |
| 79 | ], |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 80 | openjdk9: { |
| 81 | srcs: ["luni/src/module/java/module-info.java"], |
| 82 | javacflags: ["--patch-module=java.base=."], |
| 83 | }, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 84 | java_resource_dirs: core_resource_dirs, |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 85 | java_resources: [":android_icu4j_resources"], |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 86 | |
| 87 | required: [ |
| 88 | "tzdata", |
| 89 | "tzlookup.xml", |
| 90 | ], |
| 91 | |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 92 | system_modules: "none", |
| 93 | |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 94 | installable: false, |
| 95 | } |
| 96 | |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 97 | java_system_modules { |
| 98 | name: "core-all-system-modules", |
| 99 | libs: ["core-all"], |
| 100 | } |
| 101 | |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 102 | java_library { |
| 103 | name: "core-oj", |
| 104 | defaults: ["libcore_java_defaults"], |
Colin Cross | bb180be | 2017-10-09 14:54:53 -0700 | [diff] [blame] | 105 | hostdex: true, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 106 | |
| 107 | srcs: [":openjdk_java_files"], |
| 108 | java_resource_dirs: core_resource_dirs, |
| 109 | libs: ["core-all"], |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 110 | system_modules: "core-all-system-modules", |
| 111 | openjdk9: { |
| 112 | javacflags: ["--patch-module=java.base=."], |
| 113 | }, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 114 | |
| 115 | notice: "ojluni/NOTICE", |
| 116 | |
| 117 | required: [ |
| 118 | "tzdata", |
| 119 | "tzlookup.xml", |
| 120 | ], |
Colin Cross | bb180be | 2017-10-09 14:54:53 -0700 | [diff] [blame] | 121 | |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 122 | } |
| 123 | |
| 124 | // Definitions to make the core library. |
| 125 | java_library { |
| 126 | name: "core-libart", |
| 127 | defaults: ["libcore_java_defaults"], |
Colin Cross | bb180be | 2017-10-09 14:54:53 -0700 | [diff] [blame] | 128 | hostdex: true, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 129 | |
| 130 | srcs: [ |
| 131 | ":non_openjdk_java_files", |
| 132 | ":android_icu4j_src_files", |
| 133 | ], |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 134 | java_resources: [":android_icu4j_resources"], |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 135 | |
| 136 | libs: ["core-all"], |
Colin Cross | a4d9fc4 | 2017-09-29 18:04:37 -0700 | [diff] [blame] | 137 | system_modules: "core-all-system-modules", |
| 138 | openjdk9: { |
| 139 | javacflags: ["--patch-module=java.base=."], |
| 140 | }, |
Colin Cross | af0b54c | 2017-09-27 17:22:32 -0700 | [diff] [blame] | 141 | |
| 142 | required: [ |
| 143 | "tzdata", |
| 144 | "tzlookup.xml", |
| 145 | ], |
| 146 | } |
| 147 | |
Colin Cross | 3c6c2e2 | 2017-10-18 13:24:52 -0700 | [diff] [blame] | 148 | // A guaranteed unstripped version of core-oj and core-libart. |
| 149 | // The build system may or may not strip the core-oj and core-libart jars, |
| 150 | // but these will not be stripped. See b/24535627. |
| 151 | java_library { |
| 152 | name: "core-oj-testdex", |
| 153 | static_libs: ["core-oj"], |
| 154 | no_standard_libs: true, |
| 155 | libs: ["core-all"], |
| 156 | system_modules: "core-all-system-modules", |
| 157 | dxflags: ["--core-library"], |
| 158 | dex_preopt: false, |
| 159 | notice: "ojluni/NOTICE", |
| 160 | required: [ |
| 161 | "tzdata", |
| 162 | "tzlookup.xml", |
| 163 | ], |
| 164 | } |
| 165 | |
| 166 | java_library { |
| 167 | name: "core-libart-testdex", |
| 168 | static_libs: ["core-libart"], |
| 169 | no_standard_libs: true, |
| 170 | libs: ["core-all"], |
| 171 | system_modules: "core-all-system-modules", |
| 172 | dxflags: ["--core-library"], |
| 173 | dex_preopt: false, |
| 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 | } |