Split up headers.

This splits headers into three locations:
include - for backwards compatibility, the global include
include_all - for things system/vendor both use
include_vendor - for things that only vendors use

The goal is to gradually have system things stop referencing
(at least most) of these headers.

Bug: 37280010
Test: build (CL on top adds back in symlinks)

Change-Id: Ibf194276b7faa857e1e7605d7719f4e7d873ecba
This commit is contained in:
Steven Moreland 2019-01-14 17:40:45 -08:00
parent c0a81b9dc6
commit d783cabd4d
52 changed files with 38 additions and 1 deletions

View file

@ -32,6 +32,7 @@ license {
cc_library_headers { cc_library_headers {
name: "libhardware_headers", name: "libhardware_headers",
header_libs: [ header_libs: [
"libaudio_system_headers", "libaudio_system_headers",
"libsystem_headers", "libsystem_headers",
@ -45,11 +46,22 @@ cc_library_headers {
"libbluetooth-types-header", "libbluetooth-types-header",
], ],
export_include_dirs: ["include"],
recovery_available: true, recovery_available: true,
vendor_available: true, vendor_available: true,
// TODO(b/153609531): remove when no longer needed. // TODO(b/153609531): remove when no longer needed.
native_bridge_supported: true, native_bridge_supported: true,
// There are three include directories currently:
// - include: this directory is the original location of libhardware headers. It is globally
// available (even if you do not depend on libhardware). Many locations also use
// LOCAL_C_INCLUDES or include_dirs to access these from a global namespace. These processes
// should replace this dependency with a direct dependency on libhardware(_headers)?.
// - include_all: this directory is for system and vendor include files. Gradually, the number of
// files here should be reduced to 0 by moving them to vendor as old code is phased out.
// - include_vendor: this directory is the current designated resting place for these headers.
// They are kept around to try to help insure existing codebases can function.
export_include_dirs: ["include_all"],
target: { target: {
recovery: { recovery: {
exclude_header_libs: [ exclude_header_libs: [
@ -60,6 +72,12 @@ cc_library_headers {
windows: { windows: {
enabled: true, enabled: true,
}, },
vendor: {
override_export_include_dirs: [
"include_all",
"include_vendor",
],
},
}, },
apex_available: [ apex_available: [
"//apex_available:platform", "//apex_available:platform",

19
update-includes.sh Executable file
View file

@ -0,0 +1,19 @@
#!/bin/bash
set +ex
if [ ! "$ANDROID_BUILD_TOP" ]; then
echo "lunch?"
exit 1
fi
function update-includes() {
find -L "$ANDROID_BUILD_TOP/hardware/libhardware/include/hardware" -maxdepth 1 -xtype l -exec rm {} \;
for f in $ANDROID_BUILD_TOP/hardware/libhardware/include_all/hardware/*; do
local bn="$(basename $f)"
ln -s "../../include_all/hardware/$bn" "$ANDROID_BUILD_TOP/hardware/libhardware/include/hardware/$bn"
done
}
update-includes