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
This commit is contained in:
Jaewoong Jung
2018-12-12 09:01:34 -08:00
parent 9b84d34be3
commit 38e4fb2ce6
3 changed files with 84 additions and 2 deletions

View File

@@ -190,6 +190,7 @@ type Module interface {
GetProperties() []interface{}
BuildParamsForTests() []BuildParams
VariablesForTests() map[string]string
}
type nameProperties struct {
@@ -473,6 +474,7 @@ type ModuleBase struct {
// For tests
buildParams []BuildParams
variables map[string]string
prefer32 func(ctx BaseModuleContext, base *ModuleBase, class OsClass) bool
}
@@ -489,6 +491,10 @@ func (a *ModuleBase) BuildParamsForTests() []BuildParams {
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 @@ func (a *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
installDeps: a.computeInstallDeps(blueprintCtx),
installFiles: a.installFiles,
missingDeps: blueprintCtx.GetMissingDependencies(),
variables: make(map[string]string),
}
desc := "//" + ctx.ModuleDir() + ":" + ctx.ModuleName() + " "
@@ -842,6 +849,7 @@ func (a *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
}
a.buildParams = ctx.buildParams
a.variables = ctx.variables
}
type androidBaseContextImpl struct {
@@ -864,6 +872,7 @@ type androidModuleContext struct {
// For tests
buildParams []BuildParams
variables map[string]string
}
func (a *androidModuleContext) ninjaError(desc string, outputs []string, err error) {
@@ -928,6 +937,10 @@ func convertBuildParams(params BuildParams) blueprint.BuildParams {
}
func (a *androidModuleContext) Variable(pctx PackageContext, name, value string) {
if a.config.captureBuild {
a.variables[name] = value
}
a.ModuleContext.Variable(pctx.PackageContext, name, value)
}