Consistently use Bool instead of proptools.Bool

Use Bool instead of proptools.Bool and String instead of proptools.String.

Test: m checkbuild
Change-Id: I32d84add9f27128c7a65413e9612fd920613584f
This commit is contained in:
Colin Cross 2018-04-10 16:15:18 -07:00
parent ed1268268d
commit ff3ae9da74
6 changed files with 17 additions and 21 deletions

View File

@ -854,17 +854,17 @@ func decodeTargetProductVariables(config *config) (map[OsClass][]Target, error)
addTarget(BuildOs, *variables.HostSecondaryArch, nil, nil, nil)
}
if config.Host_bionic != nil && *config.Host_bionic {
if Bool(config.Host_bionic) {
addTarget(LinuxBionic, "x86_64", nil, nil, nil)
}
if variables.CrossHost != nil && *variables.CrossHost != "" {
if String(variables.CrossHost) != "" {
crossHostOs := osByName(*variables.CrossHost)
if crossHostOs == NoOsType {
return nil, fmt.Errorf("Unknown cross host OS %q", *variables.CrossHost)
}
if variables.CrossHostArch == nil || *variables.CrossHostArch == "" {
if String(variables.CrossHostArch) == "" {
return nil, fmt.Errorf("No cross-host primary architecture set")
}

View File

@ -19,7 +19,6 @@ import (
"github.com/google/blueprint"
"github.com/google/blueprint/pathtools"
"github.com/google/blueprint/proptools"
"android/soong/android"
)
@ -114,7 +113,7 @@ func protoFlags(ctx ModuleContext, flags Flags, p *android.ProtoProperties) Flag
flags.protoFlags = android.ProtoFlags(ctx, p)
if proptools.String(p.Proto.Type) == "lite" {
if String(p.Proto.Type) == "lite" {
flags.protoOutParams = append(flags.protoOutParams, "lite")
}

View File

@ -19,8 +19,6 @@ import (
"io"
"strings"
"github.com/google/blueprint/proptools"
"android/soong/android"
)
@ -77,7 +75,7 @@ func (library *Library) AndroidMk() android.AndroidMkData {
Custom: func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) {
android.WriteAndroidMkData(w, data)
if proptools.Bool(library.deviceProperties.Hostdex) && !library.Host() {
if Bool(library.deviceProperties.Hostdex) && !library.Host() {
fmt.Fprintln(w, "include $(CLEAR_VARS)")
fmt.Fprintln(w, "LOCAL_MODULE := "+name+"-hostdex")
fmt.Fprintln(w, "LOCAL_IS_HOST_MODULE := true")
@ -117,7 +115,7 @@ func (prebuilt *Import) AndroidMk() android.AndroidMkData {
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
Extra: []android.AndroidMkExtraFunc{
func(w io.Writer, outputFile android.Path) {
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := ", !proptools.Bool(prebuilt.properties.Installable))
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := ", !Bool(prebuilt.properties.Installable))
fmt.Fprintln(w, "LOCAL_SOONG_HEADER_JAR :=", prebuilt.combinedClasspathFile.String())
fmt.Fprintln(w, "LOCAL_SDK_VERSION :=", String(prebuilt.properties.Sdk_version))
},

View File

@ -459,14 +459,14 @@ 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) {
if !Bool(j.properties.No_standard_libs) {
sdkDep := decodeSdkDep(ctx, String(j.deviceProperties.Sdk_version))
if sdkDep.useDefaultLibs {
ctx.AddDependency(ctx.Module(), bootClasspathTag, config.DefaultBootclasspathLibraries...)
if ctx.Config().TargetOpenJDK9() {
ctx.AddDependency(ctx.Module(), systemModulesTag, config.DefaultSystemModules)
}
if !proptools.Bool(j.properties.No_framework_libs) {
if !Bool(j.properties.No_framework_libs) {
ctx.AddDependency(ctx.Module(), libTag, config.DefaultLibraries...)
}
} else if sdkDep.useModule {
@ -907,7 +907,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars ...android.Path
// Don't add kotlin-stdlib if using (on-device) renamed stdlib
// (it's expected to be on device bootclasspath)
if !proptools.Bool(j.properties.Renamed_kotlin_stdlib) {
if !Bool(j.properties.Renamed_kotlin_stdlib) {
jars = append(jars, deps.kotlinStdlib...)
}
}
@ -984,7 +984,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars ...android.Path
resArgs = append(resArgs, fileArgs...)
resDeps = append(resDeps, fileDeps...)
if proptools.Bool(j.properties.Include_srcs) {
if Bool(j.properties.Include_srcs) {
srcArgs, srcDeps := SourceFilesToJarArgs(ctx, j.properties.Srcs, j.properties.Exclude_srcs)
resArgs = append(resArgs, srcArgs...)
resDeps = append(resDeps, srcDeps...)
@ -1026,7 +1026,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars ...android.Path
}
// Use renamed kotlin standard library?
if srcFiles.HasExt(".kt") && proptools.Bool(j.properties.Renamed_kotlin_stdlib) {
if srcFiles.HasExt(".kt") && Bool(j.properties.Renamed_kotlin_stdlib) {
jarjarFile := android.PathForModuleOut(ctx, "kotlin-renamed", jarName)
TransformJarJar(ctx, jarjarFile, outputFile,
android.PathForSource(ctx, "external/kotlinc/jarjar-rules.txt"))

View File

@ -18,7 +18,6 @@ import (
"strings"
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
"android/soong/android"
)
@ -67,7 +66,7 @@ func genProto(ctx android.ModuleContext, protoFile android.Path, flags javaBuild
}
func protoDeps(ctx android.BottomUpMutatorContext, p *android.ProtoProperties) {
switch proptools.String(p.Proto.Type) {
switch String(p.Proto.Type) {
case "micro":
ctx.AddDependency(ctx.Module(), staticLibTag, "libprotobuf-java-micro")
case "nano":
@ -82,14 +81,14 @@ func protoDeps(ctx android.BottomUpMutatorContext, p *android.ProtoProperties) {
}
default:
ctx.PropertyErrorf("proto.type", "unknown proto type %q",
proptools.String(p.Proto.Type))
String(p.Proto.Type))
}
}
func protoFlags(ctx android.ModuleContext, j *CompilerProperties, p *android.ProtoProperties,
flags javaBuilderFlags) javaBuilderFlags {
switch proptools.String(p.Proto.Type) {
switch String(p.Proto.Type) {
case "micro":
flags.protoOutTypeFlag = "--javamicro_out"
case "nano":
@ -101,7 +100,7 @@ func protoFlags(ctx android.ModuleContext, j *CompilerProperties, p *android.Pro
flags.protoOutTypeFlag = "--java_out"
default:
ctx.PropertyErrorf("proto.type", "unknown proto type %q",
proptools.String(p.Proto.Type))
String(p.Proto.Type))
}
if len(j.Proto.Output_params) > 0 {

View File

@ -252,9 +252,9 @@ func (p *Module) HostToolPath() android.OptionalPath {
func (p *Module) isEmbeddedLauncherEnabled(actual_version string) bool {
switch actual_version {
case pyVersion2:
return proptools.Bool(p.properties.Version.Py2.Embedded_launcher)
return Bool(p.properties.Version.Py2.Embedded_launcher)
case pyVersion3:
return proptools.Bool(p.properties.Version.Py3.Embedded_launcher)
return Bool(p.properties.Version.Py3.Embedded_launcher)
}
return false