Merge changes from topics "libz-no-stubs-for-vendor", "vendor-etc-linker-config" into main

* changes:
  Generate vendor specific STUB_LIBRARIES
  Add cc_library.target.vendor.no_stubs
This commit is contained in:
Treehugger Robot
2023-12-05 05:47:08 +00:00
committed by Gerrit Code Review
4 changed files with 91 additions and 2 deletions

View File

@@ -23,6 +23,8 @@ import (
"android/soong/android"
"android/soong/snapshot"
"github.com/google/blueprint/proptools"
)
var _ android.ImageInterface = (*Module)(nil)
@@ -622,6 +624,10 @@ func squashVendorSrcs(m *Module) {
lib.baseCompiler.Properties.Exclude_generated_sources = append(lib.baseCompiler.Properties.Exclude_generated_sources,
lib.baseCompiler.Properties.Target.Vendor.Exclude_generated_sources...)
if lib.Properties.Target.Vendor.No_stubs {
proptools.Clear(&lib.Properties.Stubs)
}
}
}
@@ -635,6 +641,10 @@ func squashProductSrcs(m *Module) {
lib.baseCompiler.Properties.Exclude_generated_sources = append(lib.baseCompiler.Properties.Exclude_generated_sources,
lib.baseCompiler.Properties.Target.Product.Exclude_generated_sources...)
if lib.Properties.Target.Product.No_stubs {
proptools.Clear(&lib.Properties.Stubs)
}
}
}

View File

@@ -107,6 +107,13 @@ type LibraryProperties struct {
Suffix *string `android:"arch_variant"`
Header_abi_checker headerAbiCheckerProperties
// Disable stubs for vendor/product variants
// This is a workaround to keep `stubs` only for "core" variant (not product/vendor).
// It would be nice if we could put `stubs` into a `target: { core: {} }`
// block but it's not supported in soong yet. This could be removed/simplified once we have
// a better syntax.
No_stubs bool
}
Platform struct {

View File

@@ -27,7 +27,8 @@ func init() {
}
type stubLibraries struct {
stubLibraryMap map[string]bool
stubLibraryMap map[string]bool
stubVendorLibraryMap map[string]bool
apiListCoverageXmlPaths []string
}
@@ -54,6 +55,9 @@ func (s *stubLibraries) GenerateBuildActions(ctx android.SingletonContext) {
if IsStubTarget(m) {
if name := getInstalledFileName(m); name != "" {
s.stubLibraryMap[name] = true
if m.InVendor() {
s.stubVendorLibraryMap[name] = true
}
}
}
if m.library != nil {
@@ -67,13 +71,15 @@ func (s *stubLibraries) GenerateBuildActions(ctx android.SingletonContext) {
func stubLibrariesSingleton() android.Singleton {
return &stubLibraries{
stubLibraryMap: make(map[string]bool),
stubLibraryMap: make(map[string]bool),
stubVendorLibraryMap: make(map[string]bool),
}
}
func (s *stubLibraries) MakeVars(ctx android.MakeVarsContext) {
// Convert stub library file names into Makefile variable.
ctx.Strict("STUB_LIBRARIES", strings.Join(android.SortedKeys(s.stubLibraryMap), " "))
ctx.Strict("SOONG_STUB_VENDOR_LIBRARIES", strings.Join(android.SortedKeys(s.stubVendorLibraryMap), " "))
// Export the list of API XML files to Make.
sort.Strings(s.apiListCoverageXmlPaths)