Add a presubmit check to keep Android.bp up-to-date
When trying to upload a change which affects build files,
but does not update Android.bp to match, the following presubmit
error gets triggered:
Android.bp is out of date. Please run tools/gen_android_bp to update it.
This patch also replaces Android.bp with the output from the generator.
Change-Id: If60c1c101cd640d91b477b022c2db83acbd0711f
diff --git a/Android.bp b/Android.bp
index af67d20..1abfc05 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,408 +1,65 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+// Copyright (C) 2017 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+// This file is automatically generated by tools/gen_android_bp. Do not edit.
-cc_defaults {
- name: "perfetto_defaults",
- local_include_dirs: [ "include" ],
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// base
-///////////////////////////////////////////////////////////////////////////////
-
-filegroup {
- name: "perfetto_base",
+// GN target: //src/ipc:wire_protocol_gen
+cc_genrule {
+ name: "perfetto_src_ipc_wire_protocol_gen_headers",
srcs: [
- "src/base/android_task_runner.cc",
- "src/base/thread_checker.cc",
- "src/base/unix_task_runner.cc",
- ]
-}
-
-filegroup {
- name: "perfetto_base_test_support",
- srcs: [
- "src/base/test/test_task_runner.cc",
- ]
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// protozero
-///////////////////////////////////////////////////////////////////////////////
-
-// TODO(skyostil): Don't hardcode external/perfetto.
-protoc_cmd = "mkdir -p $(genDir)/external/perfetto && "
-protoc_cmd += "$(location) --cpp_out=$(genDir)/external/perfetto "
-protoc_cmd += "--proto_path=external/perfetto $(in)"
-
-protozeroc_cmd = "mkdir -p $(genDir)/external/perfetto && "
-protozeroc_cmd += "$(location) --plugin=protoc-gen-plugin="
-protozeroc_cmd += "$(location protozero_protoc_plugin) "
-protozeroc_cmd += "--plugin_out=wrapper_namespace="
-protozeroc_cmd += "pbzero:$(genDir)/external/perfetto "
-protozeroc_cmd += "--proto_path=external/perfetto $(in)"
-
-cc_defaults {
- name: "protozero_defaults",
- defaults: [ "perfetto_defaults" ],
- cflags: [
- "-Wno-error=return-type",
- "-Wno-sign-compare",
- "-Wno-sign-promo",
- "-Wno-unused-parameter",
- ]
-}
-
-filegroup {
- name: "protozero",
- srcs: [
- "src/protozero/proto_utils.cc",
- "src/protozero/protozero_message.cc",
- "src/protozero/protozero_message_handle.cc",
- "src/protozero/scattered_stream_writer.cc",
- ]
-}
-
-cc_binary_host {
- name: "protozero_protoc_plugin",
- defaults: [ "protozero_defaults" ],
- srcs: [
- "src/protozero/protoc_plugin/protozero_generator.cc",
- "src/protozero/protoc_plugin/protozero_plugin.cc",
- ],
- shared_libs: [ "libprotoc" ],
-}
-
-filegroup {
- name: "protozero_testing_messages",
- srcs: [
- "src/protozero/test/example_proto/library.proto",
- "src/protozero/test/example_proto/library_internals/galaxies.proto",
- "src/protozero/test/example_proto/test_messages.proto",
- "src/protozero/test/example_proto/upper_import.proto",
- ]
-}
-
-// Each proto set gets a pair of genrules: one of the sources and one for the
-// headers. This is because a "srcs" entry which depends on a genrule that
-// generates a .h file causes an error since soong isn't expecting to compile a
-// header.
-// TODO(skyostil): End this insanity.
-cc_genrule {
- name: "protozero_testing_messages_lite",
- tools: [ "aprotoc" ],
- srcs: [ ":protozero_testing_messages" ],
- cmd: protoc_cmd,
- out: [
- "external/perfetto/src/protozero/test/example_proto/library.pb.cc",
- "external/perfetto/src/protozero/test/example_proto/library_internals/galaxies.pb.cc",
- "external/perfetto/src/protozero/test/example_proto/test_messages.pb.cc",
- "external/perfetto/src/protozero/test/example_proto/upper_import.pb.cc",
- ]
-}
-
-cc_genrule {
- name: "protozero_testing_messages_lite_headers",
- tools: [ "aprotoc" ],
- srcs: [ ":protozero_testing_messages" ],
- cmd: protoc_cmd,
- export_include_dirs: [ "." ],
- out: [
- "external/perfetto/src/protozero/test/example_proto/library.pb.h",
- "external/perfetto/src/protozero/test/example_proto/library_internals/galaxies.pb.h",
- "external/perfetto/src/protozero/test/example_proto/test_messages.pb.h",
- "external/perfetto/src/protozero/test/example_proto/upper_import.pb.h",
- ]
-}
-
-cc_genrule {
- name: "protozero_testing_messages_zero",
- tools: [ "aprotoc", "protozero_protoc_plugin" ],
- srcs: [ ":protozero_testing_messages" ],
- cmd: protozeroc_cmd,
- out: [
- "external/perfetto/src/protozero/test/example_proto/library.pbzero.cc",
- "external/perfetto/src/protozero/test/example_proto/library_internals/galaxies.pbzero.cc",
- "external/perfetto/src/protozero/test/example_proto/test_messages.pbzero.cc",
- "external/perfetto/src/protozero/test/example_proto/upper_import.pbzero.cc",
- ]
-}
-
-cc_genrule {
- name: "protozero_testing_messages_zero_headers",
- tools: [ "aprotoc", "protozero_protoc_plugin" ],
- srcs: [ ":protozero_testing_messages" ],
- cmd: protozeroc_cmd,
- export_include_dirs: [ "." ],
- out: [
- "external/perfetto/src/protozero/test/example_proto/library.pbzero.h",
- "external/perfetto/src/protozero/test/example_proto/library_internals/galaxies.pbzero.h",
- "external/perfetto/src/protozero/test/example_proto/test_messages.pbzero.h",
- "external/perfetto/src/protozero/test/example_proto/upper_import.pbzero.h",
- ]
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// protos
-///////////////////////////////////////////////////////////////////////////////
-
-filegroup {
- name: "perfetto_messages",
- srcs: [
- "protos/ftrace/ftrace_event.proto",
- "protos/ftrace/ftrace_event_bundle.proto",
- "protos/ftrace/print.proto",
- "protos/ftrace/sched_switch.proto",
- "protos/ftrace/test_bundle_wrapper.proto",
- "protos/trace_packet.proto",
- ]
-}
-
-cc_genrule {
- name: "perfetto_messages_lite",
- tools: [ "aprotoc" ],
- srcs: [ ":perfetto_messages" ],
- cmd: protoc_cmd,
- out: [
- "external/perfetto/protos/ftrace/ftrace_event.pb.cc",
- "external/perfetto/protos/ftrace/ftrace_event_bundle.pb.cc",
- "external/perfetto/protos/ftrace/print.pb.cc",
- "external/perfetto/protos/ftrace/sched_switch.pb.cc",
- "external/perfetto/protos/ftrace/test_bundle_wrapper.pb.cc",
- "external/perfetto/protos/trace_packet.pb.cc",
- ]
-}
-
-cc_genrule {
- name: "perfetto_messages_lite_headers",
- tools: [ "aprotoc" ],
- srcs: [ ":perfetto_messages" ],
- cmd: protoc_cmd,
- export_include_dirs: [ "." ],
- out: [
- "external/perfetto/protos/ftrace/ftrace_event.pb.h",
- "external/perfetto/protos/ftrace/ftrace_event_bundle.pb.h",
- "external/perfetto/protos/ftrace/print.pb.h",
- "external/perfetto/protos/ftrace/sched_switch.pb.h",
- "external/perfetto/protos/ftrace/test_bundle_wrapper.pb.h",
- "external/perfetto/protos/trace_packet.pb.h",
- ]
-}
-
-cc_genrule {
- name: "perfetto_messages_zero",
- tools: [ "aprotoc", "protozero_protoc_plugin" ],
- srcs: [ ":perfetto_messages" ],
- cmd: protozeroc_cmd,
- out: [
- "external/perfetto/protos/ftrace/ftrace_event.pbzero.cc",
- "external/perfetto/protos/ftrace/ftrace_event_bundle.pbzero.cc",
- "external/perfetto/protos/ftrace/print.pbzero.cc",
- "external/perfetto/protos/ftrace/sched_switch.pbzero.cc",
- "external/perfetto/protos/ftrace/test_bundle_wrapper.pbzero.cc",
- "external/perfetto/protos/trace_packet.pbzero.cc",
- ]
-}
-
-cc_genrule {
- name: "perfetto_messages_zero_headers",
- tools: [ "aprotoc", "protozero_protoc_plugin" ],
- srcs: [ ":perfetto_messages" ],
- cmd: protozeroc_cmd,
- export_include_dirs: [ "." ],
- out: [
- "external/perfetto/protos/ftrace/ftrace_event.pbzero.h",
- "external/perfetto/protos/ftrace/ftrace_event_bundle.pbzero.h",
- "external/perfetto/protos/ftrace/print.pbzero.h",
- "external/perfetto/protos/ftrace/sched_switch.pbzero.h",
- "external/perfetto/protos/ftrace/test_bundle_wrapper.pbzero.h",
- "external/perfetto/protos/trace_packet.pbzero.h",
- ]
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// ftrace
-///////////////////////////////////////////////////////////////////////////////
-
-// TODO(skyostil): Add full protobufs (as opposed to lite) for this test.
-//cc_test {
-// name: "perfetto_ftrace_reader_integrationtests",
-// defaults: [
-// "protozero_defaults"
-// ],
-// generated_headers: [
-// "perfetto_messages_lite_headers",
-// "perfetto_messages_zero_headers",
-// ],
-// shared_libs: [
-// "libprotobuf-cpp-lite"
-// ],
-// static_libs: [
-// "libgmock"
-// ],
-// srcs: [
-// ":perfetto_ftrace_reader",
-// ":perfetto_messages_lite",
-// ":perfetto_messages_zero",
-// ":protozero",
-// "ftrace_reader/src/end_to_end_integrationtest.cc",
-// "ftrace_reader/src/ftrace_procfs_integrationtest.cc",
-// ]
-//}
-
-cc_test {
- name: "perfetto_ftrace_reader_demo",
- defaults: [
- "protozero_defaults",
- ],
- generated_headers: [
- "perfetto_messages_lite_headers",
- "perfetto_messages_zero_headers",
- ],
- shared_libs: [
- "libprotobuf-cpp-lite"
- ],
- srcs: [
- ":perfetto_base",
- ":perfetto_base_test_support",
- ":perfetto_ftrace_reader",
- ":perfetto_messages_lite",
- ":perfetto_messages_zero",
- ":protozero",
- "src/ftrace_reader/main.cc",
- "src/ftrace_reader/test/scattered_stream_delegate_for_testing.cc",
- ]
-}
-
-filegroup {
- name: "perfetto_ftrace_reader",
- srcs: [
- "src/ftrace_reader/event_info.cc",
- "src/ftrace_reader/cpu_reader.cc",
- "src/ftrace_reader/format_parser.cc",
- "src/ftrace_reader/ftrace_controller.cc",
- "src/ftrace_reader/ftrace_procfs.cc",
- "src/ftrace_reader/ftrace_to_proto.cc",
- "src/ftrace_reader/proto_translation_table.cc",
- ]
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// ipc
-///////////////////////////////////////////////////////////////////////////////
-
-ipcc_cmd = "mkdir -p $(genDir)/external/perfetto && "
-ipcc_cmd += "$(location) "
-ipcc_cmd += "--plugin=protoc-gen-plugin=$(location perfetto_ipc_protoc_plugin) "
-ipcc_cmd += "--cpp_out=$(genDir)/external/perfetto "
-ipcc_cmd += "--proto_path=external/perfetto "
-ipcc_cmd += "--plugin_out=$(genDir)/external/perfetto $(in)"
-
-cc_defaults {
- name: "perfetto_ipc_defaults",
- defaults: [ "perfetto_defaults" ],
- cflags: [
- "-Wno-sign-compare",
- "-Wno-unused-parameter",
- ]
-}
-
-cc_binary_host {
- name: "perfetto_ipc_protoc_plugin",
- defaults: [ "perfetto_ipc_defaults" ],
- srcs: [
- "src/ipc/protoc_plugin/ipc_generator.cc",
- "src/ipc/protoc_plugin/ipc_plugin.cc",
- ],
- cflags: [
- "-Wno-unused-parameter",
- ],
- shared_libs: [ "libprotoc" ],
-}
-
-filegroup {
- name: "perfetto_ipc",
- srcs: [
- "src/ipc/buffered_frame_deserializer.cc",
- "src/ipc/client_impl.cc",
- "src/ipc/deferred.cc",
- "src/ipc/host_impl.cc",
- "src/ipc/service_proxy.cc",
- "src/ipc/unix_socket.cc",
- ]
-}
-
-filegroup {
- name: "perfetto_ipc_messages",
- srcs: [
"src/ipc/wire_protocol.proto",
- ]
-}
-
-cc_genrule {
- name: "perfetto_ipc_messages_lite",
- tools: [ "aprotoc" ],
- srcs: [ ":perfetto_ipc_messages" ],
- cmd: protoc_cmd,
- out: [
- "external/perfetto/src/ipc/wire_protocol.pb.cc",
- ]
-}
-
-cc_genrule {
- name: "perfetto_ipc_messages_lite_headers",
- tools: [ "aprotoc" ],
- srcs: [ ":perfetto_ipc_messages" ],
- cmd: protoc_cmd,
- export_include_dirs: [ "." ],
+ ],
+ tools: [
+ "aprotoc",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto && $(location aprotoc) --cpp_out=$(genDir)/external/perfetto --proto_path=external/perfetto $(in)",
out: [
"external/perfetto/src/ipc/wire_protocol.pb.h",
- ]
+ ],
+ export_include_dirs: [
+ ".",
+ ],
}
-filegroup {
- name: "perfetto_ipc_test_messages",
- srcs: [
+// GN target: //src/ftrace_reader:ftrace_reader_test_messages_lite_gen
+cc_genrule {
+ name: "perfetto_src_ftrace_reader_ftrace_reader_test_messages_lite_gen",
+ srcs: [
+ "src/ftrace_reader/test/test_messages.proto",
+ ],
+ tools: [
+ "aprotoc",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto && $(location aprotoc) --cpp_out=$(genDir)/external/perfetto --proto_path=external/perfetto $(in)",
+ out: [
+ "external/perfetto/src/ftrace_reader/test/test_messages.pb.cc",
+ ],
+}
+
+// GN target: //src/ipc:test_messages_gen
+cc_genrule {
+ name: "perfetto_src_ipc_test_messages_gen_headers",
+ srcs: [
"src/ipc/test/client_unittest_messages.proto",
"src/ipc/test/deferred_unittest_messages.proto",
"src/ipc/test/greeter_service.proto",
- ]
-}
-
-cc_genrule {
- name: "perfetto_ipc_test_messages_ipc",
- tools: [ "aprotoc", "perfetto_ipc_protoc_plugin" ],
- srcs: [ ":perfetto_ipc_test_messages" ],
- cmd: ipcc_cmd,
- out: [
- "external/perfetto/src/ipc/test/client_unittest_messages.ipc.cc",
- "external/perfetto/src/ipc/test/client_unittest_messages.pb.cc",
- "external/perfetto/src/ipc/test/deferred_unittest_messages.ipc.cc",
- "external/perfetto/src/ipc/test/deferred_unittest_messages.pb.cc",
- "external/perfetto/src/ipc/test/greeter_service.ipc.cc",
- "external/perfetto/src/ipc/test/greeter_service.pb.cc",
- ]
-}
-
-cc_genrule {
- name: "perfetto_ipc_test_messages_ipc_headers",
- tools: [ "aprotoc", "perfetto_ipc_protoc_plugin" ],
- srcs: [ ":perfetto_ipc_test_messages" ],
- cmd: ipcc_cmd,
- export_include_dirs: [ "." ],
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_ipc_protoc_plugin_ipc_plugin___gn_standalone_toolchain_gcc_like_host_",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto && $(location aprotoc) --cpp_out=$(genDir)/external/perfetto --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_ipc_protoc_plugin_ipc_plugin___gn_standalone_toolchain_gcc_like_host_) --plugin_out=:$(genDir)/external/perfetto $(in)",
out: [
"external/perfetto/src/ipc/test/client_unittest_messages.ipc.h",
"external/perfetto/src/ipc/test/client_unittest_messages.pb.h",
@@ -410,189 +67,556 @@
"external/perfetto/src/ipc/test/deferred_unittest_messages.pb.h",
"external/perfetto/src/ipc/test/greeter_service.ipc.h",
"external/perfetto/src/ipc/test/greeter_service.pb.h",
- ]
+ ],
+ export_include_dirs: [
+ ".",
+ ],
}
-///////////////////////////////////////////////////////////////////////////////
-// tracing
-///////////////////////////////////////////////////////////////////////////////
+cc_defaults {
+ name: "perfetto_defaults",
+ cflags: [
+ "-Wno-error=return-type",
+ "-Wno-sign-compare",
+ "-Wno-sign-promo",
+ "-Wno-unused-parameter",
+ ],
+ local_include_dirs: [
+ "include",
+ ],
+}
-filegroup {
- name: "perfetto_tracing",
+// GN target: //protos/tracing_service:tracing_service_gen
+cc_genrule {
+ name: "perfetto_protos_tracing_service_tracing_service_gen_headers",
srcs: [
- "src/tracing/core/data_source_config.cc",
- "src/tracing/core/data_source_descriptor.cc",
- "src/tracing/core/service_impl.cc",
- "src/tracing/core/trace_config.cc",
- "src/tracing/core/trace_packet.cc",
- ]
-}
-
-// These protos contains only messages that require the standard protoc.
-filegroup {
- name: "perfetto_tracing_messages",
- srcs: [
- "protos/tracing_service/data_source_config.proto",
- "protos/tracing_service/data_source_descriptor.proto",
- "protos/tracing_service/trace_config.proto",
- ]
-}
-
-cc_genrule {
- name: "perfetto_tracing_messages_lite",
- tools: [ "aprotoc" ],
- srcs: [ ":perfetto_tracing_messages" ],
- cmd: protoc_cmd,
- out: [
- "external/perfetto/protos/tracing_service/data_source_config.pb.cc",
- "external/perfetto/protos/tracing_service/data_source_descriptor.pb.cc",
- "external/perfetto/protos/tracing_service/trace_config.pb.cc",
- ]
-}
-
-cc_genrule {
- name: "perfetto_tracing_messages_lite_headers",
- tools: [ "aprotoc" ],
- srcs: [ ":perfetto_tracing_messages" ],
- cmd: protoc_cmd,
- export_include_dirs: [ "." ],
- out: [
- "external/perfetto/protos/tracing_service/data_source_config.pb.h",
- "external/perfetto/protos/tracing_service/data_source_descriptor.pb.h",
- "external/perfetto/protos/tracing_service/trace_config.pb.h",
- ]
-}
-
-
-// These protos, instead, contains IPC definitions that require the use of the
-// IPC plugin, together with protoc.
-
-filegroup {
- name: "perfetto_tracing_ipcs",
- srcs: [
"protos/tracing_service/consumer_port.proto",
"protos/tracing_service/producer_port.proto",
- ]
-}
-
-cc_genrule {
- name: "perfetto_tracing_ipcs_lite",
- tools: [ "aprotoc", "perfetto_ipc_protoc_plugin" ],
- srcs: [ ":perfetto_tracing_ipcs" ],
- cmd: ipcc_cmd,
- out: [
- "external/perfetto/protos/tracing_service/consumer_port.ipc.cc",
- "external/perfetto/protos/tracing_service/consumer_port.pb.cc",
- "external/perfetto/protos/tracing_service/producer_port.ipc.cc",
- "external/perfetto/protos/tracing_service/producer_port.pb.cc",
- ]
-}
-
-cc_genrule {
- name: "perfetto_tracing_ipcs_lite_headers",
- tools: [ "aprotoc", "perfetto_ipc_protoc_plugin" ],
- srcs: [ ":perfetto_tracing_ipcs" ],
- cmd: ipcc_cmd,
- export_include_dirs: [ "." ],
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_ipc_protoc_plugin_ipc_plugin___gn_standalone_toolchain_gcc_like_host_",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto && $(location aprotoc) --cpp_out=$(genDir)/external/perfetto --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_ipc_protoc_plugin_ipc_plugin___gn_standalone_toolchain_gcc_like_host_) --plugin_out=:$(genDir)/external/perfetto $(in)",
out: [
"external/perfetto/protos/tracing_service/consumer_port.ipc.h",
"external/perfetto/protos/tracing_service/consumer_port.pb.h",
"external/perfetto/protos/tracing_service/producer_port.ipc.h",
"external/perfetto/protos/tracing_service/producer_port.pb.h",
- ]
+ ],
+ export_include_dirs: [
+ ".",
+ ],
}
-filegroup {
- name: "perfetto_tracing_ipc",
+// GN target: //src/ftrace_reader:ftrace_reader_test_messages_zero_gen
+cc_genrule {
+ name: "perfetto_src_ftrace_reader_ftrace_reader_test_messages_zero_gen",
srcs: [
- "src/tracing/ipc/posix_shared_memory.cc",
- "src/tracing/ipc/consumer/consumer_ipc_client_impl.cc",
- "src/tracing/ipc/producer/producer_ipc_client_impl.cc",
- "src/tracing/ipc/service/producer_ipc_service.cc",
- "src/tracing/ipc/service/service_ipc_host_impl.cc",
- ]
+ "src/ftrace_reader/test/test_messages.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_protoc_plugin___gn_standalone_toolchain_gcc_like_host_",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto && $(location aprotoc) --cpp_out=$(genDir)/external/perfetto --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_protoc_plugin___gn_standalone_toolchain_gcc_like_host_) --plugin_out=wrapper_namespace=pbzero:$(genDir)/external/perfetto $(in)",
+ out: [
+ "external/perfetto/src/ftrace_reader/test/test_messages.pbzero.cc",
+ ],
}
-///////////////////////////////////////////////////////////////////////////////
-// tests and benchmarks
-///////////////////////////////////////////////////////////////////////////////
+// GN target: //protos/tracing_service:tracing_service_gen
+cc_genrule {
+ name: "perfetto_protos_tracing_service_tracing_service_gen",
+ srcs: [
+ "protos/tracing_service/consumer_port.proto",
+ "protos/tracing_service/producer_port.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_ipc_protoc_plugin_ipc_plugin___gn_standalone_toolchain_gcc_like_host_",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto && $(location aprotoc) --cpp_out=$(genDir)/external/perfetto --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_ipc_protoc_plugin_ipc_plugin___gn_standalone_toolchain_gcc_like_host_) --plugin_out=:$(genDir)/external/perfetto $(in)",
+ out: [
+ "external/perfetto/protos/tracing_service/consumer_port.ipc.cc",
+ "external/perfetto/protos/tracing_service/consumer_port.pb.cc",
+ "external/perfetto/protos/tracing_service/producer_port.ipc.cc",
+ "external/perfetto/protos/tracing_service/producer_port.pb.cc",
+ ],
+}
-cc_test {
- name: "perfetto_tests",
+// GN target: //src/protozero:testing_messages_lite_gen
+cc_genrule {
+ name: "perfetto_src_protozero_testing_messages_lite_gen_headers",
+ srcs: [
+ "src/protozero/test/example_proto/library.proto",
+ "src/protozero/test/example_proto/library_internals/galaxies.proto",
+ "src/protozero/test/example_proto/test_messages.proto",
+ "src/protozero/test/example_proto/upper_import.proto",
+ ],
+ tools: [
+ "aprotoc",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto && $(location aprotoc) --cpp_out=$(genDir)/external/perfetto --proto_path=external/perfetto $(in)",
+ out: [
+ "external/perfetto/src/protozero/test/example_proto/library.pb.h",
+ "external/perfetto/src/protozero/test/example_proto/library_internals/galaxies.pb.h",
+ "external/perfetto/src/protozero/test/example_proto/test_messages.pb.h",
+ "external/perfetto/src/protozero/test/example_proto/upper_import.pb.h",
+ ],
+ export_include_dirs: [
+ ".",
+ ],
+}
+
+// GN target: //src/ipc:test_messages_gen
+cc_genrule {
+ name: "perfetto_src_ipc_test_messages_gen",
+ srcs: [
+ "src/ipc/test/client_unittest_messages.proto",
+ "src/ipc/test/deferred_unittest_messages.proto",
+ "src/ipc/test/greeter_service.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_ipc_protoc_plugin_ipc_plugin___gn_standalone_toolchain_gcc_like_host_",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto && $(location aprotoc) --cpp_out=$(genDir)/external/perfetto --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_ipc_protoc_plugin_ipc_plugin___gn_standalone_toolchain_gcc_like_host_) --plugin_out=:$(genDir)/external/perfetto $(in)",
+ out: [
+ "external/perfetto/src/ipc/test/client_unittest_messages.ipc.cc",
+ "external/perfetto/src/ipc/test/client_unittest_messages.pb.cc",
+ "external/perfetto/src/ipc/test/deferred_unittest_messages.ipc.cc",
+ "external/perfetto/src/ipc/test/deferred_unittest_messages.pb.cc",
+ "external/perfetto/src/ipc/test/greeter_service.ipc.cc",
+ "external/perfetto/src/ipc/test/greeter_service.pb.cc",
+ ],
+}
+
+// GN target: //protos:lite_gen
+cc_genrule {
+ name: "perfetto_protos_lite_gen_headers",
+ srcs: [
+ "protos/trace_packet.proto",
+ ],
+ tools: [
+ "aprotoc",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto && $(location aprotoc) --cpp_out=$(genDir)/external/perfetto --proto_path=external/perfetto $(in)",
+ out: [
+ "external/perfetto/protos/trace_packet.pb.h",
+ ],
+ export_include_dirs: [
+ ".",
+ ],
+}
+
+// GN target: //src/ipc/protoc_plugin:ipc_plugin(//gn/standalone/toolchain:gcc_like_host)
+cc_binary_host {
+ name: "perfetto_src_ipc_protoc_plugin_ipc_plugin___gn_standalone_toolchain_gcc_like_host_",
+ srcs: [
+ "src/ipc/protoc_plugin/ipc_generator.cc",
+ "src/ipc/protoc_plugin/ipc_plugin.cc",
+ ],
+ shared_libs: [
+ "libprotoc",
+ "libunwind",
+ ],
defaults: [
"perfetto_defaults",
- "perfetto_ipc_defaults",
- "protozero_defaults",
],
+}
+
+// GN target: //src/ftrace_reader:ftrace_reader_test_messages_zero_gen
+cc_genrule {
+ name: "perfetto_src_ftrace_reader_ftrace_reader_test_messages_zero_gen_headers",
srcs: [
- ":perfetto_base",
- ":perfetto_base_test_support",
- ":perfetto_ftrace_reader",
- ":perfetto_ipc",
- ":perfetto_ipc_messages_lite",
- ":perfetto_ipc_test_messages_ipc",
- ":perfetto_messages_lite",
- ":perfetto_messages_zero",
- ":perfetto_tracing",
- ":perfetto_tracing_ipc",
- ":perfetto_tracing_messages_lite",
- ":perfetto_tracing_ipcs_lite",
- ":protozero",
- ":protozero_testing_messages_lite",
- ":protozero_testing_messages_zero",
+ "src/ftrace_reader/test/test_messages.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_protoc_plugin___gn_standalone_toolchain_gcc_like_host_",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto && $(location aprotoc) --cpp_out=$(genDir)/external/perfetto --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_protoc_plugin___gn_standalone_toolchain_gcc_like_host_) --plugin_out=wrapper_namespace=pbzero:$(genDir)/external/perfetto $(in)",
+ out: [
+ "external/perfetto/src/ftrace_reader/test/test_messages.pbzero.h",
+ ],
+ export_include_dirs: [
+ ".",
+ ],
+}
+
+// GN target: //protos:lite_gen
+cc_genrule {
+ name: "perfetto_protos_lite_gen",
+ srcs: [
+ "protos/trace_packet.proto",
+ ],
+ tools: [
+ "aprotoc",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto && $(location aprotoc) --cpp_out=$(genDir)/external/perfetto --proto_path=external/perfetto $(in)",
+ out: [
+ "external/perfetto/protos/trace_packet.pb.cc",
+ ],
+}
+
+// GN target: //protos/ftrace:zero_gen
+cc_genrule {
+ name: "perfetto_protos_ftrace_zero_gen",
+ srcs: [
+ "protos/ftrace/ftrace_event.proto",
+ "protos/ftrace/ftrace_event_bundle.proto",
+ "protos/ftrace/print.proto",
+ "protos/ftrace/sched_switch.proto",
+ "protos/ftrace/test_bundle_wrapper.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_protoc_plugin___gn_standalone_toolchain_gcc_like_host_",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto && $(location aprotoc) --cpp_out=$(genDir)/external/perfetto --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_protoc_plugin___gn_standalone_toolchain_gcc_like_host_) --plugin_out=wrapper_namespace=pbzero:$(genDir)/external/perfetto $(in)",
+ out: [
+ "external/perfetto/protos/ftrace/ftrace_event.pbzero.cc",
+ "external/perfetto/protos/ftrace/ftrace_event_bundle.pbzero.cc",
+ "external/perfetto/protos/ftrace/print.pbzero.cc",
+ "external/perfetto/protos/ftrace/sched_switch.pbzero.cc",
+ "external/perfetto/protos/ftrace/test_bundle_wrapper.pbzero.cc",
+ ],
+}
+
+// GN target: //src/ipc:wire_protocol_gen
+cc_genrule {
+ name: "perfetto_src_ipc_wire_protocol_gen",
+ srcs: [
+ "src/ipc/wire_protocol.proto",
+ ],
+ tools: [
+ "aprotoc",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto && $(location aprotoc) --cpp_out=$(genDir)/external/perfetto --proto_path=external/perfetto $(in)",
+ out: [
+ "external/perfetto/src/ipc/wire_protocol.pb.cc",
+ ],
+}
+
+// GN target: //src/protozero:testing_messages_lite_gen
+cc_genrule {
+ name: "perfetto_src_protozero_testing_messages_lite_gen",
+ srcs: [
+ "src/protozero/test/example_proto/library.proto",
+ "src/protozero/test/example_proto/library_internals/galaxies.proto",
+ "src/protozero/test/example_proto/test_messages.proto",
+ "src/protozero/test/example_proto/upper_import.proto",
+ ],
+ tools: [
+ "aprotoc",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto && $(location aprotoc) --cpp_out=$(genDir)/external/perfetto --proto_path=external/perfetto $(in)",
+ out: [
+ "external/perfetto/src/protozero/test/example_proto/library.pb.cc",
+ "external/perfetto/src/protozero/test/example_proto/library_internals/galaxies.pb.cc",
+ "external/perfetto/src/protozero/test/example_proto/test_messages.pb.cc",
+ "external/perfetto/src/protozero/test/example_proto/upper_import.pb.cc",
+ ],
+}
+
+// GN target: //:perfetto_tests
+cc_test {
+ name: "perfetto_tests",
+ srcs: [
+ ":perfetto_protos_ftrace_lite_gen",
+ ":perfetto_protos_ftrace_zero_gen",
+ ":perfetto_protos_lite_gen",
+ ":perfetto_protos_tracing_service_lite_gen",
+ ":perfetto_protos_tracing_service_tracing_service_gen",
+ ":perfetto_src_ftrace_reader_ftrace_reader_test_messages_lite_gen",
+ ":perfetto_src_ftrace_reader_ftrace_reader_test_messages_zero_gen",
+ ":perfetto_src_ipc_test_messages_gen",
+ ":perfetto_src_ipc_wire_protocol_gen",
+ ":perfetto_src_protozero_testing_messages_lite_gen",
+ ":perfetto_src_protozero_testing_messages_zero_gen",
+ "src/base/android_task_runner.cc",
"src/base/scoped_file_unittest.cc",
"src/base/task_runner_unittest.cc",
+ "src/base/test/test_task_runner.cc",
+ "src/base/thread_checker.cc",
"src/base/thread_checker_unittest.cc",
+ "src/base/unix_task_runner.cc",
"src/base/utils_unittest.cc",
"src/base/weak_ptr_unittest.cc",
- // TODO(hjd): Uncomment once auto-generator comes in.
- // These tests rely on new protos in src/ftrace_reader/test/ which are too
- // painful to add right now
- // "src/ftrace_reader/cpu_reader_unittest.cc",
+ "src/ftrace_reader/cpu_reader.cc",
+ "src/ftrace_reader/cpu_reader_unittest.cc",
+ "src/ftrace_reader/event_info.cc",
"src/ftrace_reader/event_info_unittest.cc",
+ "src/ftrace_reader/format_parser.cc",
"src/ftrace_reader/format_parser_unittest.cc",
+ "src/ftrace_reader/ftrace_controller.cc",
"src/ftrace_reader/ftrace_controller_unittest.cc",
+ "src/ftrace_reader/ftrace_procfs.cc",
+ "src/ftrace_reader/ftrace_to_proto.cc",
"src/ftrace_reader/ftrace_to_proto_unittest.cc",
+ "src/ftrace_reader/proto_translation_table.cc",
"src/ftrace_reader/proto_translation_table_unittest.cc",
"src/ftrace_reader/test/scattered_stream_delegate_for_testing.cc",
+ "src/ipc/buffered_frame_deserializer.cc",
"src/ipc/buffered_frame_deserializer_unittest.cc",
+ "src/ipc/client_impl.cc",
"src/ipc/client_impl_unittest.cc",
+ "src/ipc/deferred.cc",
"src/ipc/deferred_unittest.cc",
+ "src/ipc/host_impl.cc",
"src/ipc/host_impl_unittest.cc",
+ "src/ipc/service_proxy.cc",
"src/ipc/test/ipc_integrationtest.cc",
+ "src/ipc/unix_socket.cc",
"src/ipc/unix_socket_unittest.cc",
+ "src/protozero/proto_utils.cc",
"src/protozero/proto_utils_unittest.cc",
+ "src/protozero/protozero_message.cc",
+ "src/protozero/protozero_message_handle.cc",
"src/protozero/protozero_message_unittest.cc",
+ "src/protozero/scattered_stream_writer.cc",
"src/protozero/scattered_stream_writer_unittest.cc",
"src/protozero/test/fake_scattered_buffer.cc",
"src/protozero/test/protozero_conformance_unittest.cc",
+ "src/tracing/core/chunked_protobuf_input_stream.cc",
+ "src/tracing/core/chunked_protobuf_input_stream_unittest.cc",
+ "src/tracing/core/data_source_config.cc",
+ "src/tracing/core/data_source_descriptor.cc",
+ "src/tracing/core/service_impl.cc",
"src/tracing/core/service_impl_unittest.cc",
+ "src/tracing/core/trace_config.cc",
+ "src/tracing/core/trace_packet.cc",
+ "src/tracing/core/trace_packet_unittest.cc",
+ "src/tracing/ipc/consumer/consumer_ipc_client_impl.cc",
+ "src/tracing/ipc/posix_shared_memory.cc",
"src/tracing/ipc/posix_shared_memory_unittest.cc",
+ "src/tracing/ipc/producer/producer_ipc_client_impl.cc",
+ "src/tracing/ipc/service/producer_ipc_service.cc",
+ "src/tracing/ipc/service/service_ipc_host_impl.cc",
"src/tracing/test/test_shared_memory.cc",
- ],
- generated_headers: [
- "perfetto_ipc_messages_lite_headers",
- "perfetto_ipc_test_messages_ipc_headers",
- "perfetto_messages_lite_headers",
- "perfetto_messages_zero_headers",
- "perfetto_tracing_messages_lite_headers",
- "perfetto_tracing_ipcs_lite_headers",
- "protozero_testing_messages_lite_headers",
- "protozero_testing_messages_zero_headers",
+ "tools/sanitizers_unittests/sanitizers_unittest.cc",
],
shared_libs: [
"libandroid",
- "libprotobuf-cpp-lite"
+ "liblog",
+ "libprotobuf-cpp-lite",
],
static_libs: [
- "libgmock"
+ "libgmock",
+ ],
+ generated_headers: [
+ "perfetto_protos_ftrace_lite_gen_headers",
+ "perfetto_protos_ftrace_zero_gen_headers",
+ "perfetto_protos_lite_gen_headers",
+ "perfetto_protos_tracing_service_lite_gen_headers",
+ "perfetto_protos_tracing_service_tracing_service_gen_headers",
+ "perfetto_src_ftrace_reader_ftrace_reader_test_messages_lite_gen_headers",
+ "perfetto_src_ftrace_reader_ftrace_reader_test_messages_zero_gen_headers",
+ "perfetto_src_ipc_test_messages_gen_headers",
+ "perfetto_src_ipc_wire_protocol_gen_headers",
+ "perfetto_src_protozero_testing_messages_lite_gen_headers",
+ "perfetto_src_protozero_testing_messages_zero_gen_headers",
+ ],
+ defaults: [
+ "perfetto_defaults",
],
}
-cc_benchmark {
- name: "perfetto_benchmarks",
- defaults: [ "perfetto_defaults" ],
+// GN target: //src/protozero:testing_messages_zero_gen
+cc_genrule {
+ name: "perfetto_src_protozero_testing_messages_zero_gen_headers",
srcs: [
- "src/tracing/test/hello_world_benchmark.cc",
- ]
+ "src/protozero/test/example_proto/library.proto",
+ "src/protozero/test/example_proto/library_internals/galaxies.proto",
+ "src/protozero/test/example_proto/test_messages.proto",
+ "src/protozero/test/example_proto/upper_import.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_protoc_plugin___gn_standalone_toolchain_gcc_like_host_",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto && $(location aprotoc) --cpp_out=$(genDir)/external/perfetto --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_protoc_plugin___gn_standalone_toolchain_gcc_like_host_) --plugin_out=wrapper_namespace=pbzero:$(genDir)/external/perfetto $(in)",
+ out: [
+ "external/perfetto/src/protozero/test/example_proto/library.pbzero.h",
+ "external/perfetto/src/protozero/test/example_proto/library_internals/galaxies.pbzero.h",
+ "external/perfetto/src/protozero/test/example_proto/test_messages.pbzero.h",
+ "external/perfetto/src/protozero/test/example_proto/upper_import.pbzero.h",
+ ],
+ export_include_dirs: [
+ ".",
+ ],
+}
+
+// GN target: //src/ftrace_reader:ftrace_reader_test_messages_lite_gen
+cc_genrule {
+ name: "perfetto_src_ftrace_reader_ftrace_reader_test_messages_lite_gen_headers",
+ srcs: [
+ "src/ftrace_reader/test/test_messages.proto",
+ ],
+ tools: [
+ "aprotoc",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto && $(location aprotoc) --cpp_out=$(genDir)/external/perfetto --proto_path=external/perfetto $(in)",
+ out: [
+ "external/perfetto/src/ftrace_reader/test/test_messages.pb.h",
+ ],
+ export_include_dirs: [
+ ".",
+ ],
+}
+
+// GN target: //protos/tracing_service:lite_gen
+cc_genrule {
+ name: "perfetto_protos_tracing_service_lite_gen_headers",
+ srcs: [
+ "protos/tracing_service/data_source_config.proto",
+ "protos/tracing_service/data_source_descriptor.proto",
+ "protos/tracing_service/trace_config.proto",
+ ],
+ tools: [
+ "aprotoc",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto && $(location aprotoc) --cpp_out=$(genDir)/external/perfetto --proto_path=external/perfetto $(in)",
+ out: [
+ "external/perfetto/protos/tracing_service/data_source_config.pb.h",
+ "external/perfetto/protos/tracing_service/data_source_descriptor.pb.h",
+ "external/perfetto/protos/tracing_service/trace_config.pb.h",
+ ],
+ export_include_dirs: [
+ ".",
+ ],
+}
+
+// GN target: //protos/ftrace:lite_gen
+cc_genrule {
+ name: "perfetto_protos_ftrace_lite_gen",
+ srcs: [
+ "protos/ftrace/ftrace_event.proto",
+ "protos/ftrace/ftrace_event_bundle.proto",
+ "protos/ftrace/print.proto",
+ "protos/ftrace/sched_switch.proto",
+ "protos/ftrace/test_bundle_wrapper.proto",
+ ],
+ tools: [
+ "aprotoc",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto && $(location aprotoc) --cpp_out=$(genDir)/external/perfetto --proto_path=external/perfetto $(in)",
+ out: [
+ "external/perfetto/protos/ftrace/ftrace_event.pb.cc",
+ "external/perfetto/protos/ftrace/ftrace_event_bundle.pb.cc",
+ "external/perfetto/protos/ftrace/print.pb.cc",
+ "external/perfetto/protos/ftrace/sched_switch.pb.cc",
+ "external/perfetto/protos/ftrace/test_bundle_wrapper.pb.cc",
+ ],
+}
+
+// GN target: //protos/ftrace:lite_gen
+cc_genrule {
+ name: "perfetto_protos_ftrace_lite_gen_headers",
+ srcs: [
+ "protos/ftrace/ftrace_event.proto",
+ "protos/ftrace/ftrace_event_bundle.proto",
+ "protos/ftrace/print.proto",
+ "protos/ftrace/sched_switch.proto",
+ "protos/ftrace/test_bundle_wrapper.proto",
+ ],
+ tools: [
+ "aprotoc",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto && $(location aprotoc) --cpp_out=$(genDir)/external/perfetto --proto_path=external/perfetto $(in)",
+ out: [
+ "external/perfetto/protos/ftrace/ftrace_event.pb.h",
+ "external/perfetto/protos/ftrace/ftrace_event_bundle.pb.h",
+ "external/perfetto/protos/ftrace/print.pb.h",
+ "external/perfetto/protos/ftrace/sched_switch.pb.h",
+ "external/perfetto/protos/ftrace/test_bundle_wrapper.pb.h",
+ ],
+ export_include_dirs: [
+ ".",
+ ],
+}
+
+// GN target: //protos/tracing_service:lite_gen
+cc_genrule {
+ name: "perfetto_protos_tracing_service_lite_gen",
+ srcs: [
+ "protos/tracing_service/data_source_config.proto",
+ "protos/tracing_service/data_source_descriptor.proto",
+ "protos/tracing_service/trace_config.proto",
+ ],
+ tools: [
+ "aprotoc",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto && $(location aprotoc) --cpp_out=$(genDir)/external/perfetto --proto_path=external/perfetto $(in)",
+ out: [
+ "external/perfetto/protos/tracing_service/data_source_config.pb.cc",
+ "external/perfetto/protos/tracing_service/data_source_descriptor.pb.cc",
+ "external/perfetto/protos/tracing_service/trace_config.pb.cc",
+ ],
+}
+
+// GN target: //protos/ftrace:zero_gen
+cc_genrule {
+ name: "perfetto_protos_ftrace_zero_gen_headers",
+ srcs: [
+ "protos/ftrace/ftrace_event.proto",
+ "protos/ftrace/ftrace_event_bundle.proto",
+ "protos/ftrace/print.proto",
+ "protos/ftrace/sched_switch.proto",
+ "protos/ftrace/test_bundle_wrapper.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_protoc_plugin___gn_standalone_toolchain_gcc_like_host_",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto && $(location aprotoc) --cpp_out=$(genDir)/external/perfetto --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_protoc_plugin___gn_standalone_toolchain_gcc_like_host_) --plugin_out=wrapper_namespace=pbzero:$(genDir)/external/perfetto $(in)",
+ out: [
+ "external/perfetto/protos/ftrace/ftrace_event.pbzero.h",
+ "external/perfetto/protos/ftrace/ftrace_event_bundle.pbzero.h",
+ "external/perfetto/protos/ftrace/print.pbzero.h",
+ "external/perfetto/protos/ftrace/sched_switch.pbzero.h",
+ "external/perfetto/protos/ftrace/test_bundle_wrapper.pbzero.h",
+ ],
+ export_include_dirs: [
+ ".",
+ ],
+}
+
+// GN target: //src/protozero/protoc_plugin:protoc_plugin(//gn/standalone/toolchain:gcc_like_host)
+cc_binary_host {
+ name: "perfetto_src_protozero_protoc_plugin_protoc_plugin___gn_standalone_toolchain_gcc_like_host_",
+ srcs: [
+ "src/protozero/protoc_plugin/protozero_generator.cc",
+ "src/protozero/protoc_plugin/protozero_plugin.cc",
+ ],
+ shared_libs: [
+ "libprotoc",
+ "libunwind",
+ ],
+ defaults: [
+ "perfetto_defaults",
+ ],
+}
+
+// GN target: //src/protozero:testing_messages_zero_gen
+cc_genrule {
+ name: "perfetto_src_protozero_testing_messages_zero_gen",
+ srcs: [
+ "src/protozero/test/example_proto/library.proto",
+ "src/protozero/test/example_proto/library_internals/galaxies.proto",
+ "src/protozero/test/example_proto/test_messages.proto",
+ "src/protozero/test/example_proto/upper_import.proto",
+ ],
+ tools: [
+ "aprotoc",
+ "perfetto_src_protozero_protoc_plugin_protoc_plugin___gn_standalone_toolchain_gcc_like_host_",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto && $(location aprotoc) --cpp_out=$(genDir)/external/perfetto --proto_path=external/perfetto --plugin=protoc-gen-plugin=$(location perfetto_src_protozero_protoc_plugin_protoc_plugin___gn_standalone_toolchain_gcc_like_host_) --plugin_out=wrapper_namespace=pbzero:$(genDir)/external/perfetto $(in)",
+ out: [
+ "external/perfetto/src/protozero/test/example_proto/library.pbzero.cc",
+ "external/perfetto/src/protozero/test/example_proto/library_internals/galaxies.pbzero.cc",
+ "external/perfetto/src/protozero/test/example_proto/test_messages.pbzero.cc",
+ "external/perfetto/src/protozero/test/example_proto/upper_import.pbzero.cc",
+ ],
}
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 3afea72..846927b 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -12,18 +12,51 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import subprocess
+
+
def CheckChange(input, output):
+ # There apparently is no way to wrap strings in blueprints, so ignore long
+ # lines in them.
+ long_line_sources = lambda x: input.FilterSourceFile(
+ x, white_list=".*", black_list=['Android[.]bp'])
+
results = []
results += input.canned_checks.CheckDoNotSubmit(input, output)
results += input.canned_checks.CheckChangeHasNoTabs(input, output)
- results += input.canned_checks.CheckLongLines(input, output, 80)
+ results += input.canned_checks.CheckLongLines(
+ input, output, 80, source_file_filter=long_line_sources)
results += input.canned_checks.CheckPatchFormatted(input, output)
results += input.canned_checks.CheckGNFormatted(input, output)
+ results += CheckAndroidBlueprint(input, output)
return results
+
def CheckChangeOnUpload(input_api, output_api):
return CheckChange(input_api, output_api)
+
def CheckChangeOnCommit(input_api, output_api):
return CheckChange(input_api, output_api)
+
+def CheckAndroidBlueprint(input_api, output_api):
+ # If no GN files were modified, bail out.
+ build_file_filter = lambda x: input_api.FilterSourceFile(
+ x,
+ white_list=('.*BUILD[.]gn$', '.*[.]gni$', 'tools/gen_android_bp'))
+ if not input_api.AffectedSourceFiles(build_file_filter):
+ return []
+
+ with open('Android.bp') as f:
+ current_blueprint = f.read()
+ new_blueprint = subprocess.check_output(
+ ['tools/gen_android_bp', '--output', '/dev/stdout'])
+
+ if current_blueprint != new_blueprint:
+ return [
+ output_api.PresubmitError(
+ 'Android.bp is out of date. Please run tools/gen_android_bp '
+ 'to update it.')
+ ]
+ return []
diff --git a/tools/gen_android_bp b/tools/gen_android_bp
index 28af300..8c6ea85 100755
--- a/tools/gen_android_bp
+++ b/tools/gen_android_bp
@@ -29,8 +29,16 @@
import json
import os
import re
+import shutil
+import subprocess
import sys
+# Default targets to translate to the blueprint file.
+default_targets = ['//:perfetto_tests']
+
+# Arguments for the GN output directory.
+gn_args = 'target_os="android" target_cpu="arm" is_debug=false'
+
# All module names are prefixed with this string to avoid collisions.
module_prefix = 'perfetto_'
@@ -448,24 +456,60 @@
return blueprint
+def repo_root():
+ """Returns an absolute path to the repository root."""
+
+ return os.path.join(
+ os.path.realpath(os.path.dirname(__file__)), os.path.pardir)
+
+
+def create_build_description():
+ """Creates the JSON build description by running GN."""
+
+ out = os.path.join(repo_root(), 'out', 'tmp.gen_android_bp')
+ try:
+ try:
+ os.makedirs(out)
+ except OSError as e:
+ if e.errno != errno.EEXIST:
+ raise
+ subprocess.check_output(
+ ['gn', 'gen', out, '--args=%s' % gn_args], cwd=repo_root())
+ desc = subprocess.check_output(
+ ['gn', 'desc', out, '--format=json', '--all-toolchains', '//*'],
+ cwd=repo_root())
+ return json.loads(desc)
+ finally:
+ shutil.rmtree(out)
+
+
def main():
parser = argparse.ArgumentParser(
description='Generate Android.bp from a GN description.')
parser.add_argument(
- 'desc',
+ '--desc',
help=
'GN description (e.g., gn desc out --format=json --all-toolchains "//*"'
)
parser.add_argument(
+ '--output',
+ help='Blueprint file to create',
+ default=os.path.join(repo_root(), 'Android.bp'),
+ )
+ parser.add_argument(
'targets',
nargs=argparse.REMAINDER,
help='Targets to include in the blueprint (e.g., "//:perfetto_tests")')
args = parser.parse_args()
- with open(args.desc) as f:
- desc = json.load(f)
+ if args.desc:
+ with open(args.desc) as f:
+ desc = json.load(f)
+ else:
+ desc = create_build_description()
- blueprint = create_blueprint_for_targets(desc, args.targets)
+ blueprint = create_blueprint_for_targets(desc, args.targets
+ or default_targets)
output = [
"""// Copyright (C) 2017 The Android Open Source Project
//
@@ -485,7 +529,8 @@
""" % (__file__)
]
blueprint.to_string(output)
- print '\n'.join(output)
+ with open(args.output, 'w') as f:
+ f.write('\n'.join(output))
if __name__ == '__main__':