Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 2abff41

Browse files
committed
[Ravenwood] Move Ravenwood processing out of individual repos
Move all Ravenwood specific bytecode post-processing steps outside of individual repo/modules and move it to f/b/ravenwood. Flag: EXEMPT host test change only Bug: 292141694 Test: $ANDROID_BUILD_TOP/frameworks/base/ravenwood/scripts/run-ravenwood-tests.sh Change-Id: I8f7a30a0da970dea0d400844b577cf3595e77943
1 parent b1815bd commit 2abff41

File tree

4 files changed

+331
-256
lines changed

4 files changed

+331
-256
lines changed

Android.bp

-6
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,6 @@ java_library {
168168
//same purpose.
169169
"//external/robolectric:__subpackages__",
170170
"//frameworks/layoutlib:__subpackages__",
171-
172-
// This is for the same purpose as robolectric -- to build "framework.jar" for host-side
173-
// testing.
174-
// TODO: Once Ravenwood is stable, move the host side jar targets to this directory,
175-
// and remove this line.
176-
"//frameworks/base/tools/hoststubgen:__subpackages__",
177171
],
178172
}
179173

Ravenwood.bp

+9-246
Original file line numberDiff line numberDiff line change
@@ -12,256 +12,19 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
// We need this "trampoline" rule to force soong to give a host-side jar to
16-
// framework-minus-apex.ravenwood-base. Otherwise, soong would mix up the arch (?) and we'd get
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-
// Process framework-all with hoststubgen for Ravenwood.
29-
// This step takes several tens of seconds, so we manually shard it to multiple modules.
30-
// All the copies have to be kept in sync.
31-
// TODO: Do the sharding better, either by making hostsubgen support sharding natively, or
32-
// making a better build rule.
33-
34-
genrule_defaults {
35-
name: "framework-minus-apex.ravenwood-base_defaults",
36-
defaults: ["ravenwood-internal-only-visibility-genrule"],
37-
tools: ["hoststubgen"],
38-
srcs: [
39-
":framework-minus-apex-for-hoststubgen",
40-
":ravenwood-framework-policies",
41-
":ravenwood-standard-options",
42-
":ravenwood-annotation-allowed-classes",
43-
],
44-
out: [
45-
"ravenwood.jar",
46-
"hoststubgen_framework-minus-apex.log",
47-
],
48-
}
49-
50-
framework_minus_apex_cmd = "$(location hoststubgen) " +
51-
"@$(location :ravenwood-standard-options) " +
52-
"--debug-log $(location hoststubgen_framework-minus-apex.log) " +
53-
"--out-jar $(location ravenwood.jar) " +
54-
"--in-jar $(location :framework-minus-apex-for-hoststubgen) " +
55-
"--policy-override-file $(location :ravenwood-framework-policies) " +
56-
"--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) "
57-
58-
java_genrule {
59-
name: "framework-minus-apex.ravenwood-base_X0",
60-
defaults: ["framework-minus-apex.ravenwood-base_defaults"],
61-
cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 0",
62-
}
63-
64-
java_genrule {
65-
name: "framework-minus-apex.ravenwood-base_X1",
66-
defaults: ["framework-minus-apex.ravenwood-base_defaults"],
67-
cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 1",
68-
}
69-
70-
java_genrule {
71-
name: "framework-minus-apex.ravenwood-base_X2",
72-
defaults: ["framework-minus-apex.ravenwood-base_defaults"],
73-
cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 2",
74-
}
75-
76-
java_genrule {
77-
name: "framework-minus-apex.ravenwood-base_X3",
78-
defaults: ["framework-minus-apex.ravenwood-base_defaults"],
79-
cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 3",
80-
}
81-
82-
java_genrule {
83-
name: "framework-minus-apex.ravenwood-base_X4",
84-
defaults: ["framework-minus-apex.ravenwood-base_defaults"],
85-
cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 4",
86-
}
87-
88-
java_genrule {
89-
name: "framework-minus-apex.ravenwood-base_X5",
90-
defaults: ["framework-minus-apex.ravenwood-base_defaults"],
91-
cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 5",
92-
}
93-
94-
java_genrule {
95-
name: "framework-minus-apex.ravenwood-base_X6",
96-
defaults: ["framework-minus-apex.ravenwood-base_defaults"],
97-
cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 6",
98-
}
99-
100-
java_genrule {
101-
name: "framework-minus-apex.ravenwood-base_X7",
102-
defaults: ["framework-minus-apex.ravenwood-base_defaults"],
103-
cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 7",
104-
}
105-
106-
java_genrule {
107-
name: "framework-minus-apex.ravenwood-base_X8",
108-
defaults: ["framework-minus-apex.ravenwood-base_defaults"],
109-
cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 8",
110-
}
111-
112-
java_genrule {
113-
name: "framework-minus-apex.ravenwood-base_X9",
114-
defaults: ["framework-minus-apex.ravenwood-base_defaults"],
115-
cmd: framework_minus_apex_cmd + " --num-shards 10 --shard-index 9",
116-
}
117-
118-
// Build framework-minus-apex.ravenwood-base without sharding.
119-
// We extract the various dump files from this one, rather than the sharded ones, because
120-
// some dumps use the output from other classes (e.g. base classes) which may not be in the
121-
// same shard. Also some of the dump files ("apis") may be slow even when sharded, because
122-
// the output contains the information from all the input classes, rather than the output classes.
123-
// Not using sharding is fine for this module because it's only used for collecting the
124-
// dump / stats files, which don't have to happen regularly.
125-
java_genrule {
126-
name: "framework-minus-apex.ravenwood-base_all",
127-
defaults: ["framework-minus-apex.ravenwood-base_defaults"],
128-
cmd: framework_minus_apex_cmd +
129-
"--stats-file $(location hoststubgen_framework-minus-apex_stats.csv) " +
130-
"--supported-api-list-file $(location hoststubgen_framework-minus-apex_apis.csv) " +
131-
132-
"--gen-keep-all-file $(location hoststubgen_framework-minus-apex_keep_all.txt) " +
133-
"--gen-input-dump-file $(location hoststubgen_framework-minus-apex_dump.txt) ",
134-
135-
out: [
136-
"hoststubgen_framework-minus-apex_keep_all.txt",
137-
"hoststubgen_framework-minus-apex_dump.txt",
138-
"hoststubgen_framework-minus-apex_stats.csv",
139-
"hoststubgen_framework-minus-apex_apis.csv",
140-
],
141-
}
142-
143-
// Marge all the sharded jars
144-
java_genrule {
145-
name: "framework-minus-apex.ravenwood",
146-
defaults: ["ravenwood-internal-only-visibility-java"],
147-
cmd: "$(location merge_zips) $(out) $(in)",
148-
tools: ["merge_zips"],
149-
srcs: [
150-
":framework-minus-apex.ravenwood-base_X0{ravenwood.jar}",
151-
":framework-minus-apex.ravenwood-base_X1{ravenwood.jar}",
152-
":framework-minus-apex.ravenwood-base_X2{ravenwood.jar}",
153-
":framework-minus-apex.ravenwood-base_X3{ravenwood.jar}",
154-
":framework-minus-apex.ravenwood-base_X4{ravenwood.jar}",
155-
":framework-minus-apex.ravenwood-base_X5{ravenwood.jar}",
156-
":framework-minus-apex.ravenwood-base_X6{ravenwood.jar}",
157-
":framework-minus-apex.ravenwood-base_X7{ravenwood.jar}",
158-
":framework-minus-apex.ravenwood-base_X8{ravenwood.jar}",
159-
":framework-minus-apex.ravenwood-base_X9{ravenwood.jar}",
160-
],
161-
out: [
162-
"framework-minus-apex.ravenwood.jar",
163-
],
164-
}
15+
// "framework-minus-apex" and "all-updatable-modules-system-stubs" are not
16+
// visible publicly. We re-export them to Ravenwood in this file.
16517

