Add buildDir to java patch-module paths.
This solves a problem where javac fails to find patch-module targets
when a build diretory is not under the project root.
Bug: 117770838
Test: java_test.go + manual build
Change-Id: If70d0d388a3f6c87b3f78a927df2063616d50c8a
diff --git a/android/module.go b/android/module.go
index dc0c856..d2f84ce 100644
--- a/android/module.go
+++ b/android/module.go
@@ -190,6 +190,7 @@
GetProperties() []interface{}
BuildParamsForTests() []BuildParams
+ VariablesForTests() map[string]string
}
type nameProperties struct {
@@ -473,6 +474,7 @@
// For tests
buildParams []BuildParams
+ variables map[string]string
prefer32 func(ctx BaseModuleContext, base *ModuleBase, class OsClass) bool
}
@@ -489,6 +491,10 @@
return a.buildParams
}
+func (a *ModuleBase) VariablesForTests() map[string]string {
+ return a.variables
+}
+
func (a *ModuleBase) Prefer32(prefer32 func(ctx BaseModuleContext, base *ModuleBase, class OsClass) bool) {
a.prefer32 = prefer32
}
@@ -781,6 +787,7 @@
installDeps: a.computeInstallDeps(blueprintCtx),
installFiles: a.installFiles,
missingDeps: blueprintCtx.GetMissingDependencies(),
+ variables: make(map[string]string),
}
desc := "//" + ctx.ModuleDir() + ":" + ctx.ModuleName() + " "
@@ -842,6 +849,7 @@
}
a.buildParams = ctx.buildParams
+ a.variables = ctx.variables
}
type androidBaseContextImpl struct {
@@ -864,6 +872,7 @@
// For tests
buildParams []BuildParams
+ variables map[string]string
}
func (a *androidModuleContext) ninjaError(desc string, outputs []string, err error) {
@@ -928,6 +937,10 @@
}
func (a *androidModuleContext) Variable(pctx PackageContext, name, value string) {
+ if a.config.captureBuild {
+ a.variables[name] = value
+ }
+
a.ModuleContext.Variable(pctx.PackageContext, name, value)
}