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}
31
32gensrcs {
33    name: "art_perfetto_hprof_operator_srcs",
34    cmd: "$(location generate_operator_out) art/perfetto_hprof $(in) > $(out)",
35    tools: ["generate_operator_out"],
36    srcs: [
37        "perfetto_hprof.h",
38    ],
39    output_extension: "operator_out.cc",
40}
41
42cc_defaults {
43    name: "perfetto_hprof-defaults",
44    host_supported: false,
45    srcs: ["perfetto_hprof.cc"],
46    defaults: ["art_defaults"],
47
48    // Note that this tool needs to be built for both 32-bit and 64-bit since it requires
49    // to be same ISA as what it is attached to.
50    compile_multilib: "both",
51
52    shared_libs: [
53        "libbase",
54        "liblog",
55        "libdexfile",
56    ],
57    static_libs: [
58        "libperfetto_client_experimental",
59        "perfetto_trace_protos",
60    ],
61    generated_sources: [
62        "art_perfetto_hprof_operator_srcs",
63    ],
64    target: {
65        darwin: {
66            enabled: false,
67        },
68    },
69    header_libs: [
70        "libnativehelper_header_only",
71    ],
72}
73
74art_cc_library {
75    name: "libperfetto_hprof",
76    defaults: ["perfetto_hprof-defaults"],
77    shared_libs: [
78        "libart",
79        "libartbase",
80    ],
81    apex_available: [
82        "com.android.art",
83        "com.android.art.debug",
84    ],
85}
86
87art_cc_library {
88    name: "libperfetto_hprofd",
89    defaults: [
90        "art_debug_defaults",
91        "perfetto_hprof-defaults",
92    ],
93    shared_libs: [
94        "libartd",
95        "libartbased",
96    ],
97    apex_available: [
98        "com.android.art.debug",
99    ],
100}
101