1# Copyright (C) 2018 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 15import("../../gn/perfetto.gni") 16 17protoc_target = "../../gn:protoc($host_toolchain)" 18 19action_foreach("configs") { 20 testonly = true 21 script = "../../tools/protoc_helper.py" 22 23 deps = [ 24 "../../protos/perfetto/config:merged_config", 25 "../../protos/perfetto/trace:merged_trace", 26 protoc_target, 27 ] 28 29 sources = [ 30 "android_log.cfg", 31 "atrace.cfg", 32 "background.cfg", 33 "bad_config.cfg", 34 "camera.cfg", 35 "client_api.cfg", 36 "ftrace.cfg", 37 "ftrace_largebuffer.cfg", 38 "ftrace_with_filter.cfg", 39 "ftrace_with_ksyms.cfg", 40 "heapprofd.cfg", 41 "long_trace.cfg", 42 "mm_events.cfg", 43 "scheduling.cfg", 44 "summary.cfg", 45 "sys_stats.cfg", 46 "thermal.cfg", 47 "traced_perf.cfg", 48 ] 49 50 outputs = [ "$root_out_dir/{{source_file_part}}.protobuf" ] 51 52 # Retrieves the path where protoc is built relative to the dir where commands 53 # are ran (root_build_dir == out/xxx). protoc_rel_dir ends up being "." for 54 # pure host build and "gcc_like_host" for android builds 55 protoc_out_dir = get_label_info(protoc_target, "root_out_dir") 56 protoc_rel_dir = rebase_path(protoc_out_dir, root_build_dir) 57 protoc_ext = "" 58 if (host_os == "win") { 59 protoc_ext = ".exe" 60 } 61 62 args = [ 63 "encode", 64 "--protoc=$protoc_rel_dir/protoc${protoc_ext}", 65 "--input={{source}}", 66 "--output={{source_file_part}}.protobuf", 67 ] 68} 69