blob: 2df6d5811d44891a2226b6a198c541ed3b381c46 [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
Makoto Onukic69a84e2023-10-20 10:43:55 -070016// framework-minus-apex.ravenwood-base. Otherwise, soong would mix up the arch (?) and we'd get
Makoto Onuki3aefe332023-10-06 10:02:07 -070017// 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.
Makoto Onukic69a84e2023-10-20 10:43:55 -070029java_genrule {
Makoto Onuki3aefe332023-10-06 10:02:07 -070030 name: "framework-minus-apex.ravenwood-base",
31 tools: ["hoststubgen"],
32 cmd: "$(location hoststubgen) " +
Makoto Onuki743a58a2023-11-09 12:46:31 -080033 "@$(location ravenwood/ravenwood-standard-options.txt) " +
Makoto Onuki3aefe332023-10-06 10:02:07 -070034
Makoto Onuki623cffb2023-11-29 10:45:06 -080035 "--debug-log $(location hoststubgen_framework-minus-apex.log) " +
Jeff Sharkeyd2cc1912024-02-09 14:37:10 -070036 "--stats-file $(location hoststubgen_framework-minus-apex_stats.csv) " +
Makoto Onuki623cffb2023-11-29 10:45:06 -080037
Makoto Onuki3aefe332023-10-06 10:02:07 -070038 "--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 Onuki743a58a2023-11-09 12:46:31 -080044 "--policy-override-file $(location ravenwood/framework-minus-apex-ravenwood-policies.txt) " +
45 "--annotation-allowed-classes-file $(location ravenwood/ravenwood-annotation-allowed-classes.txt) ",
Makoto Onuki3aefe332023-10-06 10:02:07 -070046 srcs: [
47 ":framework-minus-apex-for-hoststubgen",
Makoto Onuki743a58a2023-11-09 12:46:31 -080048 "ravenwood/framework-minus-apex-ravenwood-policies.txt",
49 "ravenwood/ravenwood-standard-options.txt",
50 "ravenwood/ravenwood-annotation-allowed-classes.txt",
Makoto Onuki3aefe332023-10-06 10:02:07 -070051 ],
52 out: [
53 "ravenwood.jar",
Makoto Onuki3aefe332023-10-06 10:02:07 -070054
55 // Following files are created just as FYI.
56 "hoststubgen_keep_all.txt",
57 "hoststubgen_dump.txt",
Makoto Onuki623cffb2023-11-29 10:45:06 -080058
59 "hoststubgen_framework-minus-apex.log",
Jeff Sharkeyd2cc1912024-02-09 14:37:10 -070060 "hoststubgen_framework-minus-apex_stats.csv",
Makoto Onuki3aefe332023-10-06 10:02:07 -070061 ],
62 visibility: ["//visibility:private"],
63}
64
65// Extract the impl jar from "framework-minus-apex.ravenwood-base" for subsequent build rules.
Makoto Onukic69a84e2023-10-20 10:43:55 -070066// Note this emits a "device side" output, so that ravenwood tests can (implicitly)
67// depend on it.
68java_genrule {
Makoto Onuki3aefe332023-10-06 10:02:07 -070069 name: "framework-minus-apex.ravenwood",
Makoto Onuki8bcc6282023-12-18 14:03:59 -080070 defaults: ["ravenwood-internal-only-visibility-genrule"],
Makoto Onuki3aefe332023-10-06 10:02:07 -070071 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 Onuki3aefe332023-10-06 10:02:07 -070078}
Makoto Onukic69a84e2023-10-20 10:43:55 -070079
Jeff Sharkeyed81c782024-01-11 13:29:07 -070080java_library {
Jeff Sharkey3e91c2b2024-02-15 14:12:07 -070081 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
90java_genrule {
91 name: "services.core.ravenwood-base",
92 tools: ["hoststubgen"],
93 cmd: "$(location hoststubgen) " +
94 "@$(location ravenwood/ravenwood-standard-options.txt) " +
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) " +
105 "--policy-override-file $(location ravenwood/services.core-ravenwood-policies.txt) " +
106 "--annotation-allowed-classes-file $(location ravenwood/ravenwood-annotation-allowed-classes.txt) ",
107 srcs: [
108 ":services.core-for-hoststubgen",
109 "ravenwood/services.core-ravenwood-policies.txt",
110 "ravenwood/ravenwood-standard-options.txt",
111 "ravenwood/ravenwood-annotation-allowed-classes.txt",
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
126java_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
138java_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
147java_library {
Jeff Sharkeyed81c782024-01-11 13:29:07 -0700148 name: "mockito-ravenwood-prebuilt",
149 installable: false,
150 static_libs: [
151 "mockito-robolectric-prebuilt",
152 ],
153}
154
155java_library {
156 name: "inline-mockito-ravenwood-prebuilt",
157 installable: false,
158 static_libs: [
159 "inline-mockito-robolectric-prebuilt",
160 ],
161}
162
Makoto Onuki053eac82024-02-13 10:31:18 -0800163// Jars in "ravenwood-runtime" are set to the classpath, sorted alphabetically.
164// Rename some of the dependencies to make sure they're included in the intended order.
165java_genrule {
166 name: "100-framework-minus-apex.ravenwood",
167 cmd: "cp $(in) $(out)",
168 srcs: [":framework-minus-apex.ravenwood"],
169 out: ["100-framework-minus-apex.ravenwood.jar"],
170 visibility: ["//visibility:private"],
171}
172
173java_genrule {
174 // Use 200 to make sure it comes before the mainline stub ("all-updatable...").
175 name: "200-kxml2-android",
176 cmd: "cp $(in) $(out)",
177 srcs: [":kxml2-android"],
178 out: ["200-kxml2-android.jar"],
179 visibility: ["//visibility:private"],
180}
181
Makoto Onukic69a84e2023-10-20 10:43:55 -0700182android_ravenwood_libgroup {
183 name: "ravenwood-runtime",
184 libs: [
Makoto Onuki053eac82024-02-13 10:31:18 -0800185 "100-framework-minus-apex.ravenwood",
Jeff Sharkey1e928352024-02-12 13:44:49 -0700186 "200-kxml2-android",
Jeff Sharkey7c495072024-01-11 13:26:25 -0700187 "all-updatable-modules-system-stubs",
Jeff Sharkey1e928352024-02-12 13:44:49 -0700188 "android.test.mock.ravenwood",
Makoto Onuki053eac82024-02-13 10:31:18 -0800189 "ravenwood-helper-runtime",
Jeff Sharkey1e928352024-02-12 13:44:49 -0700190 "hoststubgen-helper-runtime.ravenwood",
Jeff Sharkey3e91c2b2024-02-15 14:12:07 -0700191 "services.core.ravenwood-jarjar",
Jeff Sharkey1e928352024-02-12 13:44:49 -0700192
193 // Provide runtime versions of utils linked in below
Jeff Sharkey91f414e2023-11-07 15:43:59 -0700194 "junit",
195 "truth",
Jeff Sharkey41cfbb32023-11-16 09:26:28 -0700196 "ravenwood-junit-impl",
Jeff Sharkeyed81c782024-01-11 13:29:07 -0700197 "mockito-ravenwood-prebuilt",
198 "inline-mockito-ravenwood-prebuilt",
Makoto Onukic69a84e2023-10-20 10:43:55 -0700199 ],
200}
201
202android_ravenwood_libgroup {
203 name: "ravenwood-utils",
Jeff Sharkey91f414e2023-11-07 15:43:59 -0700204 libs: [
205 "junit",
206 "truth",
207 "ravenwood-junit",
Jeff Sharkeyed81c782024-01-11 13:29:07 -0700208 "mockito-ravenwood-prebuilt",
209 "inline-mockito-ravenwood-prebuilt",
Jeff Sharkey91f414e2023-11-07 15:43:59 -0700210 ],
Makoto Onukic69a84e2023-10-20 10:43:55 -0700211}