summaryrefslogtreecommitdiff
path: root/rust/rust.go
diff options
context:
space:
mode:
author Ivan Lozano <ivanlozano@google.com> 2020-07-29 00:25:42 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2020-07-29 00:25:42 +0000
commit3feff6c130c5318c04dcba3f9813f534835d15c4 (patch)
tree377f7565dccbc4ea03218bed09f13d5415fa48e9 /rust/rust.go
parent3d8e506c3ada481f8d55b3d887b25e6a03e8b671 (diff)
parent45901edb9a6ba7b42136a3ead126f94f76363eb7 (diff)
Merge changes I4efdf333,I4abaf8e7
* changes: Ensure hermetic device rust_bindgen. Generate deps file for rust_bindgen modules.
Diffstat (limited to 'rust/rust.go')
-rw-r--r--rust/rust.go20
1 files changed, 19 insertions, 1 deletions
diff --git a/rust/rust.go b/rust/rust.go
index 89b89e20c..78bf7ada9 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -256,6 +256,11 @@ type PathDeps struct {
depFlags []string
//ReexportedDeps android.Paths
+ // Used by bindgen modules which call clang
+ depClangFlags []string
+ depIncludePaths android.Paths
+ depSystemIncludePaths android.Paths
+
coverageFiles android.Paths
CrtBegin android.OptionalPath
@@ -671,7 +676,7 @@ func (mod *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
mod.compiler.install(ctx, mod.outputFile.Path())
}
} else if mod.sourceProvider != nil {
- outputFile := mod.sourceProvider.generateSource(ctx)
+ outputFile := mod.sourceProvider.generateSource(ctx, deps)
mod.outputFile = android.OptionalPathForPath(outputFile)
mod.subName = ctx.ModuleSubDir()
}
@@ -849,6 +854,11 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
depFlag = "-lstatic=" + libName
depPaths.linkDirs = append(depPaths.linkDirs, linkPath)
depPaths.depFlags = append(depPaths.depFlags, depFlag)
+ depPaths.depIncludePaths = append(depPaths.depIncludePaths, ccDep.IncludeDirs()...)
+ if mod, ok := ccDep.(*cc.Module); ok {
+ depPaths.depSystemIncludePaths = append(depPaths.depSystemIncludePaths, mod.ExportedSystemIncludeDirs()...)
+ depPaths.depClangFlags = append(depPaths.depClangFlags, mod.ExportedFlags()...)
+ }
depPaths.coverageFiles = append(depPaths.coverageFiles, ccDep.CoverageFiles()...)
directStaticLibDeps = append(directStaticLibDeps, ccDep)
mod.Properties.AndroidMkStaticLibs = append(mod.Properties.AndroidMkStaticLibs, depName)
@@ -856,6 +866,11 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
depFlag = "-ldylib=" + libName
depPaths.linkDirs = append(depPaths.linkDirs, linkPath)
depPaths.depFlags = append(depPaths.depFlags, depFlag)
+ depPaths.depIncludePaths = append(depPaths.depIncludePaths, ccDep.IncludeDirs()...)
+ if mod, ok := ccDep.(*cc.Module); ok {
+ depPaths.depSystemIncludePaths = append(depPaths.depSystemIncludePaths, mod.ExportedSystemIncludeDirs()...)
+ depPaths.depClangFlags = append(depPaths.depClangFlags, mod.ExportedFlags()...)
+ }
directSharedLibDeps = append(directSharedLibDeps, ccDep)
mod.Properties.AndroidMkSharedLibs = append(mod.Properties.AndroidMkSharedLibs, depName)
exportDep = true
@@ -916,6 +931,9 @@ func (mod *Module) depsToPaths(ctx android.ModuleContext) PathDeps {
// Dedup exported flags from dependencies
depPaths.linkDirs = android.FirstUniqueStrings(depPaths.linkDirs)
depPaths.depFlags = android.FirstUniqueStrings(depPaths.depFlags)
+ depPaths.depClangFlags = android.FirstUniqueStrings(depPaths.depClangFlags)
+ depPaths.depIncludePaths = android.FirstUniquePaths(depPaths.depIncludePaths)
+ depPaths.depSystemIncludePaths = android.FirstUniquePaths(depPaths.depSystemIncludePaths)
return depPaths
}