Allow java binary wrapper files to reference filegroups
Also allow commands with no tools for the case when standard shell utilities are used to munge an input file. Test: m checkbuild Change-Id: Ie061e90cafe1a0a0db004a89e9a17fb48709cb03
This commit is contained in:
@@ -142,12 +142,6 @@ func (g *Module) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||
}
|
||||
|
||||
func (g *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
toolFiles := ctx.ExpandSources(g.properties.Tool_files, nil)
|
||||
if len(g.properties.Tools) == 0 && len(toolFiles) == 0 {
|
||||
ctx.ModuleErrorf("at least one `tools` or `tool_files` is required")
|
||||
return
|
||||
}
|
||||
|
||||
if len(g.properties.Export_include_dirs) > 0 {
|
||||
for _, dir := range g.properties.Export_include_dirs {
|
||||
g.exportedIncludeDirs = append(g.exportedIncludeDirs,
|
||||
@@ -210,6 +204,7 @@ func (g *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
return
|
||||
}
|
||||
|
||||
toolFiles := ctx.ExpandSources(g.properties.Tool_files, nil)
|
||||
for _, tool := range toolFiles {
|
||||
g.deps = append(g.deps, tool)
|
||||
if _, exists := tools[tool.Rel()]; !exists {
|
||||
@@ -227,6 +222,10 @@ func (g *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
rawCommand, err := android.Expand(task.cmd, func(name string) (string, error) {
|
||||
switch name {
|
||||
case "location":
|
||||
if len(g.properties.Tools) == 0 && len(toolFiles) == 0 {
|
||||
return "", fmt.Errorf("at least one `tools` or `tool_files` is required if $(location) is used")
|
||||
}
|
||||
|
||||
if len(g.properties.Tools) > 0 {
|
||||
return tools[g.properties.Tools[0]].String(), nil
|
||||
} else {
|
||||
|
12
java/java.go
12
java/java.go
@@ -1031,7 +1031,7 @@ type Binary struct {
|
||||
|
||||
isWrapperVariant bool
|
||||
|
||||
wrapperFile android.SourcePath
|
||||
wrapperFile android.Path
|
||||
binaryFile android.OutputPath
|
||||
}
|
||||
|
||||
@@ -1048,7 +1048,13 @@ func (j *Binary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
j.isWrapperVariant = true
|
||||
|
||||
if String(j.binaryProperties.Wrapper) != "" {
|
||||
j.wrapperFile = android.PathForModuleSrc(ctx, String(j.binaryProperties.Wrapper)).SourcePath
|
||||
wrapperSrcs := ctx.ExpandSources([]string{String(j.binaryProperties.Wrapper)}, nil)
|
||||
if len(wrapperSrcs) == 1 {
|
||||
j.wrapperFile = wrapperSrcs[0]
|
||||
} else {
|
||||
ctx.PropertyErrorf("wrapper", "module providing wrapper must produce exactly one file")
|
||||
return
|
||||
}
|
||||
} else {
|
||||
j.wrapperFile = android.PathForSource(ctx, "build/soong/scripts/jar-wrapper.sh")
|
||||
}
|
||||
@@ -1065,6 +1071,8 @@ func (j *Binary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
func (j *Binary) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||
if ctx.Arch().ArchType == android.Common {
|
||||
j.deps(ctx)
|
||||
} else {
|
||||
android.ExtractSourcesDeps(ctx, []string{String(j.binaryProperties.Wrapper)})
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user