Refactor libinit_test_utils to not use libinit and expose its libraries
Users of libinit_test_utils must include all libraries that it uses.
If it uses libinit, then there is a large number of libraries that
must be included. To avoid this, make libinit_test_utils only use
init_common_sources and the small number of required libraries that go
along with those sources. Additionally, expose these sources as a
default for users of libinit_test_utils.
Bug: 148236233
Test: build
Merged-In: I224fa7e0590d073e4cd40412b5dcb6f72a64b6bf
Change-Id: I224fa7e0590d073e4cd40412b5dcb6f72a64b6bf
(cherry picked from commit a2f9136b2c
)
This commit is contained in:
parent
efab99063d
commit
eb04526a1e
|
@ -88,6 +88,7 @@ cc_defaults {
|
|||
"-DWORLD_WRITABLE_KMSG=0",
|
||||
"-DDUMP_ON_UMOUNT_FAILURE=0",
|
||||
"-DSHUTDOWN_ZERO_TIMEOUT=0",
|
||||
"-DINIT_FULL_SOURCES",
|
||||
],
|
||||
product_variables: {
|
||||
debuggable: {
|
||||
|
@ -267,6 +268,37 @@ cc_benchmark {
|
|||
static_libs: ["libinit"],
|
||||
}
|
||||
|
||||
cc_defaults {
|
||||
name: "libinit_test_utils_libraries_defaults",
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
"libcutils",
|
||||
"libselinux",
|
||||
"libhidl-gen-utils",
|
||||
"liblog",
|
||||
"libprocessgroup",
|
||||
"libprotobuf-cpp-lite",
|
||||
],
|
||||
}
|
||||
|
||||
cc_library_static {
|
||||
name: "libinit_test_utils",
|
||||
defaults: ["libinit_test_utils_libraries_defaults"],
|
||||
cflags: [
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Wno-unused-parameter",
|
||||
"-Werror",
|
||||
],
|
||||
srcs: init_common_sources + [
|
||||
"test_utils/service_utils.cpp",
|
||||
],
|
||||
whole_static_libs: [
|
||||
"libcap",
|
||||
],
|
||||
export_include_dirs: ["test_utils/include"], // for tests
|
||||
}
|
||||
|
||||
// Host Verifier
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <android-base/properties.h>
|
||||
#include <android-base/strings.h>
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
#ifdef INIT_FULL_SOURCES
|
||||
#include "property_service.h"
|
||||
#include "selinux.h"
|
||||
#else
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "service_list.h"
|
||||
#include "util.h"
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
#ifdef INIT_FULL_SOURCES
|
||||
#include <ApexProperties.sysprop.h>
|
||||
#include <android/api-level.h>
|
||||
|
||||
|
@ -303,7 +303,7 @@ void Service::Reap(const siginfo_t& siginfo) {
|
|||
return;
|
||||
}
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
#if INIT_FULL_SOURCES
|
||||
static bool is_apex_updatable = android::sysprop::ApexProperties::updatable().value_or(false);
|
||||
#else
|
||||
static bool is_apex_updatable = false;
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include "service_utils.h"
|
||||
#include "util.h"
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
#ifdef INIT_FULL_SOURCES
|
||||
#include <android/api-level.h>
|
||||
#include <sys/system_properties.h>
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include "proto_utils.h"
|
||||
#include "util.h"
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
#ifdef INIT_FULL_SOURCES
|
||||
#include <android/api-level.h>
|
||||
#include "property_service.h"
|
||||
#include "selabel.h"
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
cc_library_static {
|
||||
name: "libinit_test_utils",
|
||||
cflags: [
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Wno-unused-parameter",
|
||||
"-Werror",
|
||||
],
|
||||
srcs: [
|
||||
"service_utils.cpp",
|
||||
],
|
||||
shared_libs: [
|
||||
"libcutils",
|
||||
"liblog",
|
||||
"libjsoncpp",
|
||||
"libprotobuf-cpp-lite",
|
||||
"libhidl-gen-utils",
|
||||
],
|
||||
whole_static_libs: [
|
||||
"libinit",
|
||||
"libpropertyinfoparser",
|
||||
],
|
||||
static_libs: [
|
||||
"libbase",
|
||||
],
|
||||
export_include_dirs: ["include"], // for tests
|
||||
}
|
|
@ -41,7 +41,7 @@
|
|||
#include <cutils/sockets.h>
|
||||
#include <selinux/android.h>
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
#ifdef INIT_FULL_SOURCES
|
||||
#include <android/api-level.h>
|
||||
#include <sys/system_properties.h>
|
||||
|
||||
|
|
Loading…
Reference in New Issue