Perfprofd: Move binder code into subdirectory
Cleaner separation of concerns.
Test: m
Change-Id: I8a2022b89bca225ee73d8779e2b7b32cc16e9113
diff --git a/perfprofd/Android.bp b/perfprofd/Android.bp
index 8229cd9..0e14a02 100644
--- a/perfprofd/Android.bp
+++ b/perfprofd/Android.bp
@@ -1,12 +1,31 @@
-perfprofd_cflags = [
- "-Wall",
- "-Werror",
-]
+//
+// Copyright (C) 2016 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.
+//
-perfprofd_cppflags = [
- "-Wno-sign-compare",
- "-Wno-unused-parameter",
-]
+cc_defaults {
+ name: "perfprofd_defaults",
+
+ cflags: [
+ "-Wall",
+ "-Werror",
+ ],
+ cppflags: [
+ "-Wno-sign-compare",
+ "-Wno-unused-parameter",
+ ],
+}
//
// Static library for ELF symbolization.
@@ -16,6 +35,9 @@
cc_library_static {
name: "libperfprofd_elf_read",
+ defaults: [
+ "perfprofd_defaults",
+ ],
export_include_dirs: [
"simpleperf",
@@ -66,6 +88,9 @@
cc_library_static {
name: "libperfprofdcore",
+ defaults: [
+ "perfprofd_defaults",
+ ],
local_include_dirs: ["quipper/kernel-headers"],
export_include_dirs: ["."],
@@ -87,9 +112,6 @@
"symbolizer.cc"
],
- cflags: perfprofd_cflags,
- cppflags: perfprofd_cppflags,
-
proto: {
export_proto_headers: true,
},
@@ -100,32 +122,13 @@
//
cc_library_static {
name: "libperfprofdutils",
-
- cflags: perfprofd_cflags,
- cppflags: perfprofd_cppflags,
- srcs: ["perfprofdutils.cc"],
-}
-
-//
-// Static library with binder service.
-//
-cc_library_static {
- name: "libperfprofd_binder",
-
- export_include_dirs: ["."],
- static_libs: [
- "libbase",
- "libbinder",
- "libprotobuf-cpp-lite",
+ defaults: [
+ "perfprofd_defaults",
],
+
srcs: [
- "perfprofd_binder.cc",
- ":perfprofd_aidl",
- "perfprofd_config.proto",
+ "perfprofdutils.cc",
],
-
- cflags: perfprofd_cflags,
- cppflags: perfprofd_cppflags,
}
//
@@ -133,16 +136,22 @@
//
cc_binary {
name: "perfprofd",
+ defaults: [
+ "perfprofd_defaults",
+ ],
srcs: [
"perfprofdmain.cc",
],
+
static_libs: [
"libperfprofdcore",
"libperfprofdutils",
"libperfprofd_binder",
"libperfprofd_elf_read",
],
+ group_static_libs: true,
+
shared_libs: [
"liblog",
"libprotobuf-cpp-lite",
@@ -150,17 +159,11 @@
"libbinder",
"libutils",
],
- cflags: perfprofd_cflags,
- cppflags: perfprofd_cppflags,
init_rc: ["perfprofd.rc"],
}
-filegroup {
- name: "perfprofd_aidl",
- srcs: [
- "binder/android/os/IPerfProfd.aidl",
- ],
-}
-
-subdirs = ["tests"]
+subdirs = [
+ "binder_interface",
+ "tests",
+]
diff --git a/perfprofd/binder_interface/Android.bp b/perfprofd/binder_interface/Android.bp
new file mode 100644
index 0000000..c40036b
--- /dev/null
+++ b/perfprofd/binder_interface/Android.bp
@@ -0,0 +1,45 @@
+//
+// 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.
+//
+
+//
+// Static library with binder service.
+//
+cc_library_static {
+ name: "libperfprofd_binder",
+ defaults: [
+ "perfprofd_defaults",
+ ],
+
+ export_include_dirs: ["."],
+ static_libs: [
+ "libbase",
+ "libbinder",
+ "libperfprofdcore",
+ "libprotobuf-cpp-lite",
+ ],
+ srcs: [
+ "perfprofd_binder.cc",
+ ":perfprofd_aidl",
+ "perfprofd_config.proto",
+ ],
+}
+
+filegroup {
+ name: "perfprofd_aidl",
+ srcs: [
+ "aidl/android/os/IPerfProfd.aidl",
+ ],
+}
diff --git a/perfprofd/binder/android/os/IPerfProfd.aidl b/perfprofd/binder_interface/aidl/android/os/IPerfProfd.aidl
similarity index 100%
rename from perfprofd/binder/android/os/IPerfProfd.aidl
rename to perfprofd/binder_interface/aidl/android/os/IPerfProfd.aidl
diff --git a/perfprofd/perfprofd_binder.cc b/perfprofd/binder_interface/perfprofd_binder.cc
similarity index 100%
rename from perfprofd/perfprofd_binder.cc
rename to perfprofd/binder_interface/perfprofd_binder.cc
diff --git a/perfprofd/perfprofd_binder.h b/perfprofd/binder_interface/perfprofd_binder.h
similarity index 78%
rename from perfprofd/perfprofd_binder.h
rename to perfprofd/binder_interface/perfprofd_binder.h
index c04eaa7..8ab6d09 100644
--- a/perfprofd/perfprofd_binder.h
+++ b/perfprofd/binder_interface/perfprofd_binder.h
@@ -15,8 +15,8 @@
** limitations under the License.
*/
-#ifndef SYSTEM_EXTRAS_PERFPROFD_PERFPROFD_BINDER_H_
-#define SYSTEM_EXTRAS_PERFPROFD_PERFPROFD_BINDER_H_
+#ifndef SYSTEM_EXTRAS_PERFPROFD_BINDER_INTERFACE_PERFPROFD_BINDER_H_
+#define SYSTEM_EXTRAS_PERFPROFD_BINDER_INTERFACE_PERFPROFD_BINDER_H_
namespace android {
namespace perfprofd {
@@ -28,4 +28,4 @@
} // namespace perfprofd
} // namespace android
-#endif // SYSTEM_EXTRAS_PERFPROFD_PERFPROFD_BINDER_H_
+#endif // SYSTEM_EXTRAS_PERFPROFD_BINDER_INTERFACE_PERFPROFD_BINDER_H_
diff --git a/perfprofd/perfprofd_config.proto b/perfprofd/binder_interface/perfprofd_config.proto
similarity index 100%
rename from perfprofd/perfprofd_config.proto
rename to perfprofd/binder_interface/perfprofd_config.proto
diff --git a/perfprofd/scripts/perf_config_proto.py b/perfprofd/scripts/perf_config_proto.py
index 11456a2..13eef95 100644
--- a/perfprofd/scripts/perf_config_proto.py
+++ b/perfprofd/scripts/perf_config_proto.py
@@ -18,7 +18,7 @@
# Generate with:
# aprotoc -I=system/extras/perfprofd --python_out=system/extras/perfprofd/scripts \
-# system/extras/perfprofd/perfprofd_config.proto
+# system/extras/perfprofd/binder_interface/perfprofd_config.proto
import perfprofd_config_pb2
import sys