16618
java_library {
167-
name: "services.core-for-hoststubgen",
168-
installable: false, // host only jar.
169-
static_libs: [
170-
"services.core",
171-
],
172-
sdk_version: "core_platform",
173-
visibility: ["//visibility:private"],
174-
}
175-
176-
java_genrule {
177-
name: "services.core.ravenwood-base",
178-
tools: ["hoststubgen"],
179-
cmd: "$(location hoststubgen) " +
180-
"@$(location :ravenwood-standard-options) " +
181-
182-
"--debug-log $(location hoststubgen_services.core.log) " +
183-
"--stats-file $(location hoststubgen_services.core_stats.csv) " +
184-
"--supported-api-list-file $(location hoststubgen_services.core_apis.csv) " +
185-
186-
"--out-jar $(location ravenwood.jar) " +
187-
188-
"--gen-keep-all-file $(location hoststubgen_services.core_keep_all.txt) " +
189-
"--gen-input-dump-file $(location hoststubgen_services.core_dump.txt) " +
190-
191-
"--in-jar $(location :services.core-for-hoststubgen) " +
192-
"--policy-override-file $(location :ravenwood-services-policies) " +
193-
"--annotation-allowed-classes-file $(location :ravenwood-annotation-allowed-classes) ",
194-
srcs: [
195-
":services.core-for-hoststubgen",
196-
":ravenwood-services-policies",
197-
":ravenwood-standard-options",
198-
":ravenwood-annotation-allowed-classes",
199-
],
200-
out: [
201-
"ravenwood.jar",
202-
203-
// Following files are created just as FYI.
204-
"hoststubgen_services.core_keep_all.txt",
205-
"hoststubgen_services.core_dump.txt",
206-
207-
"hoststubgen_services.core.log",
208-
"hoststubgen_services.core_stats.csv",
209-
"hoststubgen_services.core_apis.csv",
210-
],
211-
defaults: ["ravenwood-internal-only-visibility-genrule"],
212-
}
213-
214-
java_genrule {
215-
name: "services.core.ravenwood",
216-
defaults: ["ravenwood-internal-only-visibility-genrule"],
217-
cmd: "cp $(in) $(out)",
218-
srcs: [
219-
":services.core.ravenwood-base{ravenwood.jar}",
220-
],
221-
out: [
222-
"services.core.ravenwood.jar",
223-
],
224-
}
225-
226-
// TODO(b/313930116) This jarjar is a bit slow. We should use hoststubgen for renaming,
227-
// but services.core.ravenwood has complex dependencies, so it'll take more than
228-
// just using hoststubgen "rename"s.
229-
java_library {
230-
name: "services.core.ravenwood-jarjar",
231-
defaults: ["ravenwood-internal-only-visibility-java"],
19+
name: "framework-minus-apex-for-host",
23220
installable: false,
233-
static_libs: [
234-
"services.core.ravenwood",
235-
],
236-
jarjar_rules: ":ravenwood-services-jarjar-rules",
21+
static_libs: ["framework-minus-apex"],
22+
visibility: ["//frameworks/base/ravenwood"],
23723
}
23824

