Makoto Onuki | 3aefe33 | 2023-10-06 10:02:07 -0700 | [diff] [blame] | 1 | // Copyright (C) 2023 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 | // We need this "trampoline" rule to force soong to give a host-side jar to |
Makoto Onuki | c69a84e | 2023-10-20 10:43:55 -0700 | [diff] [blame] | 16 | // framework-minus-apex.ravenwood-base. Otherwise, soong would mix up the arch (?) and we'd get |
Makoto Onuki | 3aefe33 | 2023-10-06 10:02:07 -0700 | [diff] [blame] | 17 | // a dex jar. |
| 18 | java_library { |
| 19 | name: "framework-minus-apex-for-hoststubgen", |
| 20 | installable: false, // host only jar. |
| 21 | static_libs: [ |
| 22 | "framework-minus-apex", |
| 23 | ], |
| 24 | sdk_version: "core_platform", |
| 25 | visibility: ["//visibility:private"], |
| 26 | } |
| 27 | |
| 28 | // Generate the stub/impl from framework-all, with hidden APIs. |
Makoto Onuki | c69a84e | 2023-10-20 10:43:55 -0700 | [diff] [blame] | 29 | java_genrule { |
Makoto Onuki | 3aefe33 | 2023-10-06 10:02:07 -0700 | [diff] [blame] | 30 | name: "framework-minus-apex.ravenwood-base", |
| 31 | tools: ["hoststubgen"], |
| 32 | cmd: "$(location hoststubgen) " + |
Makoto Onuki | dfade84 | 2024-05-02 15:42:08 -0700 | [diff] [blame] | 33 | "@$(location :ravenwood-standard-options) " + |
Makoto Onuki | 3aefe33 | 2023-10-06 10:02:07 -0700 | [diff] [blame] | 34 | |
Makoto Onuki | 623cffb | 2023-11-29 10:45:06 -0800 | [diff] [blame] | 35 | "--debug-log $(location hoststubgen_framework-minus-apex.log) " + |
Jeff Sharkey | d2cc191 | 2024-02-09 14:37:10 -0700 | [diff] [blame] | 36 | "--stats-file $(location hoststubgen_framework-minus-apex_stats.csv) " + |
Makoto Onuki | 434d7282 | 2024-04-25 11:03:41 -0700 | [diff] [blame] | 37 | "--supported-api-list-file $(location hoststubgen_framework-minus-apex_apis.csv) " + |
Makoto Onuki | 623cffb | 2023-11-29 10:45:06 -0800 | [diff] [blame] | 38 | |
Makoto Onuki | 3aefe33 | 2023-10-06 10:02:07 -0700 | [diff] [blame] | 39 | "--out-impl-jar $(location ravenwood.jar) " + |
| 40 | |
Makoto Onuki | 134a415 | 2024-06-26 14:21:12 -0700 | [diff] [blame] | 41 | "--gen-keep-all-file $(location hoststubgen_framework-minus-apex_keep_all.txt) " + |
| 42 | "--gen-input-dump-file $(location hoststubgen_framework-minus-apex_dump.txt) " + |
Makoto Onuki | 3aefe33 | 2023-10-06 10:02:07 -0700 | [diff] [blame] | 43 | |
| 44 | "--in-jar $(location :framework-minus-apex-for-hoststubgen) " + |
Makoto Onuki | dfade84 | 2024-05-02 15:42:08 -0700 | [diff] [blame] | 45 | "--policy-override-file $(location :ravenwood-framework-policies) " + |
| 46 | "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) ", |
Makoto Onuki | 3aefe33 | 2023-10-06 10:02:07 -0700 | [diff] [blame] | 47 | srcs: [ |
| 48 | ":framework-minus-apex-for-hoststubgen", |
Makoto Onuki | dfade84 | 2024-05-02 15:42:08 -0700 | [diff] [blame] | 49 | ":ravenwood-framework-policies", |
| 50 | ":ravenwood-standard-options", |
| 51 | ":ravenwood-annotation-allowed-classes", |
Makoto Onuki | 3aefe33 | 2023-10-06 10:02:07 -0700 | [diff] [blame] | 52 | ], |
| 53 | out: [ |
| 54 | "ravenwood.jar", |
Makoto Onuki | 3aefe33 | 2023-10-06 10:02:07 -0700 | [diff] [blame] | 55 | |
| 56 | // Following files are created just as FYI. |
Makoto Onuki | 134a415 | 2024-06-26 14:21:12 -0700 | [diff] [blame] | 57 | "hoststubgen_framework-minus-apex_keep_all.txt", |
| 58 | "hoststubgen_framework-minus-apex_dump.txt", |
Makoto Onuki | 623cffb | 2023-11-29 10:45:06 -0800 | [diff] [blame] | 59 | |
| 60 | "hoststubgen_framework-minus-apex.log", |
Jeff Sharkey | d2cc191 | 2024-02-09 14:37:10 -0700 | [diff] [blame] | 61 | "hoststubgen_framework-minus-apex_stats.csv", |
Makoto Onuki | 434d7282 | 2024-04-25 11:03:41 -0700 | [diff] [blame] | 62 | "hoststubgen_framework-minus-apex_apis.csv", |
Makoto Onuki | 3aefe33 | 2023-10-06 10:02:07 -0700 | [diff] [blame] | 63 | ], |
Makoto Onuki | 134a415 | 2024-06-26 14:21:12 -0700 | [diff] [blame] | 64 | defaults: ["ravenwood-internal-only-visibility-genrule"], |
Makoto Onuki | 3aefe33 | 2023-10-06 10:02:07 -0700 | [diff] [blame] | 65 | } |
| 66 | |
| 67 | // Extract the impl jar from "framework-minus-apex.ravenwood-base" for subsequent build rules. |
Makoto Onuki | c69a84e | 2023-10-20 10:43:55 -0700 | [diff] [blame] | 68 | // Note this emits a "device side" output, so that ravenwood tests can (implicitly) |
| 69 | // depend on it. |
| 70 | java_genrule { |
Makoto Onuki | 3aefe33 | 2023-10-06 10:02:07 -0700 | [diff] [blame] | 71 | name: "framework-minus-apex.ravenwood", |
Makoto Onuki | 8bcc628 | 2023-12-18 14:03:59 -0800 | [diff] [blame] | 72 | defaults: ["ravenwood-internal-only-visibility-genrule"], |
Makoto Onuki | 3aefe33 | 2023-10-06 10:02:07 -0700 | [diff] [blame] | 73 | cmd: "cp $(in) $(out)", |
| 74 | srcs: [ |
| 75 | ":framework-minus-apex.ravenwood-base{ravenwood.jar}", |
| 76 | ], |
| 77 | out: [ |
| 78 | "framework-minus-apex.ravenwood.jar", |
| 79 | ], |
Makoto Onuki | 3aefe33 | 2023-10-06 10:02:07 -0700 | [diff] [blame] | 80 | } |
Makoto Onuki | c69a84e | 2023-10-20 10:43:55 -0700 | [diff] [blame] | 81 | |
Jeff Sharkey | ed81c78 | 2024-01-11 13:29:07 -0700 | [diff] [blame] | 82 | java_library { |
Jeff Sharkey | 3e91c2b | 2024-02-15 14:12:07 -0700 | [diff] [blame] | 83 | name: "services.core-for-hoststubgen", |
| 84 | installable: false, // host only jar. |
| 85 | static_libs: [ |
| 86 | "services.core", |
| 87 | ], |
| 88 | sdk_version: "core_platform", |
| 89 | visibility: ["//visibility:private"], |
| 90 | } |
| 91 | |
| 92 | java_genrule { |
| 93 | name: "services.core.ravenwood-base", |
| 94 | tools: ["hoststubgen"], |
| 95 | cmd: "$(location hoststubgen) " + |
Makoto Onuki | dfade84 | 2024-05-02 15:42:08 -0700 | [diff] [blame] | 96 | "@$(location :ravenwood-standard-options) " + |
Jeff Sharkey | 3e91c2b | 2024-02-15 14:12:07 -0700 | [diff] [blame] | 97 | |
| 98 | "--debug-log $(location hoststubgen_services.core.log) " + |
| 99 | "--stats-file $(location hoststubgen_services.core_stats.csv) " + |
Makoto Onuki | 434d7282 | 2024-04-25 11:03:41 -0700 | [diff] [blame] | 100 | "--supported-api-list-file $(location hoststubgen_services.core_apis.csv) " + |
Jeff Sharkey | 3e91c2b | 2024-02-15 14:12:07 -0700 | [diff] [blame] | 101 | |
| 102 | "--out-impl-jar $(location ravenwood.jar) " + |
| 103 | |
Makoto Onuki | 134a415 | 2024-06-26 14:21:12 -0700 | [diff] [blame] | 104 | "--gen-keep-all-file $(location hoststubgen_services.core_keep_all.txt) " + |
| 105 | "--gen-input-dump-file $(location hoststubgen_services.core_dump.txt) " + |
Jeff Sharkey | 3e91c2b | 2024-02-15 14:12:07 -0700 | [diff] [blame] | 106 | |
| 107 | "--in-jar $(location :services.core-for-hoststubgen) " + |
Makoto Onuki | dfade84 | 2024-05-02 15:42:08 -0700 | [diff] [blame] | 108 | "--policy-override-file $(location :ravenwood-services-policies) " + |
| 109 | "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) ", |
Jeff Sharkey | 3e91c2b | 2024-02-15 14:12:07 -0700 | [diff] [blame] | 110 | srcs: [ |
| 111 | ":services.core-for-hoststubgen", |
Makoto Onuki | dfade84 | 2024-05-02 15:42:08 -0700 | [diff] [blame] | 112 | ":ravenwood-services-policies", |
| 113 | ":ravenwood-standard-options", |
| 114 | ":ravenwood-annotation-allowed-classes", |
Jeff Sharkey | 3e91c2b | 2024-02-15 14:12:07 -0700 | [diff] [blame] | 115 | ], |
| 116 | out: [ |
| 117 | "ravenwood.jar", |
| 118 | |
| 119 | // Following files are created just as FYI. |
Makoto Onuki | 134a415 | 2024-06-26 14:21:12 -0700 | [diff] [blame] | 120 | "hoststubgen_services.core_keep_all.txt", |
| 121 | "hoststubgen_services.core_dump.txt", |
Jeff Sharkey | 3e91c2b | 2024-02-15 14:12:07 -0700 | [diff] [blame] | 122 | |
| 123 | "hoststubgen_services.core.log", |
| 124 | "hoststubgen_services.core_stats.csv", |
Makoto Onuki | 434d7282 | 2024-04-25 11:03:41 -0700 | [diff] [blame] | 125 | "hoststubgen_services.core_apis.csv", |
Jeff Sharkey | 3e91c2b | 2024-02-15 14:12:07 -0700 | [diff] [blame] | 126 | ], |
Makoto Onuki | 134a415 | 2024-06-26 14:21:12 -0700 | [diff] [blame] | 127 | defaults: ["ravenwood-internal-only-visibility-genrule"], |
Jeff Sharkey | 3e91c2b | 2024-02-15 14:12:07 -0700 | [diff] [blame] | 128 | } |
| 129 | |
| 130 | java_genrule { |
| 131 | name: "services.core.ravenwood", |
| 132 | defaults: ["ravenwood-internal-only-visibility-genrule"], |
| 133 | cmd: "cp $(in) $(out)", |
| 134 | srcs: [ |
| 135 | ":services.core.ravenwood-base{ravenwood.jar}", |
| 136 | ], |
| 137 | out: [ |
| 138 | "services.core.ravenwood.jar", |
| 139 | ], |
| 140 | } |
| 141 | |
| 142 | java_library { |
| 143 | name: "services.core.ravenwood-jarjar", |
Makoto Onuki | e5e9727 | 2024-05-23 10:49:31 -0700 | [diff] [blame] | 144 | defaults: ["ravenwood-internal-only-visibility-java"], |
Jeff Sharkey | 3e91c2b | 2024-02-15 14:12:07 -0700 | [diff] [blame] | 145 | installable: false, |
| 146 | static_libs: [ |
| 147 | "services.core.ravenwood", |
| 148 | ], |
| 149 | jarjar_rules: ":ravenwood-services-jarjar-rules", |
Jeff Sharkey | ed81c78 | 2024-01-11 13:29:07 -0700 | [diff] [blame] | 150 | } |
| 151 | |
Makoto Onuki | 053eac8 | 2024-02-13 10:31:18 -0800 | [diff] [blame] | 152 | // Jars in "ravenwood-runtime" are set to the classpath, sorted alphabetically. |
| 153 | // Rename some of the dependencies to make sure they're included in the intended order. |
Makoto Onuki | f38d599 | 2024-05-30 10:40:50 -0700 | [diff] [blame] | 154 | // Also apply jarjar. |
| 155 | java_library { |
Makoto Onuki | 053eac8 | 2024-02-13 10:31:18 -0800 | [diff] [blame] | 156 | name: "100-framework-minus-apex.ravenwood", |
Makoto Onuki | f38d599 | 2024-05-30 10:40:50 -0700 | [diff] [blame] | 157 | defaults: ["ravenwood-internal-only-visibility-java"], |
| 158 | static_libs: [ |
| 159 | "framework-minus-apex.ravenwood", |
| 160 | ], |
| 161 | sdk_version: "core_platform", |
Makoto Onuki | 7645fa8 | 2024-08-02 10:47:55 -0700 | [diff] [blame^] | 162 | // See b/313930116. Jarjar is too slow on this jar. We use HostStubGen to do the rename. |
| 163 | // jarjar_rules: ":ravenwood-framework-jarjar-rules", |
Makoto Onuki | 053eac8 | 2024-02-13 10:31:18 -0800 | [diff] [blame] | 164 | } |
| 165 | |
| 166 | java_genrule { |
| 167 | // Use 200 to make sure it comes before the mainline stub ("all-updatable..."). |
| 168 | name: "200-kxml2-android", |
Makoto Onuki | e5e9727 | 2024-05-23 10:49:31 -0700 | [diff] [blame] | 169 | defaults: ["ravenwood-internal-only-visibility-genrule"], |
Makoto Onuki | 053eac8 | 2024-02-13 10:31:18 -0800 | [diff] [blame] | 170 | cmd: "cp $(in) $(out)", |
| 171 | srcs: [":kxml2-android"], |
| 172 | out: ["200-kxml2-android.jar"], |
Makoto Onuki | 053eac8 | 2024-02-13 10:31:18 -0800 | [diff] [blame] | 173 | } |
| 174 | |
Makoto Onuki | d8231fe | 2024-05-10 12:49:24 -0700 | [diff] [blame] | 175 | java_genrule { |
| 176 | name: "z00-all-updatable-modules-system-stubs", |
Makoto Onuki | e5e9727 | 2024-05-23 10:49:31 -0700 | [diff] [blame] | 177 | defaults: ["ravenwood-internal-only-visibility-genrule"], |
Makoto Onuki | d8231fe | 2024-05-10 12:49:24 -0700 | [diff] [blame] | 178 | cmd: "cp $(in) $(out)", |
| 179 | srcs: [":all-updatable-modules-system-stubs"], |
| 180 | out: ["z00-all-updatable-modules-system-stubs.jar"], |
Makoto Onuki | c69a84e | 2023-10-20 10:43:55 -0700 | [diff] [blame] | 181 | } |