| 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 | 7ddc877 | 2024-07-17 12:54:11 -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 | 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 | 7ddc877 | 2024-07-17 12:54:11 -0700 | [diff] [blame] | 44 | "--policy-override-file $(location :ravenwood-framework-policies) " + | 
|  | 45 | "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) ", | 
| Makoto Onuki | 3aefe33 | 2023-10-06 10:02:07 -0700 | [diff] [blame] | 46 | srcs: [ | 
|  | 47 | ":framework-minus-apex-for-hoststubgen", | 
| Makoto Onuki | 7ddc877 | 2024-07-17 12:54:11 -0700 | [diff] [blame] | 48 | ":ravenwood-framework-policies", | 
|  | 49 | ":ravenwood-standard-options", | 
|  | 50 | ":ravenwood-annotation-allowed-classes", | 
| 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 |  | 
| Jeff Sharkey | ed81c78 | 2024-01-11 13:29:07 -0700 | [diff] [blame] | 80 | java_library { | 
| Jeff Sharkey | 3e91c2b | 2024-02-15 14:12:07 -0700 | [diff] [blame] | 81 | name: "services.core-for-hoststubgen", | 
|  | 82 | installable: false, // host only jar. | 
|  | 83 | static_libs: [ | 
|  | 84 | "services.core", | 
|  | 85 | ], | 
|  | 86 | sdk_version: "core_platform", | 
|  | 87 | visibility: ["//visibility:private"], | 
|  | 88 | } | 
|  | 89 |  | 
|  | 90 | java_genrule { | 
|  | 91 | name: "services.core.ravenwood-base", | 
|  | 92 | tools: ["hoststubgen"], | 
|  | 93 | cmd: "$(location hoststubgen) " + | 
| Makoto Onuki | 7ddc877 | 2024-07-17 12:54:11 -0700 | [diff] [blame] | 94 | "@$(location :ravenwood-standard-options) " + | 
| Jeff Sharkey | 3e91c2b | 2024-02-15 14:12:07 -0700 | [diff] [blame] | 95 |  | 
|  | 96 | "--debug-log $(location hoststubgen_services.core.log) " + | 
|  | 97 | "--stats-file $(location hoststubgen_services.core_stats.csv) " + | 
|  | 98 |  | 
|  | 99 | "--out-impl-jar $(location ravenwood.jar) " + | 
|  | 100 |  | 
|  | 101 | "--gen-keep-all-file $(location hoststubgen_keep_all.txt) " + | 
|  | 102 | "--gen-input-dump-file $(location hoststubgen_dump.txt) " + | 
|  | 103 |  | 
|  | 104 | "--in-jar $(location :services.core-for-hoststubgen) " + | 
| Makoto Onuki | 7ddc877 | 2024-07-17 12:54:11 -0700 | [diff] [blame] | 105 | "--policy-override-file $(location :ravenwood-services-policies) " + | 
|  | 106 | "--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) ", | 
| Jeff Sharkey | 3e91c2b | 2024-02-15 14:12:07 -0700 | [diff] [blame] | 107 | srcs: [ | 
|  | 108 | ":services.core-for-hoststubgen", | 
| Makoto Onuki | 7ddc877 | 2024-07-17 12:54:11 -0700 | [diff] [blame] | 109 | ":ravenwood-services-policies", | 
|  | 110 | ":ravenwood-standard-options", | 
|  | 111 | ":ravenwood-annotation-allowed-classes", | 
| Jeff Sharkey | 3e91c2b | 2024-02-15 14:12:07 -0700 | [diff] [blame] | 112 | ], | 
|  | 113 | out: [ | 
|  | 114 | "ravenwood.jar", | 
|  | 115 |  | 
|  | 116 | // Following files are created just as FYI. | 
|  | 117 | "hoststubgen_keep_all.txt", | 
|  | 118 | "hoststubgen_dump.txt", | 
|  | 119 |  | 
|  | 120 | "hoststubgen_services.core.log", | 
|  | 121 | "hoststubgen_services.core_stats.csv", | 
|  | 122 | ], | 
|  | 123 | visibility: ["//visibility:private"], | 
|  | 124 | } | 
|  | 125 |  | 
|  | 126 | java_genrule { | 
|  | 127 | name: "services.core.ravenwood", | 
|  | 128 | defaults: ["ravenwood-internal-only-visibility-genrule"], | 
|  | 129 | cmd: "cp $(in) $(out)", | 
|  | 130 | srcs: [ | 
|  | 131 | ":services.core.ravenwood-base{ravenwood.jar}", | 
|  | 132 | ], | 
|  | 133 | out: [ | 
|  | 134 | "services.core.ravenwood.jar", | 
|  | 135 | ], | 
|  | 136 | } | 
|  | 137 |  | 
|  | 138 | java_library { | 
|  | 139 | name: "services.core.ravenwood-jarjar", | 
|  | 140 | installable: false, | 
|  | 141 | static_libs: [ | 
|  | 142 | "services.core.ravenwood", | 
|  | 143 | ], | 
|  | 144 | jarjar_rules: ":ravenwood-services-jarjar-rules", | 
|  | 145 | } | 
|  | 146 |  | 
|  | 147 | java_library { | 
| Jeff Sharkey | 16f7cdf | 2024-02-21 09:46:20 -0700 | [diff] [blame] | 148 | name: "services.fakes.ravenwood-jarjar", | 
|  | 149 | installable: false, | 
|  | 150 | srcs: [":services.fakes-sources"], | 
|  | 151 | libs: [ | 
| Jeff Sharkey | 8a922ec | 2024-02-27 12:36:36 -0700 | [diff] [blame] | 152 | "ravenwood-framework", | 
| Jeff Sharkey | 16f7cdf | 2024-02-21 09:46:20 -0700 | [diff] [blame] | 153 | "services.core.ravenwood", | 
|  | 154 | ], | 
|  | 155 | jarjar_rules: ":ravenwood-services-jarjar-rules", | 
|  | 156 | } | 
|  | 157 |  | 
|  | 158 | java_library { | 
| Jeff Sharkey | ed81c78 | 2024-01-11 13:29:07 -0700 | [diff] [blame] | 159 | name: "mockito-ravenwood-prebuilt", | 
|  | 160 | installable: false, | 
|  | 161 | static_libs: [ | 
|  | 162 | "mockito-robolectric-prebuilt", | 
|  | 163 | ], | 
|  | 164 | } | 
|  | 165 |  | 
|  | 166 | java_library { | 
|  | 167 | name: "inline-mockito-ravenwood-prebuilt", | 
|  | 168 | installable: false, | 
|  | 169 | static_libs: [ | 
|  | 170 | "inline-mockito-robolectric-prebuilt", | 
|  | 171 | ], | 
|  | 172 | } | 
|  | 173 |  | 
| Makoto Onuki | 053eac8 | 2024-02-13 10:31:18 -0800 | [diff] [blame] | 174 | // Jars in "ravenwood-runtime" are set to the classpath, sorted alphabetically. | 
|  | 175 | // Rename some of the dependencies to make sure they're included in the intended order. | 
|  | 176 | java_genrule { | 
|  | 177 | name: "100-framework-minus-apex.ravenwood", | 
|  | 178 | cmd: "cp $(in) $(out)", | 
|  | 179 | srcs: [":framework-minus-apex.ravenwood"], | 
|  | 180 | out: ["100-framework-minus-apex.ravenwood.jar"], | 
|  | 181 | visibility: ["//visibility:private"], | 
|  | 182 | } | 
|  | 183 |  | 
|  | 184 | java_genrule { | 
|  | 185 | // Use 200 to make sure it comes before the mainline stub ("all-updatable..."). | 
|  | 186 | name: "200-kxml2-android", | 
|  | 187 | cmd: "cp $(in) $(out)", | 
|  | 188 | srcs: [":kxml2-android"], | 
|  | 189 | out: ["200-kxml2-android.jar"], | 
|  | 190 | visibility: ["//visibility:private"], | 
|  | 191 | } | 
|  | 192 |  | 
| Makoto Onuki | 12a7a31 | 2024-05-10 12:49:24 -0700 | [diff] [blame^] | 193 | java_genrule { | 
|  | 194 | name: "z00-all-updatable-modules-system-stubs", | 
|  | 195 | cmd: "cp $(in) $(out)", | 
|  | 196 | srcs: [":all-updatable-modules-system-stubs"], | 
|  | 197 | out: ["z00-all-updatable-modules-system-stubs.jar"], | 
|  | 198 | visibility: ["//visibility:private"], | 
|  | 199 | } | 
|  | 200 |  | 
| Makoto Onuki | c69a84e | 2023-10-20 10:43:55 -0700 | [diff] [blame] | 201 | android_ravenwood_libgroup { | 
|  | 202 | name: "ravenwood-runtime", | 
|  | 203 | libs: [ | 
| Makoto Onuki | 053eac8 | 2024-02-13 10:31:18 -0800 | [diff] [blame] | 204 | "100-framework-minus-apex.ravenwood", | 
| Jeff Sharkey | 1e92835 | 2024-02-12 13:44:49 -0700 | [diff] [blame] | 205 | "200-kxml2-android", | 
| Makoto Onuki | 12a7a31 | 2024-05-10 12:49:24 -0700 | [diff] [blame^] | 206 |  | 
| Jeff Sharkey | 1e92835 | 2024-02-12 13:44:49 -0700 | [diff] [blame] | 207 | "android.test.mock.ravenwood", | 
| Makoto Onuki | 053eac8 | 2024-02-13 10:31:18 -0800 | [diff] [blame] | 208 | "ravenwood-helper-runtime", | 
| Jeff Sharkey | 1e92835 | 2024-02-12 13:44:49 -0700 | [diff] [blame] | 209 | "hoststubgen-helper-runtime.ravenwood", | 
| Jeff Sharkey | 3e91c2b | 2024-02-15 14:12:07 -0700 | [diff] [blame] | 210 | "services.core.ravenwood-jarjar", | 
| Jeff Sharkey | 16f7cdf | 2024-02-21 09:46:20 -0700 | [diff] [blame] | 211 | "services.fakes.ravenwood-jarjar", | 
| Jeff Sharkey | 1e92835 | 2024-02-12 13:44:49 -0700 | [diff] [blame] | 212 |  | 
|  | 213 | // Provide runtime versions of utils linked in below | 
| Jeff Sharkey | 91f414e | 2023-11-07 15:43:59 -0700 | [diff] [blame] | 214 | "junit", | 
|  | 215 | "truth", | 
| Jeff Sharkey | 7037e35 | 2024-02-27 14:22:24 -0700 | [diff] [blame] | 216 | "flag-junit", | 
| Jeff Sharkey | 8a922ec | 2024-02-27 12:36:36 -0700 | [diff] [blame] | 217 | "ravenwood-framework", | 
| Jeff Sharkey | 41cfbb3 | 2023-11-16 09:26:28 -0700 | [diff] [blame] | 218 | "ravenwood-junit-impl", | 
| Jeff Sharkey | 7037e35 | 2024-02-27 14:22:24 -0700 | [diff] [blame] | 219 | "ravenwood-junit-impl-flag", | 
| Jeff Sharkey | ed81c78 | 2024-01-11 13:29:07 -0700 | [diff] [blame] | 220 | "mockito-ravenwood-prebuilt", | 
|  | 221 | "inline-mockito-ravenwood-prebuilt", | 
| Makoto Onuki | 12a7a31 | 2024-05-10 12:49:24 -0700 | [diff] [blame^] | 222 |  | 
|  | 223 | // It's a stub, so it should be towards the end. | 
|  | 224 | "z00-all-updatable-modules-system-stubs", | 
| Makoto Onuki | c69a84e | 2023-10-20 10:43:55 -0700 | [diff] [blame] | 225 | ], | 
| Makoto Onuki | 50276f0 | 2024-02-13 14:58:56 -0800 | [diff] [blame] | 226 | jni_libs: [ | 
|  | 227 | "libandroid_runtime", | 
|  | 228 | ], | 
| Makoto Onuki | c69a84e | 2023-10-20 10:43:55 -0700 | [diff] [blame] | 229 | } | 
|  | 230 |  | 
|  | 231 | android_ravenwood_libgroup { | 
|  | 232 | name: "ravenwood-utils", | 
| Jeff Sharkey | 91f414e | 2023-11-07 15:43:59 -0700 | [diff] [blame] | 233 | libs: [ | 
|  | 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 | 91f414e | 2023-11-07 15:43:59 -0700 | [diff] [blame] | 238 | "ravenwood-junit", | 
| Jeff Sharkey | ed81c78 | 2024-01-11 13:29:07 -0700 | [diff] [blame] | 239 | "mockito-ravenwood-prebuilt", | 
|  | 240 | "inline-mockito-ravenwood-prebuilt", | 
| Jeff Sharkey | 91f414e | 2023-11-07 15:43:59 -0700 | [diff] [blame] | 241 | ], | 
| Makoto Onuki | c69a84e | 2023-10-20 10:43:55 -0700 | [diff] [blame] | 242 | } |