Use proptools.BoolDefault

Replace x == nil || *x with proptools.BoolDefault(x, true)

Test: m checkbuild
Change-Id: Icc5378cab3ea72d86544b40761c2f00b278cc0a1
This commit is contained in:
Colin Cross
2018-04-10 16:14:46 -07:00
parent 47f98af97f
commit 38b40dffd6
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 BoolDefault = proptools.BoolDefault
var BoolPtr = proptools.BoolPtr
var String = proptools.String
var StringPtr = proptools.StringPtr

View File

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

View File

@@ -128,7 +128,7 @@ type testDecorator struct {
}
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 {