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 | 743a58a | 2023-11-09 12:46:31 -0800 | [diff] [blame] | 33 | "@$(location ravenwood/ravenwood-standard-options.txt) " + |
Makoto Onuki | 3aefe33 | 2023-10-06 10:02:07 -0700 | [diff] [blame] | 34 | |
| 35 | "--out-stub-jar $(location ravenwood_stub.jar) " + |
| 36 | "--out-impl-jar $(location ravenwood.jar) " + |
| 37 | |
| 38 | "--gen-keep-all-file $(location hoststubgen_keep_all.txt) " + |
| 39 | "--gen-input-dump-file $(location hoststubgen_dump.txt) " + |
| 40 | |
| 41 | "--in-jar $(location :framework-minus-apex-for-hoststubgen) " + |
Makoto Onuki | 743a58a | 2023-11-09 12:46:31 -0800 | [diff] [blame] | 42 | "--policy-override-file $(location ravenwood/framework-minus-apex-ravenwood-policies.txt) " + |
| 43 | "--annotation-allowed-classes-file $(location ravenwood/ravenwood-annotation-allowed-classes.txt) ", |
Makoto Onuki | 3aefe33 | 2023-10-06 10:02:07 -0700 | [diff] [blame] | 44 | srcs: [ |
| 45 | ":framework-minus-apex-for-hoststubgen", |
Makoto Onuki | 743a58a | 2023-11-09 12:46:31 -0800 | [diff] [blame] | 46 | "ravenwood/framework-minus-apex-ravenwood-policies.txt", |
| 47 | "ravenwood/ravenwood-standard-options.txt", |
| 48 | "ravenwood/ravenwood-annotation-allowed-classes.txt", |
Makoto Onuki | 3aefe33 | 2023-10-06 10:02:07 -0700 | [diff] [blame] | 49 | ], |
| 50 | out: [ |
| 51 | "ravenwood.jar", |
| 52 | "ravenwood_stub.jar", // It's not used. TODO: Update hoststubgen to make it optional. |
| 53 | |
| 54 | // Following files are created just as FYI. |
| 55 | "hoststubgen_keep_all.txt", |
| 56 | "hoststubgen_dump.txt", |
| 57 | ], |
| 58 | visibility: ["//visibility:private"], |
| 59 | } |
| 60 | |
| 61 | // 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] | 62 | // Note this emits a "device side" output, so that ravenwood tests can (implicitly) |
| 63 | // depend on it. |
| 64 | java_genrule { |
Makoto Onuki | 3aefe33 | 2023-10-06 10:02:07 -0700 | [diff] [blame] | 65 | name: "framework-minus-apex.ravenwood", |
Makoto Onuki | 0814263 | 2023-10-16 10:41:28 -0700 | [diff] [blame] | 66 | defaults: ["hoststubgen-for-prototype-only-genrule"], |
Makoto Onuki | 3aefe33 | 2023-10-06 10:02:07 -0700 | [diff] [blame] | 67 | cmd: "cp $(in) $(out)", |
| 68 | srcs: [ |
| 69 | ":framework-minus-apex.ravenwood-base{ravenwood.jar}", |
| 70 | ], |
| 71 | out: [ |
| 72 | "framework-minus-apex.ravenwood.jar", |
| 73 | ], |
Makoto Onuki | 3aefe33 | 2023-10-06 10:02:07 -0700 | [diff] [blame] | 74 | } |
Makoto Onuki | c69a84e | 2023-10-20 10:43:55 -0700 | [diff] [blame] | 75 | |
| 76 | android_ravenwood_libgroup { |
| 77 | name: "ravenwood-runtime", |
| 78 | libs: [ |
| 79 | "framework-minus-apex.ravenwood", |
| 80 | "hoststubgen-helper-runtime.ravenwood", |
| 81 | "hoststubgen-helper-framework-runtime.ravenwood", |
Jeff Sharkey | 91f414e | 2023-11-07 15:43:59 -0700 | [diff] [blame] | 82 | "junit", |
| 83 | "truth", |
Jeff Sharkey | 41cfbb3 | 2023-11-16 09:26:28 -0700 | [diff] [blame^] | 84 | "ravenwood-junit-impl", |
Jeff Sharkey | 7306771 | 2023-11-13 11:09:27 -0700 | [diff] [blame] | 85 | "android.test.mock", |
Makoto Onuki | c69a84e | 2023-10-20 10:43:55 -0700 | [diff] [blame] | 86 | ], |
| 87 | } |
| 88 | |
| 89 | android_ravenwood_libgroup { |
| 90 | name: "ravenwood-utils", |
Jeff Sharkey | 91f414e | 2023-11-07 15:43:59 -0700 | [diff] [blame] | 91 | libs: [ |
| 92 | "junit", |
| 93 | "truth", |
| 94 | "ravenwood-junit", |
| 95 | ], |
Makoto Onuki | c69a84e | 2023-10-20 10:43:55 -0700 | [diff] [blame] | 96 | } |