blob: 9218cc9bc3f856b11af769525afe44e800886c9d [file] [log] [blame]
Makoto Onuki3aefe332023-10-06 10:02:07 -07001// 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
16// framework-minus-apex.ravenwood. Otherwise, soong would mix up the arch (?) and we'd get
17// a dex jar.
18java_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.
29java_genrule_host {
30 name: "framework-minus-apex.ravenwood-base",
31 tools: ["hoststubgen"],
32 cmd: "$(location hoststubgen) " +
33 "@$(location :ravenwood-standard-options) " +
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) " +
42 "--policy-override-file $(location framework-minus-apex-ravenwood-policies.txt) ",
43 srcs: [
44 ":framework-minus-apex-for-hoststubgen",
45 "framework-minus-apex-ravenwood-policies.txt",
46 ":ravenwood-standard-options",
47 ],
48 out: [
49 "ravenwood.jar",
50 "ravenwood_stub.jar", // It's not used. TODO: Update hoststubgen to make it optional.
51
52 // Following files are created just as FYI.
53 "hoststubgen_keep_all.txt",
54 "hoststubgen_dump.txt",
55 ],
56 visibility: ["//visibility:private"],
57}
58
59// Extract the impl jar from "framework-minus-apex.ravenwood-base" for subsequent build rules.
60java_genrule_host {
61 name: "framework-minus-apex.ravenwood",
62 cmd: "cp $(in) $(out)",
63 srcs: [
64 ":framework-minus-apex.ravenwood-base{ravenwood.jar}",
65 ],
66 out: [
67 "framework-minus-apex.ravenwood.jar",
68 ],
69 visibility: ["//visibility:public"],
70}