xref: /aosp_15_r20/frameworks/base/ravenwood/tools/hoststubgen/Android.bp (revision d57664e9bc4670b3ecf6748a746a57c557b6bc9e)
1package {
2    // See: http://go/android-license-faq
3    // A large-scale-change added 'default_applicable_licenses' to import
4    // all of the 'license_kinds' from "frameworks_base_license"
5    // to get the below license kinds:
6    //   SPDX-license-identifier-Apache-2.0
7    default_applicable_licenses: ["frameworks_base_license"],
8
9    // OWNER: g/ravenwood
10    // Bug component: 25698
11    default_team: "trendy_team_ravenwood",
12}
13
14// Visibility only for ravenwood prototype uses.
15genrule_defaults {
16    name: "ravenwood-internal-only-visibility-genrule",
17    visibility: [
18        ":__subpackages__",
19        "//frameworks/base",
20        "//frameworks/base/ravenwood:__subpackages__",
21    ],
22}
23
24// Visibility only for ravenwood prototype uses.
25java_defaults {
26    name: "ravenwood-internal-only-visibility-java",
27    visibility: [
28        ":__subpackages__",
29        "//frameworks/base",
30        "//frameworks/base/ravenwood:__subpackages__",
31    ],
32}
33
34// Visibility only for ravenwood prototype uses.
35filegroup_defaults {
36    name: "ravenwood-internal-only-visibility-filegroup",
37    visibility: [
38        ":__subpackages__",
39        "//frameworks/base",
40        "//frameworks/base/ravenwood:__subpackages__",
41    ],
42}
43
44// This library contains the standard hoststubgen annotations.
45// This is only for the prototype. The productionized version is "ravenwood-annotations".
46java_library {
47    name: "hoststubgen-annotations",
48    defaults: ["ravenwood-internal-only-visibility-java"],
49    srcs: [
50        "annotations-src/**/*.java",
51    ],
52    host_supported: true,
53
54    sdk_version: "core_current",
55}
56
57// This library contains helper classes used in the host side test environment at runtime.
58// This library is _not_ specific to Android APIs.
59java_library_host {
60    name: "hoststubgen-helper-runtime",
61    defaults: ["ravenwood-internal-only-visibility-java"],
62    srcs: [
63        "helper-runtime-src/**/*.java",
64    ],
65    libs: [
66        "junit",
67    ],
68    static_libs: [
69        "guava",
70    ],
71    jarjar_rules: "jarjar-rules.txt",
72}
73
74java_library {
75    name: "hoststubgen-helper-runtime.ravenwood",
76    defaults: ["ravenwood-internal-only-visibility-java"],
77    srcs: [
78        "helper-runtime-src/**/*.java",
79    ],
80    libs: [
81        "junit",
82    ],
83    static_libs: [
84        "guava",
85    ],
86    jarjar_rules: "jarjar-rules.txt",
87}
88
89// For sharing the code with other tools
90java_library_host {
91    name: "hoststubgen-lib",
92    defaults: ["ravenwood-internal-only-visibility-java"],
93    srcs: ["src/**/*.kt"],
94    static_libs: [
95        "hoststubgen-helper-runtime",
96    ],
97    libs: [
98        "junit",
99        "ow2-asm",
100        "ow2-asm-analysis",
101        "ow2-asm-commons",
102        "ow2-asm-tree",
103        "ow2-asm-util",
104    ],
105}
106
107// Host-side stub generator tool.
108java_binary_host {
109    name: "hoststubgen",
110    main_class: "com.android.hoststubgen.HostStubGenMain",
111    static_libs: [
112        "hoststubgen-lib",
113        "junit",
114        "ow2-asm",
115        "ow2-asm-analysis",
116        "ow2-asm-commons",
117        "ow2-asm-tree",
118        "ow2-asm-util",
119    ],
120    visibility: ["//visibility:public"],
121}
122
123java_test_host {
124    name: "hoststubgentest",
125    srcs: ["test/**/*.kt"],
126    static_libs: [
127        "hoststubgen",
128        "truth",
129    ],
130    test_suites: ["general-tests"],
131    visibility: ["//visibility:private"],
132}
133
134// File that contains the standard command line argumetns to hoststubgen.
135// This is only for the prototype. The productionized version is "ravenwood-standard-options".
136filegroup {
137    name: "hoststubgen-standard-options",
138    defaults: ["ravenwood-internal-only-visibility-filegroup"],
139    srcs: [
140        "hoststubgen-standard-options.txt",
141    ],
142}
143
144hoststubgen_common_options = "$(location hoststubgen) " +
145    // "--in-jar $(location :framework-all) " +
146    // "--policy-override-file $(location framework-policy-override.txt) " +
147    "@$(location :hoststubgen-standard-options) " +
148
149    "--out-jar $(location host.jar) " +
150
151    // "--keep-all-classes " + // Used it for an experiment. See KeepAllClassesFilter.
152    "--gen-keep-all-file $(location hoststubgen_keep_all.txt) " +
153    "--gen-input-dump-file $(location hoststubgen_dump.txt) " +
154    ""
155
156// Common defaults for stub generation.
157// This one is not specific to Android APIs.
158genrule_defaults {
159    name: "hoststubgen-command-defaults",
160    tools: ["hoststubgen"],
161    srcs: [
162        ":hoststubgen-standard-options",
163    ],
164    out: [
165        "host.jar",
166
167        // Following files are created just as FYI.
168        "hoststubgen_keep_all.txt",
169        "hoststubgen_dump.txt",
170    ],
171}
172