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