Merge "Use proptools.BoolDefault"

This commit is contained in:
Colin Cross 2018-04-11 04:38:31 +00:00 committed by Gerrit Code Review
commit ed1268268d
5 changed files with 9 additions and 9 deletions

View File

@ -1585,6 +1585,7 @@ func getCurrentNdkPrebuiltVersion(ctx DepsContext) string {
} }
var Bool = proptools.Bool var Bool = proptools.Bool
var BoolDefault = proptools.BoolDefault
var BoolPtr = proptools.BoolPtr var BoolPtr = proptools.BoolPtr
var String = proptools.String var String = proptools.String
var StringPtr = proptools.StringPtr var StringPtr = proptools.StringPtr

View File

@ -700,13 +700,11 @@ func (library *libraryDecorator) link(ctx ModuleContext,
} }
func (library *libraryDecorator) buildStatic() bool { func (library *libraryDecorator) buildStatic() bool {
return library.MutatedProperties.BuildStatic && return library.MutatedProperties.BuildStatic && BoolDefault(library.Properties.Static.Enabled, true)
(library.Properties.Static.Enabled == nil || *library.Properties.Static.Enabled)
} }
func (library *libraryDecorator) buildShared() bool { func (library *libraryDecorator) buildShared() bool {
return library.MutatedProperties.BuildShared && return library.MutatedProperties.BuildShared && BoolDefault(library.Properties.Shared.Enabled, true)
(library.Properties.Shared.Enabled == nil || *library.Properties.Shared.Enabled)
} }
func (library *libraryDecorator) getWholeStaticMissingDeps() []string { func (library *libraryDecorator) getWholeStaticMissingDeps() []string {

View File

@ -128,7 +128,7 @@ type testDecorator struct {
} }
func (test *testDecorator) gtest() bool { func (test *testDecorator) gtest() bool {
return test.Properties.Gtest == nil || *test.Properties.Gtest == true return BoolDefault(test.Properties.Gtest, true)
} }
func (test *testDecorator) linkerFlags(ctx ModuleContext, flags Flags) Flags { func (test *testDecorator) linkerFlags(ctx ModuleContext, flags Flags) Flags {

View File

@ -235,7 +235,7 @@ func (jd *Javadoc) AndroidMk() android.AndroidMkData {
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk", Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
Extra: []android.AndroidMkExtraFunc{ Extra: []android.AndroidMkExtraFunc{
func(w io.Writer, outputFile android.Path) { func(w io.Writer, outputFile android.Path) {
if jd.properties.Installable == nil || *jd.properties.Installable == true { if BoolDefault(jd.properties.Installable, true) {
fmt.Fprintln(w, "LOCAL_DROIDDOC_DOC_ZIP := ", jd.docZip.String()) fmt.Fprintln(w, "LOCAL_DROIDDOC_DOC_ZIP := ", jd.docZip.String())
} }
if jd.stubsSrcJar != nil { if jd.stubsSrcJar != nil {
@ -253,7 +253,7 @@ func (ddoc *Droiddoc) AndroidMk() android.AndroidMkData {
Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk", Include: "$(BUILD_SYSTEM)/soong_java_prebuilt.mk",
Extra: []android.AndroidMkExtraFunc{ Extra: []android.AndroidMkExtraFunc{
func(w io.Writer, outputFile android.Path) { func(w io.Writer, outputFile android.Path) {
if ddoc.Javadoc.properties.Installable == nil || *ddoc.Javadoc.properties.Installable == true { if BoolDefault(ddoc.Javadoc.properties.Installable, true) {
fmt.Fprintln(w, "LOCAL_DROIDDOC_DOC_ZIP := ", ddoc.Javadoc.docZip.String()) fmt.Fprintln(w, "LOCAL_DROIDDOC_DOC_ZIP := ", ddoc.Javadoc.docZip.String())
} }
if ddoc.Javadoc.stubsSrcJar != nil { if ddoc.Javadoc.stubsSrcJar != nil {

View File

@ -1137,7 +1137,7 @@ func (j *Module) minSdkVersionNumber(ctx android.ModuleContext) string {
} }
func (j *Module) installable() bool { func (j *Module) installable() bool {
return j.properties.Installable == nil || *j.properties.Installable return BoolDefault(j.properties.Installable, true)
} }
var _ Dependency = (*Library)(nil) var _ Dependency = (*Library)(nil)
@ -1231,7 +1231,7 @@ type Test struct {
func (j *Test) DepsMutator(ctx android.BottomUpMutatorContext) { func (j *Test) DepsMutator(ctx android.BottomUpMutatorContext) {
j.deps(ctx) j.deps(ctx)
if j.testProperties.Junit == nil || *j.testProperties.Junit == true { if BoolDefault(j.testProperties.Junit, true) {
ctx.AddDependency(ctx.Module(), staticLibTag, "junit") ctx.AddDependency(ctx.Module(), staticLibTag, "junit")
} }
} }
@ -1460,5 +1460,6 @@ func DefaultsFactory(props ...interface{}) android.Module {
} }
var Bool = proptools.Bool var Bool = proptools.Bool
var BoolDefault = proptools.BoolDefault
var String = proptools.String var String = proptools.String
var inList = android.InList var inList = android.InList