Merge "Allow cc modules to pull in rust includes."

This commit is contained in:
Ivan Lozano 2019-11-15 02:32:26 +00:00 committed by Gerrit Code Review
commit 36396b26ef
4 changed files with 14 additions and 5 deletions

View File

@ -509,7 +509,7 @@ func (c *Module) SdkVersion() string {
return String(c.Properties.Sdk_version)
}
func (c *Module) IncludeDirs(ctx android.BaseModuleContext) android.Paths {
func (c *Module) IncludeDirs() android.Paths {
if c.linker != nil {
if library, ok := c.linker.(exportedFlagsProducer); ok {
return library.exportedDirs()
@ -2040,10 +2040,11 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
}
}
depPaths.IncludeDirs = append(depPaths.IncludeDirs, ccDep.IncludeDirs()...)
// Exporting flags only makes sense for cc.Modules
if _, ok := ccDep.(*Module); ok {
if i, ok := ccDep.(*Module).linker.(exportedFlagsProducer); ok {
depPaths.IncludeDirs = append(depPaths.IncludeDirs, i.exportedDirs()...)
depPaths.SystemIncludeDirs = append(depPaths.SystemIncludeDirs, i.exportedSystemDirs()...)
depPaths.GeneratedHeaders = append(depPaths.GeneratedHeaders, i.exportedDeps()...)
depPaths.Flags = append(depPaths.Flags, i.exportedFlags()...)

View File

@ -13,7 +13,7 @@ type LinkableInterface interface {
OutputFile() android.OptionalPath
IncludeDirs(ctx android.BaseModuleContext) android.Paths
IncludeDirs() android.Paths
SetDepsInLinkOrder([]android.Path)
GetDepsInLinkOrder() []android.Path

View File

@ -78,6 +78,7 @@ type libraryDecorator struct {
MutatedProperties LibraryMutatedProperties
distFile android.OptionalPath
unstrippedOutputFile android.Path
includeDirs android.Paths
}
type libraryInterface interface {
@ -311,6 +312,13 @@ func (library *libraryDecorator) compilerDeps(ctx DepsContext, deps Deps) Deps {
return deps
}
func (library *libraryDecorator) compilerFlags(ctx ModuleContext, flags Flags) Flags {
flags = library.baseCompiler.compilerFlags(ctx, flags)
if library.shared() || library.static() {
library.includeDirs = append(library.includeDirs, android.PathsForModuleSrc(ctx, library.Properties.Include_dirs)...)
}
return flags
}
func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps PathDeps) android.Path {
var outputFile android.WritablePath

View File

@ -246,10 +246,10 @@ func (mod *Module) CcLibraryInterface() bool {
return false
}
func (mod *Module) IncludeDirs(ctx android.BaseModuleContext) android.Paths {
func (mod *Module) IncludeDirs() android.Paths {
if mod.compiler != nil {
if library, ok := mod.compiler.(*libraryDecorator); ok {
return android.PathsForSource(ctx, library.Properties.Include_dirs)
return library.includeDirs
}
}
panic(fmt.Errorf("IncludeDirs called on non-library module: %q", mod.BaseModuleName()))