Merge "Allow cc modules to pull in rust includes."
am: 36396b26ef
Change-Id: I1b85968d8a104c51691ce4c7aedaac70f853926d
This commit is contained in:
commit
b6eddf33c0
4 changed files with 14 additions and 5 deletions
5
cc/cc.go
5
cc/cc.go
|
@ -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()...)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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()))
|
||||
|
|
Loading…
Reference in a new issue