Propagate missing dependencies when using whole_static_libs
Currently, whole_static_libs with missing dependencies are silently
ignored. Instead, when getting the object files from the other module,
add its missing dependencies to the current module.
Change-Id: I12472dede2dfafdded56268bfd37f60063b637c4
diff --git a/cc/cc.go b/cc/cc.go
index 441860b..e091be3 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -791,6 +791,13 @@
for _, m := range wholeStaticLibModules {
if staticLib, ok := m.(ccLibraryInterface); ok && staticLib.static() {
+ if missingDeps := staticLib.getWholeStaticMissingDeps(); missingDeps != nil {
+ postfix := " (required by " + ctx.OtherModuleName(m) + ")"
+ for i := range missingDeps {
+ missingDeps[i] += postfix
+ }
+ ctx.AddMissingDependencies(missingDeps)
+ }
depPaths.WholeStaticLibObjFiles =
append(depPaths.WholeStaticLibObjFiles, staticLib.allObjFiles()...)
} else {
@@ -1136,6 +1143,10 @@
out common.Path
systemLibs []string
+ // If we're used as a whole_static_lib, our missing dependencies need
+ // to be given
+ wholeStaticMissingDeps []string
+
LibraryProperties CCLibraryProperties
}
@@ -1154,6 +1165,7 @@
getReuseFrom() ccLibraryInterface
getReuseObjFiles() common.Paths
allObjFiles() common.Paths
+ getWholeStaticMissingDeps() []string
}
var _ ccLibraryInterface = (*CCLibrary)(nil)
@@ -1224,6 +1236,10 @@
return c.objFiles
}
+func (c *CCLibrary) getWholeStaticMissingDeps() []string {
+ return c.wholeStaticMissingDeps
+}
+
func (c *CCLibrary) exportedFlags() []string {
return c.exportFlags
}
@@ -1294,6 +1310,8 @@
TransformObjToStaticLib(ctx, objFiles, ccFlagsToBuilderFlags(flags), outputFile)
}
+ c.wholeStaticMissingDeps = ctx.GetMissingDependencies()
+
c.objFiles = objFiles
c.out = outputFile