Merge changes from topic "api_library_missing_deps"

* changes:
  Do not register missing deps
  Skip existence check for stub library files
This commit is contained in:
Treehugger Robot
2022-10-25 03:12:07 +00:00
committed by Gerrit Code Review
3 changed files with 74 additions and 2 deletions

View File

@@ -77,6 +77,19 @@ func (d *apiLibraryDecorator) Name(basename string) string {
return basename + multitree.GetApiImportSuffix()
}
// Export include dirs without checking for existence.
// The directories are not guaranteed to exist during Soong analysis.
func (d *apiLibraryDecorator) exportIncludes(ctx ModuleContext) {
exporterProps := d.flagExporter.Properties
for _, dir := range exporterProps.Export_include_dirs {
d.dirs = append(d.dirs, android.MaybeExistentPathForSource(ctx, ctx.ModuleDir(), dir))
}
// system headers
for _, dir := range exporterProps.Export_system_include_dirs {
d.systemDirs = append(d.systemDirs, android.MaybeExistentPathForSource(ctx, ctx.ModuleDir(), dir))
}
}
func (d *apiLibraryDecorator) link(ctx ModuleContext, flags Flags, deps PathDeps, objects Objects) android.Path {
// Export headers as system include dirs if specified. Mostly for libc
if Bool(d.libraryDecorator.Properties.Llndk.Export_headers_as_system) {
@@ -87,7 +100,7 @@ func (d *apiLibraryDecorator) link(ctx ModuleContext, flags Flags, deps PathDeps
}
// Flags reexported from dependencies. (e.g. vndk_prebuilt_shared)
d.libraryDecorator.flagExporter.exportIncludes(ctx)
d.exportIncludes(ctx)
d.libraryDecorator.reexportDirs(deps.ReexportedDirs...)
d.libraryDecorator.reexportSystemDirs(deps.ReexportedSystemDirs...)
d.libraryDecorator.reexportFlags(deps.ReexportedFlags...)
@@ -95,7 +108,13 @@ func (d *apiLibraryDecorator) link(ctx ModuleContext, flags Flags, deps PathDeps
d.libraryDecorator.addExportedGeneratedHeaders(deps.ReexportedGeneratedHeaders...)
d.libraryDecorator.flagExporter.setProvider(ctx)
in := android.PathForModuleSrc(ctx, *d.properties.Src)
if d.properties.Src == nil {
ctx.PropertyErrorf("src", "src is a required property")
}
// Skip the existence check of the stub prebuilt file.
// The file is not guaranteed to exist during Soong analysis.
// Build orchestrator will be responsible for creating a connected ninja graph.
in := android.MaybeExistentPathForSource(ctx, ctx.ModuleDir(), *d.properties.Src)
d.unstrippedOutputFile = in
libName := d.libraryDecorator.getLibName(ctx) + flags.Toolchain.ShlibSuffix()