aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--genrule/filegroup.go8
-rw-r--r--genrule/genrule.go24
-rw-r--r--java/androidmk.go4
-rw-r--r--java/app.go12
-rw-r--r--java/java.go25
-rw-r--r--python/binary.go16
-rw-r--r--python/python.go11
7 files changed, 54 insertions, 46 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
diff --git a/java/androidmk.go b/java/androidmk.go
index d3aadef3..1c0526ae 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -40,7 +40,7 @@ func (library *Library) AndroidMk() android.AndroidMkData {
fmt.Fprintln(w, "LOCAL_DEX_PREOPT := false")
}
}
- fmt.Fprintln(w, "LOCAL_SDK_VERSION :=", library.deviceProperties.Sdk_version)
+ fmt.Fprintln(w, "LOCAL_SDK_VERSION :=", String(library.deviceProperties.Sdk_version))
fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", library.headerJarFile.String())
},
},
@@ -76,7 +76,7 @@ func (prebuilt *Import) AndroidMk() android.AndroidMkData {
func(w io.Writer, outputFile android.Path) {
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := ", !proptools.Bool(prebuilt.properties.Installable))
fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", prebuilt.combinedClasspathFile.String())
- fmt.Fprintln(w, "LOCAL_SDK_VERSION :=", prebuilt.properties.Sdk_version)
+ fmt.Fprintln(w, "LOCAL_SDK_VERSION :=", String(prebuilt.properties.Sdk_version))
},
},
}
diff --git a/java/app.go b/java/app.go
index c2e9214b..05cc9756 100644
--- a/java/app.go
+++ b/java/app.go
@@ -32,14 +32,14 @@ import (
type androidAppProperties struct {
// path to a certificate, or the name of a certificate in the default
// certificate directory, or blank to use the default product certificate
- Certificate string
+ Certificate *string
// paths to extra certificates to sign the apk with
Additional_certificates []string
// If set, create package-export.apk, which other packages can
// use to get PRODUCT-agnostic resource data like IDs and type definitions.
- Export_package_resources bool
+ Export_package_resources *bool
// flags passed to aapt when creating the apk
Aaptflags []string
@@ -69,7 +69,7 @@ func (a *AndroidApp) DepsMutator(ctx android.BottomUpMutatorContext) {
a.Module.deps(ctx)
if !proptools.Bool(a.properties.No_standard_libs) {
- switch a.deviceProperties.Sdk_version { // TODO: Res_sdk_version?
+ switch String(a.deviceProperties.Sdk_version) { // TODO: Res_sdk_version?
case "current", "system_current", "":
ctx.AddDependency(ctx.Module(), frameworkResTag, "framework-res")
default:
@@ -90,7 +90,7 @@ func (a *AndroidApp) GenerateAndroidBuildActions(ctx android.ModuleContext) {
a.aaptJavaFileList = aaptJavaFileList
// TODO(ccross): export aapt generated java files as a src jar
- if a.appProperties.Export_package_resources {
+ if Bool(a.appProperties.Export_package_resources) {
aaptPackageFlags := append([]string(nil), aaptFlags...)
var hasProduct bool
for _, f := range aaptPackageFlags {
@@ -135,7 +135,7 @@ func (a *AndroidApp) GenerateAndroidBuildActions(ctx android.ModuleContext) {
"--product "+ctx.AConfig().ProductAAPTCharacteristics())
}
- certificate := a.appProperties.Certificate
+ certificate := String(a.appProperties.Certificate)
if certificate == "" {
certificate = ctx.AConfig().DefaultAppCertificate(ctx).String()
} else if dir, _ := filepath.Split(certificate); dir == "" {
@@ -244,7 +244,7 @@ func (a *AndroidApp) aaptFlags(ctx android.ModuleContext) ([]string, android.Pat
aaptDeps = append(aaptDeps, depFiles...)
})
- sdkVersion := a.deviceProperties.Sdk_version
+ sdkVersion := String(a.deviceProperties.Sdk_version)
if sdkVersion == "" {
sdkVersion = ctx.AConfig().PlatformSdkVersion()
}
diff --git a/java/java.go b/java/java.go
index bb6e5566..432e816e 100644
--- a/java/java.go
+++ b/java/java.go
@@ -134,7 +134,7 @@ type CompilerDeviceProperties struct {
Dxflags []string `android:"arch_variant"`
// if not blank, set to the version of the sdk to compile against
- Sdk_version string
+ Sdk_version *string
// directories to pass to aidl tool
Aidl_includes []string
@@ -307,7 +307,7 @@ func decodeSdkDep(ctx android.BaseContext, v string) sdkDep {
func (j *Module) deps(ctx android.BottomUpMutatorContext) {
if ctx.Device() {
if !proptools.Bool(j.properties.No_standard_libs) {
- sdkDep := decodeSdkDep(ctx, j.deviceProperties.Sdk_version)
+ sdkDep := decodeSdkDep(ctx, String(j.deviceProperties.Sdk_version))
if sdkDep.useDefaultLibs {
ctx.AddDependency(ctx.Module(), bootClasspathTag, config.DefaultBootclasspathLibraries...)
if ctx.AConfig().TargetOpenJDK9() {
@@ -412,7 +412,7 @@ type deps struct {
func (j *Module) collectDeps(ctx android.ModuleContext) deps {
var deps deps
- sdkDep := decodeSdkDep(ctx, j.deviceProperties.Sdk_version)
+ sdkDep := decodeSdkDep(ctx, String(j.deviceProperties.Sdk_version))
if sdkDep.invalidVersion {
ctx.AddMissingDependencies([]string{sdkDep.module})
} else if sdkDep.useFiles {
@@ -493,14 +493,14 @@ func (j *Module) collectBuilderFlags(ctx android.ModuleContext, deps deps) javaB
}
// javaVersion flag.
- sdk := sdkStringToNumber(ctx, j.deviceProperties.Sdk_version)
+ sdk := sdkStringToNumber(ctx, String(j.deviceProperties.Sdk_version))
if j.properties.Java_version != nil {
flags.javaVersion = *j.properties.Java_version
} else if ctx.Device() && sdk <= 23 {
flags.javaVersion = "1.7"
} else if ctx.Device() && sdk <= 26 || !ctx.AConfig().TargetOpenJDK9() {
flags.javaVersion = "1.8"
- } else if ctx.Device() && j.deviceProperties.Sdk_version != "" && sdk == 10000 {
+ } else if ctx.Device() && String(j.deviceProperties.Sdk_version) != "" && sdk == 10000 {
// TODO(ccross): once we generate stubs we should be able to use 1.9 for sdk_version: "current"
flags.javaVersion = "1.8"
} else {
@@ -783,11 +783,11 @@ func (j *Module) compileDex(ctx android.ModuleContext, flags javaBuilderFlags,
}
var minSdkVersion string
- switch j.deviceProperties.Sdk_version {
+ switch String(j.deviceProperties.Sdk_version) {
case "", "current", "test_current", "system_current":
minSdkVersion = strconv.Itoa(ctx.AConfig().DefaultAppTargetSdkInt())
default:
- minSdkVersion = j.deviceProperties.Sdk_version
+ minSdkVersion = String(j.deviceProperties.Sdk_version)
}
dxFlags = append(dxFlags, "--min-sdk-version="+minSdkVersion)
@@ -903,7 +903,7 @@ func LibraryHostFactory() android.Module {
type binaryProperties struct {
// installable script to execute the resulting jar
- Wrapper string
+ Wrapper *string
}
type Binary struct {
@@ -924,8 +924,8 @@ func (j *Binary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
// Depend on the installed jar (j.installFile) so that the wrapper doesn't get executed by
// another build rule before the jar has been installed.
- if j.binaryProperties.Wrapper != "" {
- j.wrapperFile = android.PathForModuleSrc(ctx, j.binaryProperties.Wrapper).SourcePath
+ if String(j.binaryProperties.Wrapper) != "" {
+ j.wrapperFile = android.PathForModuleSrc(ctx, String(j.binaryProperties.Wrapper)).SourcePath
} else {
j.wrapperFile = android.PathForSource(ctx, "build/soong/scripts/jar-wrapper.sh")
}
@@ -970,7 +970,7 @@ func BinaryHostFactory() android.Module {
type ImportProperties struct {
Jars []string
- Sdk_version string
+ Sdk_version *string
Installable *bool
}
@@ -1084,3 +1084,6 @@ func DefaultsFactory(props ...interface{}) android.Module {
return module
}
+
+var Bool = proptools.Bool
+var String = proptools.String
diff --git a/python/binary.go b/python/binary.go
index 95b0606e..14c49527 100644
--- a/python/binary.go
+++ b/python/binary.go
@@ -33,13 +33,13 @@ type BinaryProperties struct {
// this file must also be listed in srcs.
// If left unspecified, module name is used instead.
// If name doesn’t match any filename in srcs, main must be specified.
- Main string `android:"arch_variant"`
+ Main *string `android:"arch_variant"`
// set the name of the output binary.
- Stem string `android:"arch_variant"`
+ Stem *string `android:"arch_variant"`
// append to the name of the output binary.
- Suffix string `android:"arch_variant"`
+ Suffix *string `android:"arch_variant"`
// list of compatibility suites (for example "cts", "vts") that the module should be
// installed into.
@@ -179,10 +179,10 @@ func (binary *binaryDecorator) getHostInterpreterName(ctx android.ModuleContext,
func (binary *binaryDecorator) getPyMainFile(ctx android.ModuleContext,
srcsPathMappings []pathMapping) string {
var main string
- if binary.binaryProperties.Main == "" {
+ if String(binary.binaryProperties.Main) == "" {
main = ctx.ModuleName() + pyExt
} else {
- main = binary.binaryProperties.Main
+ main = String(binary.binaryProperties.Main)
}
for _, path := range srcsPathMappings {
@@ -197,11 +197,11 @@ func (binary *binaryDecorator) getPyMainFile(ctx android.ModuleContext,
func (binary *binaryDecorator) getStem(ctx android.ModuleContext) string {
stem := ctx.ModuleName()
- if binary.binaryProperties.Stem != "" {
- stem = binary.binaryProperties.Stem
+ if String(binary.binaryProperties.Stem) != "" {
+ stem = String(binary.binaryProperties.Stem)
}
- return stem + binary.binaryProperties.Suffix
+ return stem + String(binary.binaryProperties.Suffix)
}
// Sets the given directory and all its ancestor directories as Python packages.
diff --git a/python/python.go b/python/python.go
index 1b146a8e..9d6d6a79 100644
--- a/python/python.go
+++ b/python/python.go
@@ -65,7 +65,7 @@ type BaseProperties struct {
// (from a.b.c import ...) statement.
// if left unspecified, all the source/data files of current module are copied to
// "runfiles/" tree directory directly.
- Pkg_path string `android:"arch_variant"`
+ Pkg_path *string `android:"arch_variant"`
// true, if the Python module is used internally, eg, Python std libs.
Is_internal *bool `android:"arch_variant"`
@@ -367,14 +367,14 @@ func (p *Module) GeneratePythonBuildActions(ctx android.ModuleContext) {
expandedData := ctx.ExpandSources(p.properties.Data, nil)
// sanitize pkg_path.
- pkg_path := p.properties.Pkg_path
+ pkg_path := String(p.properties.Pkg_path)
if pkg_path != "" {
- pkg_path = filepath.Clean(p.properties.Pkg_path)
+ pkg_path = filepath.Clean(String(p.properties.Pkg_path))
if pkg_path == ".." || strings.HasPrefix(pkg_path, "../") ||
strings.HasPrefix(pkg_path, "/") {
ctx.PropertyErrorf("pkg_path",
"%q must be a relative path contained in par file.",
- p.properties.Pkg_path)
+ String(p.properties.Pkg_path))
return
}
if p.properties.Is_internal != nil && *p.properties.Is_internal {
@@ -557,3 +557,6 @@ func fillInMap(ctx android.ModuleContext, m map[string]string,
return true
}
+
+var Bool = proptools.Bool
+var String = proptools.String