From 9b4ad17bfbdf3d0791f58ed6e480e20cf371990a Mon Sep 17 00:00:00 2001 From: Jooyung Han Date: Tue, 27 Aug 2024 13:07:58 +0900 Subject: [PATCH] libinit_host: clean up dependencies libinit_host doesn't need HIDL stuff. host_init_verifier does HIDL interface checks. Bug: 326827772 Test: mmma system/core Change-Id: I59c1444649a62202abb54a2e0cceee38522c1259 --- init/Android.bp | 40 ++++++++++++++++++++++++++++------------ init/noop_builtins.cpp | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 12 deletions(-) create mode 100644 init/noop_builtins.cpp diff --git a/init/Android.bp b/init/Android.bp index 8f1ca3de1c..18a79d6c42 100644 --- a/init/Android.bp +++ b/init/Android.bp @@ -84,11 +84,6 @@ init_device_sources = [ "ueventd.cpp", "ueventd_parser.cpp", ] -init_host_sources = [ - "check_builtins.cpp", - "host_import_parser.cpp", - "interface_utils.cpp", -] soong_config_module_type { name: "libinit_cc_defaults", @@ -606,8 +601,6 @@ cc_defaults { whole_static_libs: ["libcap"], shared_libs: [ "libcutils", - "libhidl-gen-utils", - "libhidlmetadata", "liblog", "libprocessgroup", "libprotobuf-cpp-lite", @@ -615,9 +608,6 @@ cc_defaults { proto: { type: "lite", }, - generated_headers: [ - "generated_stub_builtin_function_map", - ], target: { android: { enabled: false, @@ -636,17 +626,43 @@ cc_defaults { cc_binary { name: "host_init_verifier", defaults: ["init_host_defaults"], - srcs: ["host_init_verifier.cpp"] + init_common_sources + init_host_sources, + srcs: [ + "check_builtins.cpp", + "host_import_parser.cpp", + "host_init_verifier.cpp", + "interface_utils.cpp", + ] + init_common_sources, generated_headers: [ "generated_android_ids", + "generated_stub_builtin_function_map", + ], + shared_libs: [ + "libhidl-gen-utils", + "libhidlmetadata", ], } +genrule { + name: "noop_builtin_function_map", + tool_files: ["host_builtin_map.py"], + out: ["noop_builtin_function_map.h"], + srcs: [ + "builtins.cpp", + "noop_builtins.cpp", + ], + cmd: "$(location host_builtin_map.py) --builtins $(location builtins.cpp) --check_builtins $(location noop_builtins.cpp) > $(out)", +} + cc_library_host_static { name: "libinit_host", defaults: ["init_host_defaults"], - srcs: init_common_sources + init_host_sources, + srcs: [ + "noop_builtins.cpp", + ] + init_common_sources, export_include_dirs: ["."], + generated_headers: [ + "noop_builtin_function_map", + ], proto: { export_proto_headers: true, }, diff --git a/init/noop_builtins.cpp b/init/noop_builtins.cpp new file mode 100644 index 0000000000..c4e140be3a --- /dev/null +++ b/init/noop_builtins.cpp @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2024 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. + */ + +// Note that parser will perform arity checks only. + +#include + +#include "builtin_arguments.h" +#include "builtins.h" + +namespace android::init { + +static base::Result check_stub(const BuiltinArguments&) { + return {}; +} + +#include "noop_builtin_function_map.h" + +} // namespace android::init -- GitLab