diff --git a/init/Android.bp b/init/Android.bp index f28934e95..3bb08db6c 100644 --- a/init/Android.bp +++ b/init/Android.bp @@ -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 // ------------------------------------------------------------------------------ diff --git a/init/action_parser.cpp b/init/action_parser.cpp index f3168716f..52f6a1f3c 100644 --- a/init/action_parser.cpp +++ b/init/action_parser.cpp @@ -21,7 +21,7 @@ #include #include -#if defined(__ANDROID__) +#ifdef INIT_FULL_SOURCES #include "property_service.h" #include "selinux.h" #else diff --git a/init/service.cpp b/init/service.cpp index 665a1b0a1..b12d11aec 100644 --- a/init/service.cpp +++ b/init/service.cpp @@ -40,7 +40,7 @@ #include "service_list.h" #include "util.h" -#if defined(__ANDROID__) +#ifdef INIT_FULL_SOURCES #include #include @@ -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; diff --git a/init/service_parser.cpp b/init/service_parser.cpp index 4b04ba05c..560f693f9 100644 --- a/init/service_parser.cpp +++ b/init/service_parser.cpp @@ -34,7 +34,7 @@ #include "service_utils.h" #include "util.h" -#if defined(__ANDROID__) +#ifdef INIT_FULL_SOURCES #include #include diff --git a/init/subcontext.cpp b/init/subcontext.cpp index 326015952..5263c14c8 100644 --- a/init/subcontext.cpp +++ b/init/subcontext.cpp @@ -31,7 +31,7 @@ #include "proto_utils.h" #include "util.h" -#if defined(__ANDROID__) +#ifdef INIT_FULL_SOURCES #include #include "property_service.h" #include "selabel.h" diff --git a/init/test_utils/Android.bp b/init/test_utils/Android.bp deleted file mode 100644 index 1cb05b629..000000000 --- a/init/test_utils/Android.bp +++ /dev/null @@ -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 -} diff --git a/init/util.cpp b/init/util.cpp index 503c70536..24f94ec9e 100644 --- a/init/util.cpp +++ b/init/util.cpp @@ -41,7 +41,7 @@ #include #include -#if defined(__ANDROID__) +#ifdef INIT_FULL_SOURCES #include #include