xref: /aosp_15_r20/art/odrefresh/Android.bp (revision 795d594fd825385562da6b089ea9b2033f3abf5a)
1//
2// Copyright (C) 2020 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17package {
18    // See: http://go/android-license-faq
19    // A large-scale-change added 'default_applicable_licenses' to import
20    // all of the 'license_kinds' from "art_license"
21    // to get the below license kinds:
22    //   SPDX-license-identifier-Apache-2.0
23    default_applicable_licenses: ["art_license"],
24    default_team: "trendy_team_art_mainline",
25}
26
27cc_defaults {
28    name: "odrefresh-defaults",
29    srcs: [
30        "odrefresh.cc",
31        "odr_common.cc",
32        "odr_compilation_log.cc",
33        "odr_fs_utils.cc",
34        "odr_metrics.cc",
35    ],
36    local_include_dirs: ["include"],
37    header_libs: ["dexoptanalyzer_headers"],
38    generated_sources: [
39        "art-odrefresh-operator-srcs",
40    ],
41    shared_libs: [
42        "liblog",
43    ],
44    static_libs: [
45        "libmodules-utils-build",
46    ],
47    tidy: true,
48    tidy_flags: [
49        "-format-style=file",
50        "-header-filter=(art/odrefresh/|system/apex/)",
51    ],
52    target: {
53        android: {
54            compile_multilib: "first",
55        },
56    },
57}
58
59cc_defaults {
60    name: "odrefresh_binary_defaults",
61    defaults: [
62        "art_defaults",
63        "odrefresh-defaults",
64    ],
65    srcs: [
66        "odr_metrics_record.cc",
67        "odrefresh_main.cc",
68    ],
69    generated_sources: [
70        "apex-info-list-tinyxml",
71        "art-apex-cache-info",
72    ],
73    tidy_disabled_srcs: [":art-apex-cache-info"],
74    shared_libs: [
75        "libarttools",
76        "libbase",
77        "libdexfile#impl",
78        "libselinux",
79    ],
80}
81
82cc_defaults {
83    name: "odrefresh_headers_defaults",
84    defaults: ["art_defaults"],
85    export_include_dirs: ["include"],
86    host_supported: true,
87    stl: "none",
88    system_shared_libs: [],
89    sdk_version: "minimum", // The minimum sdk version required by users of this module.
90}
91
92cc_library_headers {
93    name: "odrefresh_headers",
94    defaults: ["odrefresh_headers_defaults"],
95    apex_available: [
96        "//apex_available:platform", // For odsign.
97    ],
98    visibility: ["//visibility:public"],
99}
100
101// Same header as above, but for use within the ART module. This is separated
102// from above so that the build system doesn't incorrectly recognize it as a
103// dependency of the ART module exported by the platform.
104cc_library_headers {
105    name: "odrefresh_headers_art",
106    defaults: ["odrefresh_headers_defaults"],
107    apex_available: [
108        "com.android.art",
109        "com.android.art.debug",
110    ],
111    visibility: [
112        "//art:__subpackages__",
113    ],
114}
115
116gensrcs {
117    name: "art-odrefresh-operator-srcs",
118    cmd: "$(location generate_operator_out) art/odrefresh $(in) > $(out)",
119    tools: ["generate_operator_out"],
120    srcs: [
121        "odr_metrics.h",
122    ],
123    output_extension: "operator_out.cc",
124}
125
126art_cc_binary {
127    name: "odrefresh",
128    defaults: ["odrefresh_binary_defaults"],
129    required: [
130        "dexoptanalyzer",
131        "dex2oat",
132    ],
133    shared_libs: [
134        "libart",
135        "libartbase",
136    ],
137    apex_available: [
138        "com.android.art",
139        "com.android.art.debug",
140        "test_broken_com.android.art",
141    ],
142}
143
144// A no-op version of the odrefresh binary.
145art_cc_binary {
146    name: "odrefresh_broken",
147    defaults: ["art_defaults"],
148    stem: "odrefresh",
149    local_include_dirs: ["include"],
150    header_libs: ["libbase_headers"],
151    srcs: ["odrefresh_broken.cc"],
152    installable: false,
153    apex_available: ["test_jitzygote_com.android.art"],
154}
155
156art_cc_binary {
157    name: "odrefreshd",
158    defaults: [
159        "art_debug_defaults",
160        "odrefresh_binary_defaults",
161    ],
162    required: [
163        "dexoptanalyzerd",
164        "dex2oatd",
165    ],
166    shared_libs: [
167        "libartd",
168        "libartbased",
169    ],
170    apex_available: [
171        "com.android.art.debug",
172    ],
173}
174
175cc_library_static {
176    name: "libodrstatslog",
177    defaults: ["art_defaults"],
178    host_supported: true,
179    export_include_dirs: ["include"],
180    local_include_dirs: ["include"],
181    header_libs: ["libart_headers"],
182    shared_libs: ["libartbase"],
183    target: {
184        android: {
185            generated_headers: ["statslog_odrefresh.h"],
186            generated_sources: ["statslog_odrefresh.cpp"],
187            srcs: [
188                "odr_metrics_record.cc",
189                "odr_statslog_android.cc",
190            ],
191            shared_libs: [
192                "libstatspull",
193                "libstatssocket",
194            ],
195        },
196        host: {
197            srcs: ["odr_statslog_host.cc"],
198        },
199    },
200    apex_available: [
201        "com.android.art",
202        "com.android.art.debug",
203    ],
204}
205
206art_cc_defaults {
207    name: "art_odrefresh_tests_defaults",
208    defaults: ["odrefresh-defaults"],
209    header_libs: ["odrefresh_headers"],
210    srcs: [
211        "odr_artifacts_test.cc",
212        "odr_common_test.cc",
213        "odr_compilation_log_test.cc",
214        "odr_fs_utils_test.cc",
215        "odr_metrics_test.cc",
216        "odr_metrics_record_test.cc",
217        "odrefresh_test.cc",
218    ],
219    generated_headers: [
220        "apex-info-list-tinyxml",
221        "art-apex-cache-info",
222    ],
223    static_libs: [
224        "libgmock",
225    ],
226}
227
228// Version of ART gtest `art_odrefresh_tests` bundled with the ART APEX on target.
229// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete.
230art_cc_test {
231    name: "art_odrefresh_tests",
232    defaults: [
233        "art_gtest_defaults",
234        "art_odrefresh_tests_defaults",
235    ],
236    host_supported: false,
237    shared_libs: [
238        "libarttools",
239        "libbase",
240    ],
241    // The test config template is needed even though it's not used by the test
242    // runner. Otherwise, Soong will generate a test config, which is adding
243    // `art-host-test` as a test tag, while this test does not support running
244    // on host.
245    // TODO(b/214016626): Remove this line once the bug is fixed.
246    test_config_template: "//art/test:art-gtests-target-standalone-template",
247}
248
249// Standalone version of ART gtest `art_odrefresh_tests`, not bundled with the ART APEX on target.
250art_cc_test {
251    name: "art_standalone_odrefresh_tests",
252    defaults: [
253        "art_standalone_gtest_defaults",
254        "art_odrefresh_tests_defaults",
255    ],
256    static_libs: [
257        "libarttools",
258        "libbase",
259    ],
260    test_config_template: ":art-gtests-target-standalone-non-multilib-template",
261}
262
263genrule {
264    name: "statslog_odrefresh.h",
265    tools: ["stats-log-api-gen"],
266    cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_odrefresh.h --module art --namespace art,metrics,statsd",
267    out: [
268        "statslog_odrefresh.h",
269    ],
270}
271
272genrule {
273    name: "statslog_odrefresh.cpp",
274    tools: ["stats-log-api-gen"],
275    cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_odrefresh.cpp --module art --namespace art,metrics,statsd --importHeader statslog_odrefresh.h",
276    out: [
277        "statslog_odrefresh.cpp",
278    ],
279}
280
281xsd_config {
282    name: "art-apex-cache-info",
283    srcs: ["CacheInfo.xsd"],
284    package_name: "com.android.art",
285    api_dir: "schema",
286    gen_writer: true,
287    tinyxml: true,
288}
289