Define cc_api_headers module
Define cc_api_headers module to import from API surfaces and replace existing header definition if needed. Tested with : cc_api_headers { name: "libc_headers", export_system_include_dirs: [ "include", ], min_sdk_version: "1", sdk_version: "1", vendor_available: true, native_bridge_supported: true, ... } Bug: 236087698 Test: ALLOW_MISSING_DEPENDENCIES=true m -j vendorimage succeeded Change-Id: I2c3294fe19a272453a168d8c7beeee9859bd4583
This commit is contained in:
26
cc/cc.go
26
cc/cc.go
@@ -2302,9 +2302,14 @@ func updateDepsWithApiImports(deps Deps, apiImports multitree.ApiImportInfo) Dep
|
||||
deps.RuntimeLibs[idx] = GetReplaceModuleName(lib, apiImports.SharedLibs)
|
||||
}
|
||||
|
||||
for idx, lib := range deps.HeaderLibs {
|
||||
deps.HeaderLibs[idx] = GetReplaceModuleName(lib, apiImports.HeaderLibs)
|
||||
for idx, lib := range deps.SystemSharedLibs {
|
||||
deps.SystemSharedLibs[idx] = GetReplaceModuleName(lib, apiImports.SharedLibs)
|
||||
}
|
||||
|
||||
for idx, lib := range deps.ReexportSharedLibHeaders {
|
||||
deps.ReexportSharedLibHeaders[idx] = GetReplaceModuleName(lib, apiImports.SharedLibs)
|
||||
}
|
||||
|
||||
return deps
|
||||
}
|
||||
|
||||
@@ -2348,12 +2353,14 @@ func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
|
||||
depTag.reexportFlags = true
|
||||
}
|
||||
|
||||
// Check header lib replacement from API surface first, and then check again with VSDK
|
||||
lib = GetReplaceModuleName(lib, apiImportInfo.HeaderLibs)
|
||||
lib = GetReplaceModuleName(lib, GetSnapshot(c, &snapshotInfo, actx).HeaderLibs)
|
||||
|
||||
if c.isNDKStubLibrary() {
|
||||
// ndk_headers do not have any variations
|
||||
actx.AddFarVariationDependencies([]blueprint.Variation{}, depTag, lib)
|
||||
} else if c.IsStubs() {
|
||||
} else if c.IsStubs() && !c.isImportedApiLibrary() {
|
||||
actx.AddFarVariationDependencies(append(ctx.Target().Variations(), c.ImageVariation()),
|
||||
depTag, lib)
|
||||
} else {
|
||||
@@ -3258,11 +3265,6 @@ func MakeLibName(ctx android.ModuleContext, c LinkableInterface, ccDep LinkableI
|
||||
|
||||
return baseName + snapshotPrebuilt.SnapshotAndroidMkSuffix()
|
||||
}
|
||||
|
||||
// Remove API import suffix if exists
|
||||
if _, ok := ccDepModule.linker.(*apiLibraryDecorator); ok {
|
||||
libName = strings.TrimSuffix(libName, multitree.GetApiImportSuffix())
|
||||
}
|
||||
}
|
||||
|
||||
if ctx.DeviceConfig().VndkUseCoreVariant() && ccDep.IsVndk() && !ccDep.MustUseVendorVariant() &&
|
||||
@@ -3598,9 +3600,6 @@ func (c *Module) ShouldSupportSdkVersion(ctx android.BaseModuleContext,
|
||||
if _, ok := c.linker.(prebuiltLinkerInterface); ok {
|
||||
return nil
|
||||
}
|
||||
if _, ok := c.linker.(*apiLibraryDecorator); ok {
|
||||
return nil
|
||||
}
|
||||
|
||||
minSdkVersion := c.MinSdkVersion()
|
||||
if minSdkVersion == "apex_inherit" {
|
||||
@@ -3781,6 +3780,11 @@ func (c *Module) IsSdkVariant() bool {
|
||||
return c.Properties.IsSdkVariant
|
||||
}
|
||||
|
||||
func (c *Module) isImportedApiLibrary() bool {
|
||||
_, ok := c.linker.(*apiLibraryDecorator)
|
||||
return ok
|
||||
}
|
||||
|
||||
func kytheExtractAllFactory() android.Singleton {
|
||||
return &kytheExtractAllSingleton{}
|
||||
}
|
||||
|
Reference in New Issue
Block a user