diff options
author | Nan Zhang <nanzhang@google.com> | 2017-11-08 21:20:04 -0800 |
---|---|---|
committer | Nan Zhang <nanzhang@google.com> | 2017-11-08 21:25:40 -0800 |
commit | ea568a4a241dc3ab2e415143a698413106cb4c52 (patch) | |
tree | ab1bf9d248e1ff65144502581c2b7b0a7bb36ace /genrule | |
parent | 99a5635733d45b30e4b38770e52243f3c46dac1e (diff) | |
download | build_soong-ea568a4a241dc3ab2e415143a698413106cb4c52.tar.gz build_soong-ea568a4a241dc3ab2e415143a698413106cb4c52.tar.bz2 build_soong-ea568a4a241dc3ab2e415143a698413106cb4c52.zip |
Change bool, and string properties to *bool, and *string for java,
python, and genrule.
Test: m -j checkbuild
Bug: b/68853585
Change-Id: Ic9a8083818e920dc399a4b00841e2aa496f70faa
Diffstat (limited to 'genrule')
-rw-r--r-- | genrule/filegroup.go | 8 | ||||
-rw-r--r-- | genrule/genrule.go | 24 |
2 files changed, 17 insertions, 15 deletions
diff --git a/genrule/filegroup.go b/genrule/filegroup.go index ed206b03..8f28638b 100644 --- a/genrule/filegroup.go +++ b/genrule/filegroup.go @@ -35,11 +35,11 @@ type fileGroupProperties struct { // of the path to use. For example, when a filegroup is used as data in a cc_test rule, // the base path is stripped off the path and the remaining path is used as the // installation directory. - Path string + Path *string // Create a make variable with the specified name that contains the list of files in the // filegroup, relative to the root of the source tree. - Export_to_make_var string + Export_to_make_var *string } type fileGroup struct { @@ -65,7 +65,7 @@ func (fg *fileGroup) DepsMutator(ctx android.BottomUpMutatorContext) { } func (fg *fileGroup) GenerateAndroidBuildActions(ctx android.ModuleContext) { - fg.srcs = ctx.ExpandSourcesSubDir(fg.properties.Srcs, fg.properties.Exclude_srcs, fg.properties.Path) + fg.srcs = ctx.ExpandSourcesSubDir(fg.properties.Srcs, fg.properties.Exclude_srcs, String(fg.properties.Path)) } func (fg *fileGroup) Srcs() android.Paths { @@ -83,7 +83,7 @@ endif func (fg *fileGroup) AndroidMk() android.AndroidMkData { return android.AndroidMkData{ Custom: func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) { - if makeVar := fg.properties.Export_to_make_var; makeVar != "" { + if makeVar := String(fg.properties.Export_to_make_var); makeVar != "" { androidMkTemplate.Execute(w, map[string]string{ "makeVar": makeVar, "value": strings.Join(fg.srcs.Strings(), " "), diff --git a/genrule/genrule.go b/genrule/genrule.go index b26b1a21..7602ee72 100644 --- a/genrule/genrule.go +++ b/genrule/genrule.go @@ -20,12 +20,11 @@ import ( "github.com/google/blueprint" "github.com/google/blueprint/bootstrap" + "github.com/google/blueprint/proptools" "android/soong/android" "android/soong/shared" "path/filepath" - - "github.com/google/blueprint/proptools" ) func init() { @@ -72,10 +71,10 @@ type generatorProperties struct { // // All files used must be declared as inputs (to ensure proper up-to-date checks). // Use "$(in)" directly in Cmd to ensure that all inputs used are declared. - Cmd string + Cmd *string // Enable reading a file containing dependencies in gcc format after the command completes - Depfile bool + Depfile *bool // name of the modules (if any) that produces the host executable. Leave empty for // prebuilts or scripts that do not need a module to build them. @@ -214,7 +213,7 @@ func (g *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) { referencedDepfile := false srcFiles := ctx.ExpandSources(g.properties.Srcs, nil) - task := g.taskGenerator(ctx, g.properties.Cmd, srcFiles) + task := g.taskGenerator(ctx, String(g.properties.Cmd), srcFiles) rawCommand, err := android.Expand(task.cmd, func(name string) (string, error) { switch name { @@ -230,7 +229,7 @@ func (g *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) { return "__SBOX_OUT_FILES__", nil case "depfile": referencedDepfile = true - if !g.properties.Depfile { + if !Bool(g.properties.Depfile) { return "", fmt.Errorf("$(depfile) used without depfile property") } return "__SBOX_DEPFILE__", nil @@ -249,7 +248,7 @@ func (g *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) { } }) - if g.properties.Depfile && !referencedDepfile { + if Bool(g.properties.Depfile) && !referencedDepfile { ctx.PropertyErrorf("cmd", "specified depfile=true but did not include a reference to '${depfile}' in cmd") } @@ -265,7 +264,7 @@ func (g *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) { // recall that Sprintf replaces percent sign expressions, whereas dollar signs expressions remain as written, // to be replaced later by ninja_strings.go depfilePlaceholder := "" - if g.properties.Depfile { + if Bool(g.properties.Depfile) { depfilePlaceholder = "$depfileArgs" } @@ -277,7 +276,7 @@ func (g *Module) GenerateAndroidBuildActions(ctx android.ModuleContext) { CommandDeps: []string{"$sboxCmd"}, } args := []string{"allouts"} - if g.properties.Depfile { + if Bool(g.properties.Depfile) { ruleParams.Deps = blueprint.DepsGCC args = append(args, "depfileArgs") } @@ -298,7 +297,7 @@ func (g *Module) generateSourceFile(ctx android.ModuleContext, task generateTask } var depFile android.ModuleGenPath - if g.properties.Depfile { + if Bool(g.properties.Depfile) { depFile = android.PathForModuleGen(ctx, task.out[0].Rel()+".d") } @@ -313,7 +312,7 @@ func (g *Module) generateSourceFile(ctx android.ModuleContext, task generateTask "allouts": strings.Join(task.out.Strings(), " "), }, } - if g.properties.Depfile { + if Bool(g.properties.Depfile) { params.Depfile = android.PathForModuleGen(ctx, task.out[0].Rel()+".d") params.Args["depfileArgs"] = "--depfile-out " + depFile.String() } @@ -422,3 +421,6 @@ type genRuleProperties struct { // names of the output files that will be generated Out []string } + +var Bool = proptools.Bool +var String = proptools.String |