From eefe9a35b2b17d279331e955be18a1c20e390d78 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Tue, 22 Jan 2019 14:41:08 -0800 Subject: [PATCH] Add export_*_lib_headers to static and shared properties Allow specifying export_static_lib_headers and export_shared_lib_headers in the static or shared properties of cc_library modules. Use a named struct for the properties to avoid having to create a runtime struct type since none of the properties are filtered. This avoids running into the name length limit in runtime.StructOf. Fixes: 122882789 Test: m checkbuild Change-Id: Ib0e9933e93981ba44668a19ed748bd12a4dd4257 --- cc/library.go | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/cc/library.go b/cc/library.go index 09e5b5019..ad07db47c 100644 --- a/cc/library.go +++ b/cc/library.go @@ -29,27 +29,23 @@ import ( "android/soong/genrule" ) +type StaticSharedLibraryProperties struct { + Srcs []string `android:"arch_variant"` + Cflags []string `android:"arch_variant"` + + Enabled *bool `android:"arch_variant"` + Whole_static_libs []string `android:"arch_variant"` + Static_libs []string `android:"arch_variant"` + Shared_libs []string `android:"arch_variant"` + System_shared_libs []string `android:"arch_variant"` + + Export_shared_lib_headers []string `android:"arch_variant"` + Export_static_lib_headers []string `android:"arch_variant"` +} + type LibraryProperties struct { - Static struct { - Srcs []string `android:"arch_variant"` - Cflags []string `android:"arch_variant"` - - Enabled *bool `android:"arch_variant"` - Whole_static_libs []string `android:"arch_variant"` - Static_libs []string `android:"arch_variant"` - Shared_libs []string `android:"arch_variant"` - System_shared_libs []string `android:"arch_variant"` - } `android:"arch_variant"` - Shared struct { - Srcs []string `android:"arch_variant"` - Cflags []string `android:"arch_variant"` - - Enabled *bool `android:"arch_variant"` - Whole_static_libs []string `android:"arch_variant"` - Static_libs []string `android:"arch_variant"` - Shared_libs []string `android:"arch_variant"` - System_shared_libs []string `android:"arch_variant"` - } `android:"arch_variant"` + Static StaticSharedLibraryProperties `android:"arch_variant"` + Shared StaticSharedLibraryProperties `android:"arch_variant"` // local file name to pass to the linker as -unexported_symbols_list Unexported_symbols_list *string `android:"arch_variant"` @@ -539,6 +535,9 @@ func (library *libraryDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps { library.Properties.Static.Whole_static_libs...) deps.StaticLibs = append(deps.StaticLibs, library.Properties.Static.Static_libs...) deps.SharedLibs = append(deps.SharedLibs, library.Properties.Static.Shared_libs...) + + deps.ReexportSharedLibHeaders = append(deps.ReexportSharedLibHeaders, library.Properties.Static.Export_shared_lib_headers...) + deps.ReexportStaticLibHeaders = append(deps.ReexportStaticLibHeaders, library.Properties.Static.Export_static_lib_headers...) } else if library.shared() { if ctx.toolchain().Bionic() && !Bool(library.baseLinker.Properties.Nocrt) { if !ctx.useSdk() { @@ -560,6 +559,9 @@ func (library *libraryDecorator) linkerDeps(ctx DepsContext, deps Deps) Deps { deps.WholeStaticLibs = append(deps.WholeStaticLibs, library.Properties.Shared.Whole_static_libs...) deps.StaticLibs = append(deps.StaticLibs, library.Properties.Shared.Static_libs...) deps.SharedLibs = append(deps.SharedLibs, library.Properties.Shared.Shared_libs...) + + deps.ReexportSharedLibHeaders = append(deps.ReexportSharedLibHeaders, library.Properties.Shared.Export_shared_lib_headers...) + deps.ReexportStaticLibHeaders = append(deps.ReexportStaticLibHeaders, library.Properties.Shared.Export_static_lib_headers...) } if ctx.useVndk() { deps.WholeStaticLibs = removeListFromList(deps.WholeStaticLibs, library.baseLinker.Properties.Target.Vendor.Exclude_static_libs)