xref: /aosp_15_r20/art/perfetto_hprof/Android.bp (revision 795d594fd825385562da6b089ea9b2033f3abf5a)
1*795d594fSAndroid Build Coastguard Worker// Copyright (C) 2019 The Android Open Source Project
2*795d594fSAndroid Build Coastguard Worker//
3*795d594fSAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License");
4*795d594fSAndroid Build Coastguard Worker// you may not use this file except in compliance with the License.
5*795d594fSAndroid Build Coastguard Worker// You may obtain a copy of the License at
6*795d594fSAndroid Build Coastguard Worker//
7*795d594fSAndroid Build Coastguard Worker//      http://www.apache.org/licenses/LICENSE-2.0
8*795d594fSAndroid Build Coastguard Worker//
9*795d594fSAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software
10*795d594fSAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS,
11*795d594fSAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*795d594fSAndroid Build Coastguard Worker// See the License for the specific language governing permissions and
13*795d594fSAndroid Build Coastguard Worker// limitations under the License.
14*795d594fSAndroid Build Coastguard Worker//
15*795d594fSAndroid Build Coastguard Worker
16*795d594fSAndroid Build Coastguard Worker// Build variants {target} x {debug,ndebug} x {32,64}
17*795d594fSAndroid Build Coastguard Worker
18*795d594fSAndroid Build Coastguard Worker// This depends on the Perfetto client API. This uses the ProducerPort to
19*795d594fSAndroid Build Coastguard Worker// communicate to the system trace. This is an API whose ABI is maintained
20*795d594fSAndroid Build Coastguard Worker// to be backwards compatible, see
21*795d594fSAndroid Build Coastguard Worker// https://android.googlesource.com/platform/external/perfetto/+/refs/heads/master/protos/perfetto/ipc/producer_port.proto.
22*795d594fSAndroid Build Coastguard Worker
23*795d594fSAndroid Build Coastguard Workerpackage {
24*795d594fSAndroid Build Coastguard Worker    // See: http://go/android-license-faq
25*795d594fSAndroid Build Coastguard Worker    // A large-scale-change added 'default_applicable_licenses' to import
26*795d594fSAndroid Build Coastguard Worker    // all of the 'license_kinds' from "art_license"
27*795d594fSAndroid Build Coastguard Worker    // to get the below license kinds:
28*795d594fSAndroid Build Coastguard Worker    //   SPDX-license-identifier-Apache-2.0
29*795d594fSAndroid Build Coastguard Worker    default_applicable_licenses: ["art_license"],
30*795d594fSAndroid Build Coastguard Worker    default_team: "trendy_team_art_performance",
31*795d594fSAndroid Build Coastguard Worker}
32*795d594fSAndroid Build Coastguard Worker
33*795d594fSAndroid Build Coastguard Workergensrcs {
34*795d594fSAndroid Build Coastguard Worker    name: "art_perfetto_hprof_operator_srcs",
35*795d594fSAndroid Build Coastguard Worker    cmd: "$(location generate_operator_out) art/perfetto_hprof $(in) > $(out)",
36*795d594fSAndroid Build Coastguard Worker    tools: ["generate_operator_out"],
37*795d594fSAndroid Build Coastguard Worker    srcs: [
38*795d594fSAndroid Build Coastguard Worker        "perfetto_hprof.h",
39*795d594fSAndroid Build Coastguard Worker    ],
40*795d594fSAndroid Build Coastguard Worker    output_extension: "operator_out.cc",
41*795d594fSAndroid Build Coastguard Worker}
42*795d594fSAndroid Build Coastguard Worker
43*795d594fSAndroid Build Coastguard Workercc_defaults {
44*795d594fSAndroid Build Coastguard Worker    name: "perfetto_hprof-defaults",
45*795d594fSAndroid Build Coastguard Worker    host_supported: false,
46*795d594fSAndroid Build Coastguard Worker    srcs: ["perfetto_hprof.cc"],
47*795d594fSAndroid Build Coastguard Worker    defaults: ["art_defaults"],
48*795d594fSAndroid Build Coastguard Worker
49*795d594fSAndroid Build Coastguard Worker    // Note that this tool needs to be built for both 32-bit and 64-bit since it requires
50*795d594fSAndroid Build Coastguard Worker    // to be same ISA as what it is attached to.
51*795d594fSAndroid Build Coastguard Worker    compile_multilib: "both",
52*795d594fSAndroid Build Coastguard Worker
53*795d594fSAndroid Build Coastguard Worker    shared_libs: [
54*795d594fSAndroid Build Coastguard Worker        "libartpalette",
55*795d594fSAndroid Build Coastguard Worker        "libbase",
56*795d594fSAndroid Build Coastguard Worker        "liblog",
57*795d594fSAndroid Build Coastguard Worker    ],
58*795d594fSAndroid Build Coastguard Worker    static_libs: [
59*795d594fSAndroid Build Coastguard Worker        "libperfetto_client_experimental",
60*795d594fSAndroid Build Coastguard Worker        "perfetto_trace_protos",
61*795d594fSAndroid Build Coastguard Worker    ],
62*795d594fSAndroid Build Coastguard Worker    generated_sources: [
63*795d594fSAndroid Build Coastguard Worker        "art_perfetto_hprof_operator_srcs",
64*795d594fSAndroid Build Coastguard Worker    ],
65*795d594fSAndroid Build Coastguard Worker    target: {
66*795d594fSAndroid Build Coastguard Worker        darwin: {
67*795d594fSAndroid Build Coastguard Worker            enabled: false,
68*795d594fSAndroid Build Coastguard Worker        },
69*795d594fSAndroid Build Coastguard Worker    },
70*795d594fSAndroid Build Coastguard Worker    header_libs: [
71*795d594fSAndroid Build Coastguard Worker        "libnativehelper_header_only",
72*795d594fSAndroid Build Coastguard Worker    ],
73*795d594fSAndroid Build Coastguard Worker    // FIXME: Workaround LTO build breakage
74*795d594fSAndroid Build Coastguard Worker    // http://b/241700157
75*795d594fSAndroid Build Coastguard Worker    lto: {
76*795d594fSAndroid Build Coastguard Worker        never: true,
77*795d594fSAndroid Build Coastguard Worker    },
78*795d594fSAndroid Build Coastguard Worker
79*795d594fSAndroid Build Coastguard Worker}
80*795d594fSAndroid Build Coastguard Worker
81*795d594fSAndroid Build Coastguard Workerart_cc_library {
82*795d594fSAndroid Build Coastguard Worker    name: "libperfetto_hprof",
83*795d594fSAndroid Build Coastguard Worker    defaults: ["perfetto_hprof-defaults"],
84*795d594fSAndroid Build Coastguard Worker    shared_libs: [
85*795d594fSAndroid Build Coastguard Worker        "libart",
86*795d594fSAndroid Build Coastguard Worker        "libartbase",
87*795d594fSAndroid Build Coastguard Worker        "libdexfile#impl",
88*795d594fSAndroid Build Coastguard Worker    ],
89*795d594fSAndroid Build Coastguard Worker    apex_available: [
90*795d594fSAndroid Build Coastguard Worker        "com.android.art",
91*795d594fSAndroid Build Coastguard Worker        "com.android.art.debug",
92*795d594fSAndroid Build Coastguard Worker        "test_broken_com.android.art",
93*795d594fSAndroid Build Coastguard Worker    ],
94*795d594fSAndroid Build Coastguard Worker}
95*795d594fSAndroid Build Coastguard Worker
96*795d594fSAndroid Build Coastguard Workerart_cc_library {
97*795d594fSAndroid Build Coastguard Worker    name: "libperfetto_hprofd",
98*795d594fSAndroid Build Coastguard Worker    defaults: [
99*795d594fSAndroid Build Coastguard Worker        "art_debug_defaults",
100*795d594fSAndroid Build Coastguard Worker        "perfetto_hprof-defaults",
101*795d594fSAndroid Build Coastguard Worker    ],
102*795d594fSAndroid Build Coastguard Worker    shared_libs: [
103*795d594fSAndroid Build Coastguard Worker        "libartd",
104*795d594fSAndroid Build Coastguard Worker        "libartbased",
105*795d594fSAndroid Build Coastguard Worker        "libdexfiled#impl",
106*795d594fSAndroid Build Coastguard Worker    ],
107*795d594fSAndroid Build Coastguard Worker    apex_available: [
108*795d594fSAndroid Build Coastguard Worker        "com.android.art.debug",
109*795d594fSAndroid Build Coastguard Worker    ],
110*795d594fSAndroid Build Coastguard Worker}
111