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