Mixed builds: propagate includes from cc_* targets

This allows us to remove libasync_safe from the mixed builds denylist.

Test: mixed_libc.sh CI script
Change-Id: Ibafd231284864078bf30340f919d39e5098843ce
This commit is contained in:
Chris Parsons
2021-04-27 14:48:30 -04:00
parent 8fb66f48c7
commit f60ecf081e
3 changed files with 18 additions and 10 deletions

View File

@@ -402,11 +402,18 @@ func (f *flagExporter) addExportedGeneratedHeaders(headers ...android.Path) {
func (f *flagExporter) setProvider(ctx android.ModuleContext) {
ctx.SetProvider(FlagExporterInfoProvider, FlagExporterInfo{
IncludeDirs: android.FirstUniquePaths(f.dirs),
// Comes from Export_include_dirs property, and those of exported transitive deps
IncludeDirs: android.FirstUniquePaths(f.dirs),
// Comes from Export_system_include_dirs property, and those of exported transitive deps
SystemIncludeDirs: android.FirstUniquePaths(f.systemDirs),
Flags: f.flags,
Deps: f.deps,
GeneratedHeaders: f.headers,
// Used in very few places as a one-off way of adding extra defines.
Flags: f.flags,
// Used sparingly, for extra files that need to be explicitly exported to dependers,
// or for phony files to minimize ninja.
Deps: f.deps,
// For exported generated headers, such as exported aidl headers, proto headers, or
// sysprop headers.
GeneratedHeaders: f.headers,
})
}
@@ -524,6 +531,8 @@ func (handler *staticLibraryBazelHandler) generateBazelBuildActions(ctx android.
Direct(outputFilePath).
Build(),
})
ctx.SetProvider(FlagExporterInfoProvider, flagExporterInfoFromCcInfo(ctx, ccInfo))
if i, ok := handler.module.linker.(snapshotLibraryInterface); ok {
// Dependencies on this library will expect collectedSnapshotHeaders to
// be set, otherwise validation will fail. For now, set this to an empty

View File

@@ -283,7 +283,7 @@ func flagExporterInfoFromCcInfo(ctx android.ModuleContext, ccInfo cquery.CcInfo)
systemIncludes := android.PathsForBazelOut(ctx, ccInfo.SystemIncludes)
return FlagExporterInfo{
IncludeDirs: includes,
SystemIncludeDirs: systemIncludes,
IncludeDirs: android.FirstUniquePaths(includes),
SystemIncludeDirs: android.FirstUniquePaths(systemIncludes),
}
}