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 | a3fe562 | 2024-03-27 13:08:32 -0700 | [diff] [blame] | 33 | "@$(location ravenwood/texts/ravenwood-standard-options.txt) " + |
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 | 623cffb | 2023-11-29 10:45:06 -0800 | [diff] [blame] | 37 | |
Makoto Onuki | 3aefe33 | 2023-10-06 10:02:07 -0700 | [diff] [blame] | 38 | "--out-impl-jar $(location ravenwood.jar) " + |
| 39 | |
| 40 | "--gen-keep-all-file $(location hoststubgen_keep_all.txt) " + |
| 41 | "--gen-input-dump-file $(location hoststubgen_dump.txt) " + |
| 42 | |
| 43 | "--in-jar $(location :framework-minus-apex-for-hoststubgen) " + |
Makoto Onuki | a3fe562 | 2024-03-27 13:08:32 -0700 | [diff] [blame] | 44 | "--policy-override-file $(location ravenwood/texts/framework-minus-apex-ravenwood-policies.txt) " + |
| 45 | "--annotation-allowed-classes-file $(location ravenwood/texts/ravenwood-annotation-allowed-classes.txt) ", |
Makoto Onuki | 3aefe33 | 2023-10-06 10:02:07 -0700 | [diff] [blame] | 46 | srcs: [ |
| 47 | ":framework-minus-apex-for-hoststubgen", |
Makoto Onuki | a3fe562 | 2024-03-27 13:08:32 -0700 | [diff] [blame] | 48 | "ravenwood/texts/framework-minus-apex-ravenwood-policies.txt", |
| 49 | "ravenwood/texts/ravenwood-standard-options.txt", |
| 50 | "ravenwood/texts/ravenwood-annotation-allowed-classes.txt", |
Makoto Onuki | 3aefe33 | 2023-10-06 10:02:07 -0700 | [diff] [blame] | 51 | ], |
| 52 | out: [ |
| 53 | "ravenwood.jar", |
Makoto Onuki | 3aefe33 | 2023-10-06 10:02:07 -0700 | [diff] [blame] | 54 | |
| 55 | // Following files are created just as FYI. |
| 56 | "hoststubgen_keep_all.txt", |
| 57 | "hoststubgen_dump.txt", |
Makoto Onuki | 623cffb | 2023-11-29 10:45:06 -0800 | [diff] [blame] | 58 | |
| 59 | "hoststubgen_framework-minus-apex.log", |
Jeff Sharkey | d2cc191 | 2024-02-09 14:37:10 -0700 | [diff] [blame] | 60 | "hoststubgen_framework-minus-apex_stats.csv", |
Makoto Onuki | 3aefe33 | 2023-10-06 10:02:07 -0700 | [diff] [blame] | 61 | ], |
| 62 | visibility: ["//visibility:private"], |
| 63 | } |
| 64 | |
| 65 | // 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] | 66 | // Note this emits a "device side" output, so that ravenwood tests can (implicitly) |
| 67 | // depend on it. |
| 68 | java_genrule { |
Makoto Onuki | 3aefe33 | 2023-10-06 10:02:07 -0700 | [diff] [blame] | 69 | name: "framework-minus-apex.ravenwood", |
Makoto Onuki | 8bcc628 | 2023-12-18 14:03:59 -0800 | [diff] [blame] | 70 | defaults: ["ravenwood-internal-only-visibility-genrule"], |
Makoto Onuki | 3aefe33 | 2023-10-06 10:02:07 -0700 | [diff] [blame] | 71 | cmd: "cp $(in) $(out)", |
| 72 | srcs: [ |
| 73 | ":framework-minus-apex.ravenwood-base{ravenwood.jar}", |
| 74 | ], |
| 75 | out: [ |
| 76 | "framework-minus-apex.ravenwood.jar", |
| 77 | ], |
Makoto Onuki | 3aefe33 | 2023-10-06 10:02:07 -0700 | [diff] [blame] | 78 | } |
Makoto Onuki | c69a84e | 2023-10-20 10:43:55 -0700 | [diff] [blame] | 79 | |
Makoto Onuki | 3fb1f2b | 2024-03-27 13:08:32 -0700 | [diff] [blame] | 80 | // Extract the stats file. |
| 81 | genrule { |
| 82 | name: "framework-minus-apex.ravenwood.stats", |
| 83 | defaults: ["ravenwood-internal-only-visibility-genrule"], |
| 84 | cmd: "cp $(in) $(out)", |
| 85 | srcs: [ |
| 86 | ":framework-minus-apex.ravenwood-base{hoststubgen_framework-minus-apex_stats.csv}", |
| 87 | ], |
| 88 | out: [ |
| 89 | "hoststubgen_framework-minus-apex_stats.csv", |
| 90 | ], |
| 91 | } |
| 92 | |
Jeff Sharkey | ed81c78 | 2024-01-11 13:29:07 -0700 | [diff] [blame] | 93 | java_library { |
Jeff Sharkey | 3e91c2b | 2024-02-15 14:12:07 -0700 | [diff] [blame] | 94 | name: "services.core-for-hoststubgen", |
| 95 | installable: false, // host only jar. |
| 96 | static_libs: [ |
| 97 | "services.core", |
| 98 | ], |
| 99 | sdk_version: "core_platform", |
| 100 | visibility: ["//visibility:private"], |
| 101 | } |
| 102 | |
| 103 | java_genrule { |
| 104 | name: "services.core.ravenwood-base", |
| 105 | tools: ["hoststubgen"], |
| 106 | cmd: "$(location hoststubgen) " + |
Makoto Onuki | a3fe562 | 2024-03-27 13:08:32 -0700 | [diff] [blame] | 107 | "@$(location ravenwood/texts/ravenwood-standard-options.txt) " + |
Jeff Sharkey | 3e91c2b | 2024-02-15 14:12:07 -0700 | [diff] [blame] | 108 | |
| 109 | "--debug-log $(location hoststubgen_services.core.log) " + |
| 110 | "--stats-file $(location hoststubgen_services.core_stats.csv) " + |
| 111 | |
| 112 | "--out-impl-jar $(location ravenwood.jar) " + |
| 113 | |
| 114 | "--gen-keep-all-file $(location hoststubgen_keep_all.txt) " + |
| 115 | "--gen-input-dump-file $(location hoststubgen_dump.txt) " + |
| 116 | |
| 117 | "--in-jar $(location :services.core-for-hoststubgen) " + |
Makoto Onuki | a3fe562 | 2024-03-27 13:08:32 -0700 | [diff] [blame] | 118 | "--policy-override-file $(location ravenwood/texts/services.core-ravenwood-policies.txt) " + |
| 119 | "--annotation-allowed-classes-file $(location ravenwood/texts/ravenwood-annotation-allowed-classes.txt) ", |
Jeff Sharkey | 3e91c2b | 2024-02-15 14:12:07 -0700 | [diff] [blame] | 120 | srcs: [ |
| 121 | ":services.core-for-hoststubgen", |
Makoto Onuki | a3fe562 | 2024-03-27 13:08:32 -0700 | [diff] [blame] | 122 | "ravenwood/texts/services.core-ravenwood-policies.txt", |
| 123 | "ravenwood/texts/ravenwood-standard-options.txt", |
| 124 | "ravenwood/texts/ravenwood-annotation-allowed-classes.txt", |
Jeff Sharkey | 3e91c2b | 2024-02-15 14:12:07 -0700 | [diff] [blame] | 125 | ], |
| 126 | out: [ |
| 127 | "ravenwood.jar", |
| 128 | |
| 129 | // Following files are created just as FYI. |
| 130 | "hoststubgen_keep_all.txt", |
| 131 | "hoststubgen_dump.txt", |
| 132 | |
| 133 | "hoststubgen_services.core.log", |
| 134 | "hoststubgen_services.core_stats.csv", |
| 135 | ], |
| 136 | visibility: ["//visibility:private"], |
| 137 | } |
| 138 | |
| 139 | java_genrule { |
| 140 | name: "services.core.ravenwood", |
| 141 | defaults: ["ravenwood-internal-only-visibility-genrule"], |
| 142 | cmd: "cp $(in) $(out)", |
| 143 | srcs: [ |
| 144 | ":services.core.ravenwood-base{ravenwood.jar}", |
| 145 | ], |
| 146 | out: [ |
| 147 | "services.core.ravenwood.jar", |
| 148 | ], |
| 149 | } |
| 150 | |
Makoto Onuki | 3fb1f2b | 2024-03-27 13:08:32 -0700 | [diff] [blame] | 151 | // Extract the stats file. |
| 152 | genrule { |
| 153 | name: "services.core.ravenwood.stats", |
| 154 | defaults: ["ravenwood-internal-only-visibility-genrule"], |
| 155 | cmd: "cp $(in) $(out)", |
| 156 | srcs: [ |
| 157 | ":services.core.ravenwood-base{hoststubgen_services.core_stats.csv}", |
| 158 | ], |
| 159 | out: [ |
| 160 | "hoststubgen_services.core_stats.csv", |
| 161 | ], |
| 162 | } |
| 163 | |
Jeff Sharkey | 3e91c2b | 2024-02-15 14:12:07 -0700 | [diff] [blame] | 164 | java_library { |
| 165 | name: "services.core.ravenwood-jarjar", |
| 166 | installable: false, |
| 167 | static_libs: [ |
| 168 | "services.core.ravenwood", |
| 169 | ], |
| 170 | jarjar_rules: ":ravenwood-services-jarjar-rules", |
Makoto Onuki | c5ad5fc | 2024-04-02 14:19:00 -0700 | [diff] [blame^] | 171 | visibility: ["//visibility:private"], |
Jeff Sharkey | 3e91c2b | 2024-02-15 14:12:07 -0700 | [diff] [blame] | 172 | } |
| 173 | |
| 174 | java_library { |
Jeff Sharkey | 16f7cdf | 2024-02-21 09:46:20 -0700 | [diff] [blame] | 175 | name: "services.fakes.ravenwood-jarjar", |
| 176 | installable: false, |
| 177 | srcs: [":services.fakes-sources"], |
| 178 | libs: [ |
Jeff Sharkey | 8a922ec | 2024-02-27 12:36:36 -0700 | [diff] [blame] | 179 | "ravenwood-framework", |
Jeff Sharkey | 16f7cdf | 2024-02-21 09:46:20 -0700 | [diff] [blame] | 180 | "services.core.ravenwood", |
| 181 | ], |
| 182 | jarjar_rules: ":ravenwood-services-jarjar-rules", |
Makoto Onuki | c5ad5fc | 2024-04-02 14:19:00 -0700 | [diff] [blame^] | 183 | visibility: ["//visibility:private"], |
Jeff Sharkey | 16f7cdf | 2024-02-21 09:46:20 -0700 | [diff] [blame] | 184 | } |
| 185 | |
| 186 | java_library { |
Jeff Sharkey | ed81c78 | 2024-01-11 13:29:07 -0700 | [diff] [blame] | 187 | name: "mockito-ravenwood-prebuilt", |
| 188 | installable: false, |
| 189 | static_libs: [ |
| 190 | "mockito-robolectric-prebuilt", |
| 191 | ], |
| 192 | } |
| 193 | |
| 194 | java_library { |
| 195 | name: "inline-mockito-ravenwood-prebuilt", |
| 196 | installable: false, |
| 197 | static_libs: [ |
| 198 | "inline-mockito-robolectric-prebuilt", |
| 199 | ], |
| 200 | } |
| 201 | |
Makoto Onuki | 053eac8 | 2024-02-13 10:31:18 -0800 | [diff] [blame] | 202 | // Jars in "ravenwood-runtime" are set to the classpath, sorted alphabetically. |
| 203 | // Rename some of the dependencies to make sure they're included in the intended order. |
| 204 | java_genrule { |
| 205 | name: "100-framework-minus-apex.ravenwood", |
| 206 | cmd: "cp $(in) $(out)", |
| 207 | srcs: [":framework-minus-apex.ravenwood"], |
| 208 | out: ["100-framework-minus-apex.ravenwood.jar"], |
| 209 | visibility: ["//visibility:private"], |
| 210 | } |
| 211 | |
| 212 | java_genrule { |
| 213 | // Use 200 to make sure it comes before the mainline stub ("all-updatable..."). |
| 214 | name: "200-kxml2-android", |
| 215 | cmd: "cp $(in) $(out)", |
| 216 | srcs: [":kxml2-android"], |
| 217 | out: ["200-kxml2-android.jar"], |
| 218 | visibility: ["//visibility:private"], |
| 219 | } |
| 220 | |
Makoto Onuki | c69a84e | 2023-10-20 10:43:55 -0700 | [diff] [blame] | 221 | android_ravenwood_libgroup { |
| 222 | name: "ravenwood-runtime", |
| 223 | libs: [ |
Makoto Onuki | 053eac8 | 2024-02-13 10:31:18 -0800 | [diff] [blame] | 224 | "100-framework-minus-apex.ravenwood", |
Jeff Sharkey | 1e92835 | 2024-02-12 13:44:49 -0700 | [diff] [blame] | 225 | "200-kxml2-android", |
Jeff Sharkey | 7c49507 | 2024-01-11 13:26:25 -0700 | [diff] [blame] | 226 | "all-updatable-modules-system-stubs", |
Jeff Sharkey | 1e92835 | 2024-02-12 13:44:49 -0700 | [diff] [blame] | 227 | "android.test.mock.ravenwood", |
Makoto Onuki | 053eac8 | 2024-02-13 10:31:18 -0800 | [diff] [blame] | 228 | "ravenwood-helper-runtime", |
Jeff Sharkey | 1e92835 | 2024-02-12 13:44:49 -0700 | [diff] [blame] | 229 | "hoststubgen-helper-runtime.ravenwood", |
Jeff Sharkey | 3e91c2b | 2024-02-15 14:12:07 -0700 | [diff] [blame] | 230 | "services.core.ravenwood-jarjar", |
Jeff Sharkey | 16f7cdf | 2024-02-21 09:46:20 -0700 | [diff] [blame] | 231 | "services.fakes.ravenwood-jarjar", |
Jeff Sharkey | 1e92835 | 2024-02-12 13:44:49 -0700 | [diff] [blame] | 232 | |
| 233 | // Provide runtime versions of utils linked in below |
Jeff Sharkey | 91f414e | 2023-11-07 15:43:59 -0700 | [diff] [blame] | 234 | "junit", |
| 235 | "truth", |
Jeff Sharkey | 7037e35 | 2024-02-27 14:22:24 -0700 | [diff] [blame] | 236 | "flag-junit", |
Jeff Sharkey | 8a922ec | 2024-02-27 12:36:36 -0700 | [diff] [blame] | 237 | "ravenwood-framework", |
Jeff Sharkey | 41cfbb3 | 2023-11-16 09:26:28 -0700 | [diff] [blame] | 238 | "ravenwood-junit-impl", |
Jeff Sharkey | 7037e35 | 2024-02-27 14:22:24 -0700 | [diff] [blame] | 239 | "ravenwood-junit-impl-flag", |
Jeff Sharkey | ed81c78 | 2024-01-11 13:29:07 -0700 | [diff] [blame] | 240 | "mockito-ravenwood-prebuilt", |
| 241 | "inline-mockito-ravenwood-prebuilt", |
Makoto Onuki | c69a84e | 2023-10-20 10:43:55 -0700 | [diff] [blame] | 242 | ], |
Makoto Onuki | 50276f0 | 2024-02-13 14:58:56 -0800 | [diff] [blame] | 243 | jni_libs: [ |
| 244 | "libandroid_runtime", |
| 245 | ], |
Makoto Onuki | c69a84e | 2023-10-20 10:43:55 -0700 | [diff] [blame] | 246 | } |
| 247 | |
| 248 | android_ravenwood_libgroup { |
| 249 | name: "ravenwood-utils", |
Jeff Sharkey | 91f414e | 2023-11-07 15:43:59 -0700 | [diff] [blame] | 250 | libs: [ |
| 251 | "junit", |
| 252 | "truth", |
Jeff Sharkey | 7037e35 | 2024-02-27 14:22:24 -0700 | [diff] [blame] | 253 | "flag-junit", |
Jeff Sharkey | 8a922ec | 2024-02-27 12:36:36 -0700 | [diff] [blame] | 254 | "ravenwood-framework", |
Jeff Sharkey | 91f414e | 2023-11-07 15:43:59 -0700 | [diff] [blame] | 255 | "ravenwood-junit", |
Jeff Sharkey | ed81c78 | 2024-01-11 13:29:07 -0700 | [diff] [blame] | 256 | "mockito-ravenwood-prebuilt", |
| 257 | "inline-mockito-ravenwood-prebuilt", |
Jeff Sharkey | 91f414e | 2023-11-07 15:43:59 -0700 | [diff] [blame] | 258 | ], |
Makoto Onuki | c69a84e | 2023-10-20 10:43:55 -0700 | [diff] [blame] | 259 | } |