John Wu | 2abff41 | 2024-10-10 21:58:26 +0000 | [diff] [blame] | 1 | // Copyright (C) 2024 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 | // This file hosts all the genrule and module definitions for all Android specific |
| 16 | // code that needs further post-processing by hoststubgen to support Ravenwood. |
| 17 | |
| 18 | ///////////////////////// |
| 19 | // framework-minus-apex |
| 20 | ///////////////////////// |
| 21 | |
| 22 | // Process framework-minus-apex with hoststubgen for Ravenwood. |
| 23 | // This step takes several tens of seconds, so we manually shard it to multiple modules. |
| 24 | // All the copies have to be kept in sync. |
| 25 | // TODO: Do the sharding better, either by making hostsubgen support sharding natively, or |
| 26 | // making a better build rule. |
| 27 | |
| 28 | genrule_defaults { |
| 29 | name: "framework-minus-apex.ravenwood-base_defaults", |
| 30 | tools: ["hoststubgen"], |
| 31 | srcs: [ |
| 32 | ":framework-minus-apex-for-host", |
John Wu | 2511073 | 2024-10-10 22:40:49 +0000 | [diff] [blame] | 33 | ":ravenwood-common-policies", |
John Wu | 2abff41 | 2024-10-10 21:58:26 +0000 | [diff] [blame] | 34 | ":ravenwood-framework-policies", |
| 35 | ":ravenwood-standard-options", |
| 36 | ":ravenwood-annotation-allowed-classes", |
| 37 | ], |
| 38 | out: [ |
| 39 | "ravenwood.jar", |
| 40 | "hoststubgen_framework-minus-apex.log", |
| 41 | ], |
| 42 | visibility: ["//visibility:private"], |
| 43 | } |
| 44 | |
| 45 | framework_minus_apex_cmd = "$(location hoststubgen) " + |
| 46 | "@$(location :ravenwood-standard-options) " + |
| 47 | "--debug-log $(location hoststubgen_framework-minus-apex.log) " + |
| 48 | "--out-jar $(location ravenwood.jar) " + |
| 49 | "--in-jar $(location :framework-minus-apex-for-host) " + |
John Wu | 2511073 | 2024-10-10 22:40:49 +0000 | [diff] [blame] | 50 | "--policy-override-file $(location :ravenwood-common-policies) " + |
John Wu | 2abff41 | 2024-10-10 21:58:26 +0000 | [diff] [blame] | 51 | "--policy-override-file $(location :ravenwood-framework-policies) " + |
| 52 | "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) " |
| 53 | |
| 54 | java_genrule { |
| 55 | name: "framework-minus-apex.ravenwood-base_X0", |
| 56 | defaults: ["framework-minus-apex.ravenwood-base_defaults"], |
| 57 | cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 0", |
| 58 | } |
| 59 | |
| 60 | java_genrule { |
| 61 | name: "framework-minus-apex.ravenwood-base_X1", |
| 62 | defaults: ["framework-minus-apex.ravenwood-base_defaults"], |
| 63 | cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 1", |
| 64 | } |
| 65 | |
| 66 | java_genrule { |
| 67 | name: "framework-minus-apex.ravenwood-base_X2", |
| 68 | defaults: ["framework-minus-apex.ravenwood-base_defaults"], |
| 69 | cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 2", |
| 70 | } |
| 71 | |
| 72 | java_genrule { |
| 73 | name: "framework-minus-apex.ravenwood-base_X3", |
| 74 | defaults: ["framework-minus-apex.ravenwood-base_defaults"], |
| 75 | cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 3", |
| 76 | } |
| 77 | |
| 78 | java_genrule { |
| 79 | name: "framework-minus-apex.ravenwood-base_X4", |
| 80 | defaults: ["framework-minus-apex.ravenwood-base_defaults"], |
| 81 | cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 4", |
| 82 | } |
| 83 | |
| 84 | java_genrule { |
| 85 | name: "framework-minus-apex.ravenwood-base_X5", |
| 86 | defaults: ["framework-minus-apex.ravenwood-base_defaults"], |
| 87 | cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 5", |
| 88 | } |
| 89 | |
| 90 | java_genrule { |
| 91 | name: "framework-minus-apex.ravenwood-base_X6", |
| 92 | defaults: ["framework-minus-apex.ravenwood-base_defaults"], |
| 93 | cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 6", |
| 94 | } |
| 95 | |
| 96 | java_genrule { |
| 97 | name: "framework-minus-apex.ravenwood-base_X7", |
| 98 | defaults: ["framework-minus-apex.ravenwood-base_defaults"], |
| 99 | cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 7", |
| 100 | } |
| 101 | |
| 102 | java_genrule { |
| 103 | name: "framework-minus-apex.ravenwood-base_X8", |
| 104 | defaults: ["framework-minus-apex.ravenwood-base_defaults"], |
| 105 | cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 8", |
| 106 | } |
| 107 | |
| 108 | java_genrule { |
| 109 | name: "framework-minus-apex.ravenwood-base_X9", |
| 110 | defaults: ["framework-minus-apex.ravenwood-base_defaults"], |
| 111 | cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 9", |
| 112 | } |
| 113 | |
| 114 | // Build framework-minus-apex.ravenwood-base without sharding. |
| 115 | // We extract the various dump files from this one, rather than the sharded ones, because |
| 116 | // some dumps use the output from other classes (e.g. base classes) which may not be in the |
| 117 | // same shard. Also some of the dump files ("apis") may be slow even when sharded, because |
| 118 | // the output contains the information from all the input classes, rather than the output classes. |
| 119 | // Not using sharding is fine for this module because it's only used for collecting the |
| 120 | // dump / stats files, which don't have to happen regularly. |
| 121 | java_genrule { |
| 122 | name: "framework-minus-apex.ravenwood-base_all", |
| 123 | defaults: ["framework-minus-apex.ravenwood-base_defaults"], |
| 124 | cmd: framework_minus_apex_cmd + |
| 125 | "--stats-file $(location hoststubgen_framework-minus-apex_stats.csv) " + |
| 126 | "--supported-api-list-file $(location hoststubgen_framework-minus-apex_apis.csv) " + |
| 127 | |
| 128 | "--gen-keep-all-file $(location hoststubgen_framework-minus-apex_keep_all.txt) " + |
| 129 | "--gen-input-dump-file $(location hoststubgen_framework-minus-apex_dump.txt) ", |
| 130 | |
| 131 | out: [ |
| 132 | "hoststubgen_framework-minus-apex_keep_all.txt", |
| 133 | "hoststubgen_framework-minus-apex_dump.txt", |
| 134 | "hoststubgen_framework-minus-apex_stats.csv", |
| 135 | "hoststubgen_framework-minus-apex_apis.csv", |
| 136 | ], |
| 137 | } |
| 138 | |
| 139 | // Marge all the sharded jars |
| 140 | java_genrule { |
| 141 | name: "framework-minus-apex.ravenwood", |
| 142 | defaults: ["ravenwood-internal-only-visibility-java"], |
| 143 | cmd: "$(location merge_zips) $(out) $(in)", |
| 144 | tools: ["merge_zips"], |
| 145 | srcs: [ |
| 146 | ":framework-minus-apex.ravenwood-base_X0{ravenwood.jar}", |
| 147 | ":framework-minus-apex.ravenwood-base_X1{ravenwood.jar}", |
| 148 | ":framework-minus-apex.ravenwood-base_X2{ravenwood.jar}", |
| 149 | ":framework-minus-apex.ravenwood-base_X3{ravenwood.jar}", |
| 150 | ":framework-minus-apex.ravenwood-base_X4{ravenwood.jar}", |
| 151 | ":framework-minus-apex.ravenwood-base_X5{ravenwood.jar}", |
| 152 | ":framework-minus-apex.ravenwood-base_X6{ravenwood.jar}", |
| 153 | ":framework-minus-apex.ravenwood-base_X7{ravenwood.jar}", |
| 154 | ":framework-minus-apex.ravenwood-base_X8{ravenwood.jar}", |
| 155 | ":framework-minus-apex.ravenwood-base_X9{ravenwood.jar}", |
| 156 | ], |
| 157 | out: [ |
| 158 | "framework-minus-apex.ravenwood.jar", |
| 159 | ], |
| 160 | } |
| 161 | |
| 162 | ////////////////// |
| 163 | // services.core |
| 164 | ////////////////// |
| 165 | |
| 166 | java_library { |
| 167 | name: "services.core-for-host", |
| 168 | installable: false, // host only jar. |
| 169 | static_libs: [ |
| 170 | "services.core", |
| 171 | ], |
| 172 | sdk_version: "core_platform", |
| 173 | visibility: ["//visibility:private"], |
| 174 | } |
| 175 | |
| 176 | java_genrule { |
| 177 | name: "services.core.ravenwood-base", |
| 178 | tools: ["hoststubgen"], |
| 179 | cmd: "$(location hoststubgen) " + |
| 180 | "@$(location :ravenwood-standard-options) " + |
| 181 | |
| 182 | "--debug-log $(location hoststubgen_services.core.log) " + |
| 183 | "--stats-file $(location hoststubgen_services.core_stats.csv) " + |
| 184 | "--supported-api-list-file $(location hoststubgen_services.core_apis.csv) " + |
John Wu | 2abff41 | 2024-10-10 21:58:26 +0000 | [diff] [blame] | 185 | "--gen-keep-all-file $(location hoststubgen_services.core_keep_all.txt) " + |
| 186 | "--gen-input-dump-file $(location hoststubgen_services.core_dump.txt) " + |
| 187 | |
John Wu | 2511073 | 2024-10-10 22:40:49 +0000 | [diff] [blame] | 188 | "--out-jar $(location ravenwood.jar) " + |
John Wu | 2abff41 | 2024-10-10 21:58:26 +0000 | [diff] [blame] | 189 | "--in-jar $(location :services.core-for-host) " + |
John Wu | 2511073 | 2024-10-10 22:40:49 +0000 | [diff] [blame] | 190 | |
| 191 | "--policy-override-file $(location :ravenwood-common-policies) " + |
John Wu | 2abff41 | 2024-10-10 21:58:26 +0000 | [diff] [blame] | 192 | "--policy-override-file $(location :ravenwood-services-policies) " + |
| 193 | "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) ", |
| 194 | srcs: [ |
| 195 | ":services.core-for-host", |
John Wu | 2511073 | 2024-10-10 22:40:49 +0000 | [diff] [blame] | 196 | ":ravenwood-common-policies", |
John Wu | 2abff41 | 2024-10-10 21:58:26 +0000 | [diff] [blame] | 197 | ":ravenwood-services-policies", |
| 198 | ":ravenwood-standard-options", |
| 199 | ":ravenwood-annotation-allowed-classes", |
| 200 | ], |
| 201 | out: [ |
| 202 | "ravenwood.jar", |
| 203 | |
| 204 | // Following files are created just as FYI. |
| 205 | "hoststubgen_services.core_keep_all.txt", |
| 206 | "hoststubgen_services.core_dump.txt", |
| 207 | |
| 208 | "hoststubgen_services.core.log", |
| 209 | "hoststubgen_services.core_stats.csv", |
| 210 | "hoststubgen_services.core_apis.csv", |
| 211 | ], |
| 212 | visibility: ["//visibility:private"], |
| 213 | } |
| 214 | |
| 215 | java_genrule { |
| 216 | name: "services.core.ravenwood", |
Makoto Onuki | b4207ae | 2024-10-29 11:18:38 -0700 | [diff] [blame] | 217 | // This is used by unit tests too (so tests will be able to access HSG-processed implementation) |
| 218 | // so it's visible to all. |
John Wu | 2abff41 | 2024-10-10 21:58:26 +0000 | [diff] [blame] | 219 | cmd: "cp $(in) $(out)", |
| 220 | srcs: [ |
| 221 | ":services.core.ravenwood-base{ravenwood.jar}", |
| 222 | ], |
| 223 | out: [ |
| 224 | "services.core.ravenwood.jar", |
| 225 | ], |
| 226 | } |
| 227 | |
| 228 | // TODO(b/313930116) This jarjar is a bit slow. We should use hoststubgen for renaming, |
| 229 | // but services.core.ravenwood has complex dependencies, so it'll take more than |
| 230 | // just using hoststubgen "rename"s. |
| 231 | java_library { |
| 232 | name: "services.core.ravenwood-jarjar", |
| 233 | defaults: ["ravenwood-internal-only-visibility-java"], |
| 234 | installable: false, |
| 235 | static_libs: [ |
| 236 | "services.core.ravenwood", |
| 237 | ], |
| 238 | jarjar_rules: ":ravenwood-services-jarjar-rules", |
| 239 | } |
| 240 | |
| 241 | /////////////// |
| 242 | // core-icu4j |
| 243 | /////////////// |
| 244 | |
| 245 | java_genrule { |
| 246 | name: "core-icu4j-for-host.ravenwood-base", |
| 247 | tools: ["hoststubgen"], |
| 248 | cmd: "$(location hoststubgen) " + |
| 249 | "@$(location :ravenwood-standard-options) " + |
| 250 | |
| 251 | "--debug-log $(location hoststubgen_core-icu4j-for-host.log) " + |
| 252 | "--stats-file $(location hoststubgen_core-icu4j-for-host_stats.csv) " + |
| 253 | "--supported-api-list-file $(location hoststubgen_core-icu4j-for-host_apis.csv) " + |
John Wu | 2abff41 | 2024-10-10 21:58:26 +0000 | [diff] [blame] | 254 | "--gen-keep-all-file $(location hoststubgen_core-icu4j-for-host_keep_all.txt) " + |
| 255 | "--gen-input-dump-file $(location hoststubgen_core-icu4j-for-host_dump.txt) " + |
| 256 | |
John Wu | 2511073 | 2024-10-10 22:40:49 +0000 | [diff] [blame] | 257 | "--out-jar $(location ravenwood.jar) " + |
John Wu | 2abff41 | 2024-10-10 21:58:26 +0000 | [diff] [blame] | 258 | "--in-jar $(location :core-icu4j-for-host) " + |
John Wu | 2511073 | 2024-10-10 22:40:49 +0000 | [diff] [blame] | 259 | |
| 260 | "--policy-override-file $(location :ravenwood-common-policies) " + |
| 261 | "--policy-override-file $(location :icu-ravenwood-policies) ", |
John Wu | 2abff41 | 2024-10-10 21:58:26 +0000 | [diff] [blame] | 262 | srcs: [ |
| 263 | ":core-icu4j-for-host", |
| 264 | |
John Wu | 2511073 | 2024-10-10 22:40:49 +0000 | [diff] [blame] | 265 | ":ravenwood-common-policies", |
John Wu | 2abff41 | 2024-10-10 21:58:26 +0000 | [diff] [blame] | 266 | ":icu-ravenwood-policies", |
| 267 | ":ravenwood-standard-options", |
John Wu | 2abff41 | 2024-10-10 21:58:26 +0000 | [diff] [blame] | 268 | ], |
| 269 | out: [ |
| 270 | "ravenwood.jar", |
| 271 | |
| 272 | // Following files are created just as FYI. |
| 273 | "hoststubgen_core-icu4j-for-host_keep_all.txt", |
| 274 | "hoststubgen_core-icu4j-for-host_dump.txt", |
| 275 | |
| 276 | "hoststubgen_core-icu4j-for-host.log", |
| 277 | "hoststubgen_core-icu4j-for-host_stats.csv", |
| 278 | "hoststubgen_core-icu4j-for-host_apis.csv", |
| 279 | ], |
| 280 | visibility: ["//visibility:private"], |
| 281 | } |
| 282 | |
| 283 | java_genrule { |
| 284 | name: "core-icu4j-for-host.ravenwood", |
| 285 | defaults: ["ravenwood-internal-only-visibility-genrule"], |
| 286 | cmd: "cp $(in) $(out)", |
| 287 | srcs: [ |
| 288 | ":core-icu4j-for-host.ravenwood-base{ravenwood.jar}", |
| 289 | ], |
| 290 | out: [ |
| 291 | "core-icu4j-for-host.ravenwood.jar", |
| 292 | ], |
| 293 | } |
John Wu | 0bbc544 | 2024-10-17 08:46:06 +0000 | [diff] [blame] | 294 | |
| 295 | /////////////////////////////////// |
| 296 | // framework-configinfrastructure |
| 297 | /////////////////////////////////// |
| 298 | |
| 299 | java_genrule { |
| 300 | name: "framework-configinfrastructure.ravenwood-base", |
| 301 | tools: ["hoststubgen"], |
| 302 | cmd: "$(location hoststubgen) " + |
| 303 | "@$(location :ravenwood-standard-options) " + |
| 304 | |
| 305 | "--debug-log $(location framework-configinfrastructure.log) " + |
| 306 | "--stats-file $(location framework-configinfrastructure_stats.csv) " + |
| 307 | "--supported-api-list-file $(location framework-configinfrastructure_apis.csv) " + |
| 308 | "--gen-keep-all-file $(location framework-configinfrastructure_keep_all.txt) " + |
| 309 | "--gen-input-dump-file $(location framework-configinfrastructure_dump.txt) " + |
| 310 | |
| 311 | "--out-impl-jar $(location ravenwood.jar) " + |
| 312 | "--in-jar $(location :framework-configinfrastructure.impl{.jar}) " + |
| 313 | |
| 314 | "--policy-override-file $(location :ravenwood-common-policies) " + |
| 315 | "--policy-override-file $(location :framework-configinfrastructure-ravenwood-policies) ", |
| 316 | srcs: [ |
| 317 | ":framework-configinfrastructure.impl{.jar}", |
| 318 | |
| 319 | ":ravenwood-common-policies", |
| 320 | ":framework-configinfrastructure-ravenwood-policies", |
| 321 | ":ravenwood-standard-options", |
| 322 | ], |
| 323 | out: [ |
| 324 | "ravenwood.jar", |
| 325 | |
| 326 | // Following files are created just as FYI. |
| 327 | "framework-configinfrastructure_keep_all.txt", |
| 328 | "framework-configinfrastructure_dump.txt", |
| 329 | |
| 330 | "framework-configinfrastructure.log", |
| 331 | "framework-configinfrastructure_stats.csv", |
| 332 | "framework-configinfrastructure_apis.csv", |
| 333 | ], |
| 334 | visibility: ["//visibility:private"], |
| 335 | } |
| 336 | |
| 337 | java_genrule { |
| 338 | name: "framework-configinfrastructure.ravenwood", |
| 339 | defaults: ["ravenwood-internal-only-visibility-genrule"], |
| 340 | cmd: "cp $(in) $(out)", |
| 341 | srcs: [ |
| 342 | ":framework-configinfrastructure.ravenwood-base{ravenwood.jar}", |
| 343 | ], |
| 344 | out: [ |
| 345 | "framework-configinfrastructure.ravenwood.jar", |
| 346 | ], |
| 347 | } |
Makoto Onuki | b4f5f9e | 2024-10-22 14:51:17 -0700 | [diff] [blame] | 348 | |
| 349 | /////////////////////////////////// |
| 350 | // framework-statsd |
| 351 | /////////////////////////////////// |
| 352 | |
| 353 | java_genrule { |
| 354 | name: "framework-statsd.ravenwood-base", |
| 355 | tools: ["hoststubgen"], |
| 356 | cmd: "$(location hoststubgen) " + |
| 357 | "@$(location :ravenwood-standard-options) " + |
| 358 | |
| 359 | "--debug-log $(location framework-statsd.log) " + |
| 360 | "--stats-file $(location framework-statsd_stats.csv) " + |
| 361 | "--supported-api-list-file $(location framework-statsd_apis.csv) " + |
| 362 | "--gen-keep-all-file $(location framework-statsd_keep_all.txt) " + |
| 363 | "--gen-input-dump-file $(location framework-statsd_dump.txt) " + |
| 364 | |
| 365 | "--out-impl-jar $(location ravenwood.jar) " + |
| 366 | "--in-jar $(location :framework-statsd.impl{.jar}) " + |
| 367 | |
| 368 | "--policy-override-file $(location :ravenwood-common-policies) " + |
| 369 | "--policy-override-file $(location :framework-statsd-ravenwood-policies) ", |
| 370 | srcs: [ |
| 371 | ":framework-statsd.impl{.jar}", |
| 372 | |
| 373 | ":ravenwood-common-policies", |
| 374 | ":framework-statsd-ravenwood-policies", |
| 375 | ":ravenwood-standard-options", |
| 376 | ], |
| 377 | out: [ |
| 378 | "ravenwood.jar", |
| 379 | |
| 380 | // Following files are created just as FYI. |
| 381 | "framework-statsd_keep_all.txt", |
| 382 | "framework-statsd_dump.txt", |
| 383 | |
| 384 | "framework-statsd.log", |
| 385 | "framework-statsd_stats.csv", |
| 386 | "framework-statsd_apis.csv", |
| 387 | ], |
| 388 | visibility: ["//visibility:private"], |
| 389 | } |
| 390 | |
| 391 | java_genrule { |
| 392 | name: "framework-statsd.ravenwood", |
| 393 | defaults: ["ravenwood-internal-only-visibility-genrule"], |
| 394 | cmd: "cp $(in) $(out)", |
| 395 | srcs: [ |
| 396 | ":framework-statsd.ravenwood-base{ravenwood.jar}", |
| 397 | ], |
| 398 | out: [ |
| 399 | "framework-statsd.ravenwood.jar", |
| 400 | ], |
| 401 | } |