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 zlib = ["@perfetto_dep_zlib//:zlib"], 44 jsoncpp = ["@perfetto_dep_jsoncpp//:jsoncpp"], 45 linenoise = ["@perfetto_dep_linenoise//:linenoise"], 46 sqlite = ["@perfetto_dep_sqlite//:sqlite"], 47 sqlite_ext_percentile = ["@perfetto_dep_sqlite_src//:percentile_ext"], 48 protoc = ["@com_google_protobuf//:protoc"], 49 protoc_lib = ["@com_google_protobuf//:protoc_lib"], 50 protobuf_lite = ["@com_google_protobuf//:protobuf_lite"], 51 protobuf_full = ["@com_google_protobuf//:protobuf"], 52 protobuf_descriptor_proto = ["@com_google_protobuf//:descriptor_proto"] 53 ), 54 55 # This struct allows embedders to customize the cc_opts for Perfetto 56 # 3rd party dependencies. They only have an effect if the dependencies are 57 # initialized with the Perfetto build files (i.e. via perfetto_deps()). 58 deps_copts = struct( 59 zlib = [], 60 jsoncpp = [], 61 linenoise = [], 62 sqlite = [], 63 ), 64 65 # Allow Bazel embedders to change the visibility of "public" targets. 66 # This variable has been introduced to limit the change to Bazel and avoid 67 # making the targets fully public in the google internal tree. 68 public_visibility = [ 69 "//visibility:public", 70 ], 71 72 # Allow Bazel embedders to change the visibility of the proto targets. 73 # This variable has been introduced to limit the change to Bazel and avoid 74 # making the targets public in the google internal tree. 75 proto_library_visibility = "//visibility:private", 76 77 # This struct allows the embedder to customize copts and other args passed 78 # to rules like cc_binary. Prefixed rules (e.g. perfetto_cc_binary) will 79 # look into this struct before falling back on native.cc_binary(). 80 # This field is completely optional, the embedder can omit the whole 81 # |rule_overrides| or invidivual keys. They are assigned to None or noop 82 # actions here just for documentation purposes. 83 rule_overrides = struct( 84 cc_binary = None, 85 cc_library = None, 86 cc_proto_library = None, 87 88 # Supporting java rules pulls in the JDK and generally is not something 89 # we need for most embedders. 90 java_proto_library = _noop_override, 91 java_lite_proto_library = _noop_override, 92 93 proto_library = None, 94 py_binary = None, 95 py_library = None, 96 97 # We only need this for internal binaries. No other embeedder should 98 # care about this. 99 gensignature_internal_only = None, 100 ), 101) 102