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# Noop function used to override rules we don't want to support in standalone. 16def _noop_override(**kwargs): 17 pass 18 19PERFETTO_CONFIG = struct( 20 # This is used to refer to deps within perfetto's BUILD files. 21 # In standalone and bazel-based embedders use '//', because perfetto has its 22 # own repository, and //xxx would be relative to @perfetto//xxx. 23 # In Google internal builds, instead, this is set to //third_party/perfetto, 24 # because perfetto doesn't have its own repository there. 25 root = "//", 26 27 # These variables map dependencies to perfetto third-party projects. This is 28 # to allow perfetto embedders (e.g. gapid) and google internal builds to 29 # override paths and target names to their own third_party. 30 deps = struct( 31 # Target exposing the build config header. It should be a valid 32 # cc_library dependency as it will become a dependency of every 33 # perfetto_cc_library target. It needs to expose a 34 # "perfetto_build_flags.h" file that can be included via: 35 # #include "perfetto_build_flags.h". 36 build_config = ["//:build_config_hdr"], 37 38 # Target exposing the PERFETTO_VERSION_STRING() and 39 # PERFETTO_VERSION_SCM_REVISION() macros. This is overridden in google 40 # internal builds. 41 version_header = ["//:cc_perfetto_version_header"], 42 43 # Target exposing platform-specific functionality for base. This is 44 # overriden in Google internal builds. 45 base_platform = ["//:perfetto_base_default_platform"], 46 47 zlib = ["@perfetto_dep_zlib//:zlib"], 48 expat = ["@perfetto_dep_expat//:expat"], 49 jsoncpp = ["@perfetto_dep_jsoncpp//:jsoncpp"], 50 linenoise = ["@perfetto_dep_linenoise//:linenoise"], 51 sqlite = ["@perfetto_dep_sqlite//:sqlite"], 52 sqlite_ext_percentile = ["@perfetto_dep_sqlite_src//:percentile_ext"], 53 protoc = ["@com_google_protobuf//:protoc"], 54 protoc_lib = ["@com_google_protobuf//:protoc_lib"], 55 protobuf_lite = ["@com_google_protobuf//:protobuf_lite"], 56 protobuf_full = ["@com_google_protobuf//:protobuf"], 57 protobuf_descriptor_proto = ["@com_google_protobuf//:descriptor_proto"], 58 open_csd = ["@perfetto_dep_open_csd//:open_csd"], 59 60 android_test_common = [ 61 "@maven//:androidx_test_runner", 62 "@maven//:androidx_test_monitor", 63 "@maven//:junit_junit", 64 "@maven//:com_google_truth_truth", 65 "@maven//:androidx_test_ext_junit", 66 ], 67 68 # The Python targets are empty on the standalone build because we assume 69 # any relevant deps are installed on the system or are not applicable. 70 protobuf_py = [], 71 pandas_py = [], 72 tp_vendor_py = [], 73 tp_resolvers_py = [], 74 75 # There are multiple configurations for the function name demangling 76 # logic in trace processor: 77 # (1) The following defaults include a subset of demangling sources 78 # from llvm-project. This is the most complete implementation. 79 # (2) You can avoid the llvm dependency by setting "llvm_demangle = []" 80 # here and PERFETTO_LLVM_DEMANGLE to false in your 81 # perfetto_build_flags.h. Then the implementation will use a 82 # demangler from the c++ runtime, which will most likely handle 83 # only itanium mangling, and is unavailable on some platforms (e.g. 84 # Windows, where it becomes a nop). 85 # (3) You can override the whole demangle_wrapper below, and provide 86 # your own demangling implementation. 87 demangle_wrapper = [ "//:src_trace_processor_demangle" ], 88 llvm_demangle = ["@perfetto_dep_llvm_demangle//:llvm_demangle"], 89 ), 90 91 # This struct allows embedders to customize the cc_opts for Perfetto 92 # 3rd party dependencies. They only have an effect if the dependencies are 93 # initialized with the Perfetto build files (i.e. via perfetto_deps()). 94 deps_copts = struct( 95 zlib = [], 96 expat = [], 97 jsoncpp = [], 98 linenoise = [], 99 sqlite = [], 100 llvm_demangle = [], 101 open_csd = [], 102 ), 103 104 # Allow Bazel embedders to change the visibility of "public" targets. 105 # This variable has been introduced to limit the change to Bazel and avoid 106 # making the targets fully public in the google internal tree. 107 public_visibility = [ 108 "//visibility:public", 109 ], 110 111 # Allow Bazel embedders to change the visibility of the proto targets. 112 # This variable has been introduced to limit the change to Bazel and avoid 113 # making the targets public in the google internal tree. 114 proto_library_visibility = "//visibility:private", 115 116 # Allow Bazel embedders to change the visibility of the Go protos. 117 # Go protos have all sorts of strange behaviour in Google3 so need special 118 # handling as the rules for other languages do not work for Go. 119 go_proto_library_visibility = "//visibility:private", 120 121 # This struct allows the embedder to customize copts and other args passed 122 # to rules like cc_binary. Prefixed rules (e.g. perfetto_cc_binary) will 123 # look into this struct before falling back on native.cc_binary(). 124 # This field is completely optional, the embedder can omit the whole 125 # |rule_overrides| or invidivual keys. They are assigned to None or noop 126 # actions here just for documentation purposes. 127 rule_overrides = struct( 128 proto_library = None, 129 130 cc_binary = None, 131 cc_library = None, 132 cc_proto_library = None, 133 134 # Supporting java rules pulls in the JDK and generally is not something 135 # we need for most embedders. 136 java_proto_library = _noop_override, 137 138 java_lite_proto_library = None, 139 140 py_binary = None, 141 py_library = None, 142 py_proto_library = None, 143 144 go_proto_library = None, 145 146 jspb_proto_library = None, 147 148 android_binary = None, 149 android_library = None, 150 android_jni_library = None, 151 android_instrumentation_test = None, 152 ), 153 154 # The default copts which we use to compile C++ code. 155 default_copts = [ 156 "-std=c++17", 157 ] 158) 159