239-
// Jars in "ravenwood-runtime" are set to the classpath, sorted alphabetically.
240-
// Rename some of the dependencies to make sure they're included in the intended order.
24125
java_library {
242-
name: "100-framework-minus-apex.ravenwood",
243-
defaults: ["ravenwood-internal-only-visibility-java"],
244-
static_libs: [
245-
"framework-minus-apex.ravenwood",
246-
],
247-
sdk_version: "core_platform",
248-
// See b/313930116. Jarjar is too slow on this jar. We use HostStubGen to do the rename.
249-
// jarjar_rules: ":ravenwood-framework-jarjar-rules",
250-
}
251-
252-
java_genrule {
253-
// Use 200 to make sure it comes before the mainline stub ("all-updatable...").
254-
name: "200-kxml2-android",
255-
defaults: ["ravenwood-internal-only-visibility-genrule"],
256-
cmd: "cp $(in) $(out)",
257-
srcs: [":kxml2-android"],
258-
out: ["200-kxml2-android.jar"],
259-
}
260-
261-
java_genrule {
262-
name: "z00-all-updatable-modules-system-stubs",
263-
defaults: ["ravenwood-internal-only-visibility-genrule"],
264-
cmd: "cp $(in) $(out)",
265-
srcs: [":all-updatable-modules-system-stubs"],
266-
out: ["z00-all-updatable-modules-system-stubs.jar"],
26+
name: "all-updatable-modules-system-stubs-for-host",
27+
installable: false,
28+
static_libs: ["all-updatable-modules-system-stubs"],
29+
visibility: ["//frameworks/base/ravenwood"],
26730
}

ravenwood/Android.bp

+32-4
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,31 @@ filegroup {
1616
srcs: [
1717
"texts/ravenwood-services-policies.txt",
1818
],
19-
visibility: ["//visibility:public"],
19+
visibility: ["//visibility:private"],
2020
}
2121

2222
filegroup {
2323
name: "ravenwood-framework-policies",
2424
srcs: [
2525
"texts/ravenwood-framework-policies.txt",
2626
],
27-
visibility: ["//visibility:public"],
27+
visibility: ["//visibility:private"],
2828
}
2929

3030
filegroup {
3131
name: "ravenwood-standard-options",
3232
srcs: [
3333
"texts/ravenwood-standard-options.txt",
3434
],
35-
visibility: ["//visibility:public"],
35+
visibility: ["//visibility:private"],
3636
}
3737

3838
filegroup {
3939
name: "ravenwood-annotation-allowed-classes",
4040
srcs: [
4141
"texts/ravenwood-annotation-allowed-classes.txt",
4242
],
43-
visibility: ["//visibility:public"],
43+
visibility: ["//visibility:private"],
4444
}
4545

4646
// This and the next module contain the same classes with different implementations.
@@ -335,6 +335,30 @@ java_library {
335335
],
336336
}
337337

338+
// JARs in "ravenwood-runtime" are set to the classpath, sorted alphabetically.
339+
// Rename some of the dependencies to make sure they're included in the intended order.
340+
341+
java_library {
342+
name: "100-framework-minus-apex.ravenwood",
343+
installable: false,
344+
static_libs: ["framework-minus-apex.ravenwood"],
345+
visibility: ["//visibility:private"],
346+
}
347+
348+
java_library {
349+
name: "200-kxml2-android",
350+
installable: false,
351+
static_libs: ["kxml2-android"],
352+
visibility: ["//visibility:private"],
353+
}
354+
355+
java_library {
356+
name: "z00-all-updatable-modules-system-stubs",
357+
installable: false,
358+
static_libs: ["all-updatable-modules-system-stubs-for-host"],
359+
visibility: ["//visibility:private"],
360+
}
361+
338362
android_ravenwood_libgroup {
339363
name: "ravenwood-runtime",
340364
data: [
@@ -393,3 +417,7 @@ android_ravenwood_libgroup {
393417
"inline-mockito-ravenwood-prebuilt",
394418
],
395419
}
420+
421+
build = [
422+
"Framework.bp",
423+
]

0 commit comments

Comments
 (0)