Merge remote-tracking branch 'aosp/upstream'
diff --git a/context.go b/context.go
index 5be63c4..31541da 100644
--- a/context.go
+++ b/context.go
@@ -1452,8 +1452,9 @@
// config-specific values.
//
// The returned deps is a list of the ninja files dependencies that were added
-// by the modules and singletons via the ModuleContext.AddNinjaFileDeps() and
-// SingletonContext.AddNinjaFileDeps() methods.
+// by the modules and singletons via the ModuleContext.AddNinjaFileDeps(),
+// SingletonContext.AddNinjaFileDeps(), and PackageContext.AddNinjaFileDeps()
+// methods.
func (c *Context) PrepareBuildActions(config interface{}) (deps []string, errs []error) {
c.buildActionsReady = false
@@ -1484,7 +1485,9 @@
liveGlobals.addNinjaStringDeps(c.ninjaBuildDir)
}
- pkgNames := c.makeUniquePackageNames(liveGlobals)
+ pkgNames, depsPackages := c.makeUniquePackageNames(liveGlobals)
+
+ deps = append(deps, depsPackages...)
// This will panic if it finds a problem since it's a programming error.
c.checkForVariableReferenceCycles(liveGlobals.variables, pkgNames)
@@ -1978,7 +1981,7 @@
}
func (c *Context) makeUniquePackageNames(
- liveGlobals *liveTracker) map[*packageContext]string {
+ liveGlobals *liveTracker) (map[*packageContext]string, []string) {
pkgs := make(map[string]*packageContext)
pkgNames := make(map[*packageContext]string)
@@ -2027,7 +2030,13 @@
pkgNames[pctx] = pctx.fullName
}
- return pkgNames
+ // Create deps list from calls to PackageContext.AddNinjaFileDeps
+ deps := []string{}
+ for _, pkg := range pkgs {
+ deps = append(deps, pkg.ninjaFileDeps...)
+ }
+
+ return pkgNames, deps
}
func (c *Context) checkForVariableReferenceCycles(
diff --git a/package_ctx.go b/package_ctx.go
index 5b93c20..cedee04 100644
--- a/package_ctx.go
+++ b/package_ctx.go
@@ -67,15 +67,19 @@
StaticRule(name string, params RuleParams, argNames ...string) Rule
RuleFunc(name string, f func(interface{}) (RuleParams, error), argNames ...string) Rule
+ AddNinjaFileDeps(deps ...string)
+
getScope() *basicScope
}
type packageContext struct {
- fullName string
- shortName string
- pkgPath string
- scope *basicScope
+ fullName string
+ shortName string
+ pkgPath string
+ scope *basicScope
+ ninjaFileDeps []string
}
+
var _ PackageContext = &packageContext{}
func (p *packageContext) getScope() *basicScope {
@@ -862,3 +866,7 @@
func (r *builtinRule) String() string {
return "<builtin>:" + r.name_
}
+
+func (p *packageContext) AddNinjaFileDeps(deps ...string) {
+ p.ninjaFileDeps = append(p.ninjaFileDeps, deps...)
+}