Add C++ Host support on sysprop_library

With Host_supported: true, C++ part of sysprop_library will create host
variant which can be used from host modules. As there are no native
system property support on host, libbase functions will be used instead.
Adding support on host will help reduce code complexity of other
host_supported modules.

Bug: 147708854
Test: m, sysprop_test, manually test host binary
Change-Id: I850d91fea298ef1a0c16c6a7a9ec1aca5cf37e69
This commit is contained in:
Inseob Kim 2020-02-03 18:06:46 +09:00
parent eb9b9f23ec
commit 89db15dcab
3 changed files with 31 additions and 4 deletions

View File

@ -188,6 +188,7 @@ func GatherRequiredDepsForTest(os android.OsType) string {
stl: "none",
vendor_available: true,
recovery_available: true,
host_supported: true,
}
cc_library {
name: "libc++",
@ -197,6 +198,7 @@ func GatherRequiredDepsForTest(os android.OsType) string {
stl: "none",
vendor_available: true,
recovery_available: true,
host_supported: true,
vndk: {
enabled: true,
support_system_process: true,

View File

@ -144,6 +144,9 @@ type syspropLibraryProperties struct {
// list of .sysprop files which defines the properties.
Srcs []string `android:"path"`
// If set to true, build a variant of the module for the host. Defaults to false.
Host_supported *bool
// Whether public stub exists or not.
Public_stub *bool `blueprint:"mutated"`
}
@ -306,12 +309,20 @@ type ccLibraryProperties struct {
Sysprop struct {
Platform *bool
}
Header_libs []string
Shared_libs []string
Target struct {
Android struct {
Header_libs []string
Shared_libs []string
}
Host struct {
Static_libs []string
}
}
Required []string
Recovery *bool
Recovery_available *bool
Vendor_available *bool
Host_supported *bool
}
type javaLibraryProperties struct {
@ -394,10 +405,12 @@ func syspropLibraryHook(ctx android.LoadHookContext, m *syspropLibrary) {
ccProps.Device_specific = proptools.BoolPtr(ctx.DeviceSpecific())
ccProps.Product_specific = proptools.BoolPtr(ctx.ProductSpecific())
ccProps.Sysprop.Platform = proptools.BoolPtr(isOwnerPlatform)
ccProps.Header_libs = []string{"libbase_headers"}
ccProps.Shared_libs = []string{"liblog"}
ccProps.Target.Android.Header_libs = []string{"libbase_headers"}
ccProps.Target.Android.Shared_libs = []string{"liblog"}
ccProps.Target.Host.Static_libs = []string{"libbase", "liblog"}
ccProps.Recovery_available = m.properties.Recovery_available
ccProps.Vendor_available = m.properties.Vendor_available
ccProps.Host_supported = m.properties.Host_supported
ctx.CreateModule(cc.LibraryFactory, &ccProps)
scope := "internal"

View File

@ -161,6 +161,7 @@ func TestSyspropLibrary(t *testing.T) {
api_packages: ["android.sysprop"],
property_owner: "Platform",
vendor_available: true,
host_supported: true,
}
sysprop_library {
@ -244,6 +245,11 @@ func TestSyspropLibrary(t *testing.T) {
static_libs: ["sysprop-platform", "sysprop-vendor"],
}
cc_library {
name: "libbase",
host_supported: true,
}
cc_library_headers {
name: "libbase_headers",
vendor_available: true,
@ -256,6 +262,12 @@ func TestSyspropLibrary(t *testing.T) {
nocrt: true,
system_shared_libs: [],
recovery_available: true,
host_supported: true,
}
cc_binary_host {
name: "hostbin",
static_libs: ["sysprop-platform"],
}
llndk_library {