1// 2// Copyright (C) 2018 The Android Open Source Project 3// 4// Licensed under the Apache License, Version 2.0 (the "License"); 5// you may not use this file except in compliance with the License. 6// You may obtain a copy of the License at 7// 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// See the License for the specific language governing permissions and 14// limitations under the License. 15// 16 17package { 18 default_team: "trendy_team_fwk_core_networking", 19 // http://go/android-license-faq 20 // A large-scale-change added 'default_applicable_licenses' to import 21 // the below license kinds from "system_bpf_license": 22 // SPDX-license-identifier-Apache-2.0 23 default_applicable_licenses: ["system_bpf_license"], 24} 25 26cc_library { 27 name: "libbpf_android", 28 vendor_available: false, 29 host_supported: false, 30 target: { 31 android: { 32 srcs: [ 33 "Loader.cpp", 34 ], 35 sanitize: { 36 misc_undefined: ["integer"], 37 }, 38 }, 39 }, 40 shared_libs: [ 41 "libbase", 42 "libutils", 43 "liblog", 44 ], 45 header_libs: [ 46 "bpf_headers", 47 ], 48 export_header_lib_headers: [ 49 "bpf_headers", 50 ], 51 export_include_dirs: ["include"], 52 defaults: ["bpf_cc_defaults"], 53} 54 55rust_bindgen { 56 name: "libbpf_android_bindgen", 57 crate_name: "bpf_android_bindgen", 58 wrapper_src: "include/libbpf_android.h", 59 source_stem: "bindings", 60 bindgen_flags: [ 61 "--verbose", 62 ], 63 cflags: [ 64 "-Werror", 65 "-Wall", 66 "-Wextra", 67 "-Wno-pragma-once-outside-header", 68 ], 69 shared_libs: [ 70 "libbase", 71 "libutils", 72 "liblog", 73 "libbpf_android", 74 ], 75} 76 77cc_test { 78 name: "libbpf_load_test", 79 test_suites: ["general-tests"], 80 header_libs: ["bpf_headers"], 81 srcs: [ 82 "BpfLoadTest.cpp", 83 ], 84 defaults: ["bpf_cc_defaults"], 85 cflags: [ 86 "-Wno-error=unused-variable", 87 ], 88 static_libs: [ 89 "libbpf_android", 90 "libgmock", 91 ], 92 shared_libs: [ 93 "libbpf_bcc", 94 "libbase", 95 "liblog", 96 "libutils", 97 ], 98 99 data: [ 100 ":bpfLoadTpProg.o", 101 ], 102 require_root: true, 103} 104 105rust_binary { 106 name: "bpfloader", 107 cfgs: select(release_flag("RELEASE_BPF_ENABLE_LIBBPF"), { 108 true: ["enable_libbpf"], 109 default: [], 110 }), 111 srcs: [ 112 "bpfloader.rs", 113 ], 114 rustlibs: [ 115 "libbpf_android_bindgen", 116 "libandroid_ids", 117 "libandroid_logger", 118 "libanyhow", 119 "liblog_rust", 120 "liblibbpf_rs", 121 "liblibc", 122 ], 123 required: [] + select(release_flag("RELEASE_BPF_ENABLE_LIBBPF"), { 124 true: [ 125 "timeInState.bpf", 126 ], 127 default: [ 128 "timeInState.o", 129 ], 130 }), 131 product_variables: { 132 debuggable: { 133 required: [ 134 "bpfRingbufProg.o", 135 ], 136 }, 137 }, 138} 139