From 3c71bbdde3a8d3219934a0fadbfd40b1850a9043 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Fri, 14 Apr 2017 00:54:46 -0700 Subject: [PATCH 1/7] libbase: add libbase_headers Test: can include headers in other soong modules Bug: 33241851 (cherry picked from commit 8f56c1ecd71dc142b3fd02826ba4e8b37485c1d0) Merged-In: Ie3d11d1559f5aae46125695fd1f3a63da8e429ae Change-Id: Ie3d11d1559f5aae46125695fd1f3a63da8e429ae --- base/Android.bp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/base/Android.bp b/base/Android.bp index 3af768614..fb55275fb 100644 --- a/base/Android.bp +++ b/base/Android.bp @@ -20,6 +20,25 @@ libbase_cppflags = [ "-Werror", ] +cc_library_headers { + name: "libbase_headers", + vendor_available: true, + host_supported: true, + export_include_dirs: ["include"], + + header_libs: ["libutils_headers"], + export_header_lib_headers: ["libutils_headers"], + + target: { + linux_bionic: { + enabled: true, + }, + windows: { + enabled: true, + }, + }, +} + cc_library { name: "libbase", clang: true, @@ -33,9 +52,11 @@ cc_library { "strings.cpp", "test_utils.cpp", ], - local_include_dirs: ["include"], + + header_libs: ["libbase_headers"], + export_header_lib_headers: ["libbase_headers"], + cppflags: libbase_cppflags, - export_include_dirs: ["include"], shared_libs: ["liblog"], target: { android: { From bb11af88e234f27c08499994f23994289077f5c1 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Thu, 13 Apr 2017 23:35:06 -0700 Subject: [PATCH 2/7] libbacktrace: make vendor_available By setting vendor_available, the following may become true: * a prebuilt library from this release may be used at runtime by in a later releasse (by vendor code compiled against this release). so this library shouldn't depend on runtime state that may change in the future. * this library may be loaded twice into a single process (potentially an old version and a newer version). The symbols will be isolated using linker namespaces, but this may break assumptions about 1 library in 1 process (your singletons will run twice). Background: This means that these modules may be built and installed twice -- once for the system partition and once for the vendor partition. The system version will build just like today, and will be used by the framework components on /system. The vendor version will build against a reduced set of exports and libraries -- similar to, but separate from, the NDK. This means that all your dependencies must also mark vendor_available. At runtime, /system binaries will load libraries from /system/lib*, while /vendor binaries will load libraries from /vendor/lib*. There are some exceptions in both directions -- bionic(libc,etc) and liblog are always loaded from /system. And SP-HALs (OpenGL, etc) may load /vendor code into /system processes, but the dependencies of those libraries will load from /vendor until it reaches a library that's always on /system. In the SP-HAL case, if both framework and vendor libraries depend on a library of the same name, both versions will be loaded, but they will be isolated from each other. It's possible to compile differently -- reducing your source files, exporting different include directories, etc. For details see: https://android-review.googlesource.com/368372 None of this is enabled unless the device opts into the system/vendor split with BOARD_VNDK_VERSION := current. Bug: 33241851 Test: build and flash internal marlin Test: m -j libbacktrace Test: build with BOARD_VNDK_VERSION := current (cherry picked from commit 4c0e956c7690abf0c434e742a369fb8576abf413) Merged-In: Idab4880e011416ebc40b225205c30fb5ed8661db Change-Id: Idab4880e011416ebc40b225205c30fb5ed8661db --- libbacktrace/Android.bp | 1 + 1 file changed, 1 insertion(+) diff --git a/libbacktrace/Android.bp b/libbacktrace/Android.bp index 7de72a876..4a525be97 100644 --- a/libbacktrace/Android.bp +++ b/libbacktrace/Android.bp @@ -62,6 +62,7 @@ cc_library_headers { cc_library { name: "libbacktrace", + vendor_available: true, defaults: ["libbacktrace_common"], host_supported: true, From 385fe692cccce3a00534bd3b20c471f62fadcd4d Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Thu, 13 Apr 2017 14:29:58 -0700 Subject: [PATCH 3/7] libcutils: vendor_available By setting vendor_available, the following may become true: * a prebuilt library from this release may be used at runtime by in a later releasse (by vendor code compiled against this release). so this library shouldn't depend on runtime state that may change in the future. * this library may be loaded twice into a single process (potentially an old version and a newer version). The symbols will be isolated using linker namespaces, but this may break assumptions about 1 library in 1 process (your singletons will run twice). Background: This means that these modules may be built and installed twice -- once for the system partition and once for the vendor partition. The system version will build just like today, and will be used by the framework components on /system. The vendor version will build against a reduced set of exports and libraries -- similar to, but separate from, the NDK. This means that all your dependencies must also mark vendor_available. At runtime, /system binaries will load libraries from /system/lib*, while /vendor binaries will load libraries from /vendor/lib*. There are some exceptions in both directions -- bionic(libc,etc) and liblog are always loaded from /system. And SP-HALs (OpenGL, etc) may load /vendor code into /system processes, but the dependencies of those libraries will load from /vendor until it reaches a library that's always on /system. In the SP-HAL case, if both framework and vendor libraries depend on a library of the same name, both versions will be loaded, but they will be isolated from each other. It's possible to compile differently -- reducing your source files, exporting different include directories, etc. For details see: https://android-review.googlesource.com/368372 None of this is enabled unless the device opts into the system/vendor split with BOARD_VNDK_VERSION := current. Bug: 36426473 Bug: 36079834 Test: m -j libcutils Test: attempt to compile with BOARD_VNDK_VERSION := current Test: (sanity) boot internal marlin (cherry picked from commit 9610c548a8e9018ecdfbe3d7204e8fd70d2554fc) Merged-In: I76f9b28ef08a26d84d1365881e00696cc1dcfe5d Change-Id: I76f9b28ef08a26d84d1365881e00696cc1dcfe5d --- libcutils/Android.bp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/libcutils/Android.bp b/libcutils/Android.bp index 0a3bab744..58170ec71 100644 --- a/libcutils/Android.bp +++ b/libcutils/Android.bp @@ -29,17 +29,15 @@ libcutils_nonwindows_sources = [ "str_parms.c", ] -cc_library_headers { - name: "libcutils_vndk_headers", - host_supported: true, - export_include_dirs: ["include_vndk"], -} - cc_library_headers { name: "libcutils_headers", + vendor_available: true, host_supported: true, export_include_dirs: ["include"], target: { + vendor: { + export_include_dirs: ["include_vndk"], + }, linux_bionic: { enabled: true, }, @@ -51,6 +49,7 @@ cc_library_headers { cc_library { name: "libcutils", + vendor_available: true, host_supported: true, srcs: [ "config_utils.c", From d10a02320821c00f849a2a6954d714669a8fe402 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Thu, 13 Apr 2017 15:13:57 -0700 Subject: [PATCH 4/7] libbase: make vendor_available By setting vendor_available, the following may become true: * a prebuilt library from this release may be used at runtime by in a later releasse (by vendor code compiled against this release). so this library shouldn't depend on runtime state that may change in the future. * this library may be loaded twice into a single process (potentially an old version and a newer version). The symbols will be isolated using linker namespaces, but this may break assumptions about 1 library in 1 process (your singletons will run twice). Background: This means that these modules may be built and installed twice -- once for the system partition and once for the vendor partition. The system version will build just like today, and will be used by the framework components on /system. The vendor version will build against a reduced set of exports and libraries -- similar to, but separate from, the NDK. This means that all your dependencies must also mark vendor_available. At runtime, /system binaries will load libraries from /system/lib*, while /vendor binaries will load libraries from /vendor/lib*. There are some exceptions in both directions -- bionic(libc,etc) and liblog are always loaded from /system. And SP-HALs (OpenGL, etc) may load /vendor code into /system processes, but the dependencies of those libraries will load from /vendor until it reaches a library that's always on /system. In the SP-HAL case, if both framework and vendor libraries depend on a library of the same name, both versions will be loaded, but they will be isolated from each other. It's possible to compile differently -- reducing your source files, exporting different include directories, etc. For details see: https://android-review.googlesource.com/368372 None of this is enabled unless the device opts into the system/vendor split with BOARD_VNDK_VERSION := current. Bug: 33241851 Test: build and flash internal marlin Test: m -j libbase Test: build with BOARD_VNDK_VERSION := current (cherry picked from commit c28517f95611c96628e27eb570ff1c2805cbd5f6) Merged-In: I720a00deada4e62628e6fbc4ac830265de9c669f Change-Id: I720a00deada4e62628e6fbc4ac830265de9c669f --- base/Android.bp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/base/Android.bp b/base/Android.bp index fb55275fb..c1c0bf83f 100644 --- a/base/Android.bp +++ b/base/Android.bp @@ -41,6 +41,7 @@ cc_library_headers { cc_library { name: "libbase", + vendor_available: true, clang: true, host_supported: true, srcs: [ @@ -58,6 +59,7 @@ cc_library { cppflags: libbase_cppflags, shared_libs: ["liblog"], + header_libs: ["libutils_headers"], target: { android: { srcs: [ From 2bd434223415b09ce7d0e21eb74e81c8c2174b3d Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Mon, 17 Apr 2017 12:55:40 -0700 Subject: [PATCH 5/7] Remove VNDK warning. Added todo once usages are fixed. Bug: 33241851 Test: things with -Werror now compile in VNDK (cherry picked from commit 81626e48cb075aeab36e95047f047922d9a2715f) Merged-In: I6c4a148dca4d4710912fe62a8854cb8077651701 Change-Id: I6c4a148dca4d4710912fe62a8854cb8077651701 --- libcutils/include_vndk/cutils/log.h | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/libcutils/include_vndk/cutils/log.h b/libcutils/include_vndk/cutils/log.h index ae74024a3..21dc11e43 100644 --- a/libcutils/include_vndk/cutils/log.h +++ b/libcutils/include_vndk/cutils/log.h @@ -16,6 +16,32 @@ */ #ifndef _LIBS_CUTIL_LOG_H #define _LIBS_CUTIL_LOG_H -#warning "Deprecated: don't include cutils/log.h, use either android/log.h or log/log.h" + +/* We do not know if developer wanted log/log.h or subset android/log.h */ #include + +#if defined(__GNUC__) +#if defined( __clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic warning "-W#warnings" +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpedantic" +#elif (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR > 9)) +#pragma GCC diagnostic push +#pragma GCC diagnostic warning "-W#warnings" +#else +#pragma GCC diagnostic push +#pragma GCC diagnostic warning "-Wcpp" +#endif +#endif + +#warning "Deprecated: don't include cutils/log.h, use either android/log.h or log/log.h" + +#if defined(__GNUC__) +#if defined( __clang__) +#pragma clang diagnostic pop +#endif +#pragma GCC diagnostic pop +#endif + #endif /* _LIBS_CUTIL_LOG_H */ From 9990de1f643c9dc581e2977ae7222a21c39389b0 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Thu, 13 Apr 2017 23:27:20 -0700 Subject: [PATCH 6/7] libsync: vendor_available By setting vendor_available, the following may become true: * a prebuilt library from this release may be used at runtime by in a later releasse (by vendor code compiled against this release). so this library shouldn't depend on runtime state that may change in the future. * this library may be loaded twice into a single process (potentially an old version and a newer version). The symbols will be isolated using linker namespaces, but this may break assumptions about 1 library in 1 process (your singletons will run twice). Background: This means that these modules may be built and installed twice -- once for the system partition and once for the vendor partition. The system version will build just like today, and will be used by the framework components on /system. The vendor version will build against a reduced set of exports and libraries -- similar to, but separate from, the NDK. This means that all your dependencies must also mark vendor_available. At runtime, /system binaries will load libraries from /system/lib*, while /vendor binaries will load libraries from /vendor/lib*. There are some exceptions in both directions -- bionic(libc,etc) and liblog are always loaded from /system. And SP-HALs (OpenGL, etc) may load /vendor code into /system processes, but the dependencies of those libraries will load from /vendor until it reaches a library that's always on /system. In the SP-HAL case, if both framework and vendor libraries depend on a library of the same name, both versions will be loaded, but they will be isolated from each other. It's possible to compile differently -- reducing your source files, exporting different include directories, etc. For details see: https://android-review.googlesource.com/368372 None of this is enabled unless the device opts into the system/vendor split with BOARD_VNDK_VERSION := current. Bug: 33241851 Test: build and flash internal marlin Test: m -j libsync Test: build with BOARD_VNDK_VERSION := current (cherry picked from commit d0b26edf309cc090569dae65aa3ab6bf8361b020) Merged-In: I5b23d2c1f41b842e5a9b7ea257921133b80c3f98 Change-Id: I5b23d2c1f41b842e5a9b7ea257921133b80c3f98 --- libsync/Android.bp | 1 + 1 file changed, 1 insertion(+) diff --git a/libsync/Android.bp b/libsync/Android.bp index a4e55992c..4bafb0854 100644 --- a/libsync/Android.bp +++ b/libsync/Android.bp @@ -8,6 +8,7 @@ cc_defaults { cc_library_shared { name: "libsync", + vendor_available: true, defaults: ["libsync_defaults"], } From e131f31db51100dfa27d201d86f3f2d92a89d0fc Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Fri, 14 Apr 2017 11:23:36 -0700 Subject: [PATCH 7/7] libbase: fix build breakage Two changes were merged at the same time that conflicted. Test: builds (cherry picked from commit 72b9d28423fb79eebdd4d74593ca03e1cbc7d75f) Merged-In: Ia6c730804cd5a3b2655e6d69b8e4f346d198dabb Change-Id: Ia6c730804cd5a3b2655e6d69b8e4f346d198dabb --- base/Android.bp | 1 - 1 file changed, 1 deletion(-) diff --git a/base/Android.bp b/base/Android.bp index c1c0bf83f..afb7dd363 100644 --- a/base/Android.bp +++ b/base/Android.bp @@ -59,7 +59,6 @@ cc_library { cppflags: libbase_cppflags, shared_libs: ["liblog"], - header_libs: ["libutils_headers"], target: { android: { srcs: [