Make Stl *bool
When collapsing properties for applying defaults, string is
appended, *string is replaced, which is the behavior we want here.
Change-Id: I22a8c23e1cb8ec1960cd5d92d80f6c1ddfab1913
diff --git a/cc/stl.go b/cc/stl.go
index 280beed..548a62a 100644
--- a/cc/stl.go
+++ b/cc/stl.go
@@ -23,7 +23,7 @@
// select the STL library to use. Possible values are "libc++", "libc++_static",
// "stlport", "stlport_static", "ndk", "libstdc++", or "none". Leave blank to select the
// default
- Stl string
+ Stl *string
SelectedStl string `blueprint:"mutated"`
}
@@ -38,35 +38,39 @@
func (stl *stl) begin(ctx BaseModuleContext) {
stl.Properties.SelectedStl = func() string {
+ s := ""
+ if stl.Properties.Stl != nil {
+ s = *stl.Properties.Stl
+ }
if ctx.sdk() && ctx.Device() {
- switch stl.Properties.Stl {
+ switch s {
case "":
return "ndk_system"
case "c++_shared", "c++_static",
"stlport_shared", "stlport_static",
"gnustl_static":
- return "ndk_lib" + stl.Properties.Stl
+ return "ndk_lib" + s
case "none":
return ""
default:
- ctx.ModuleErrorf("stl: %q is not a supported STL with sdk_version set", stl.Properties.Stl)
+ ctx.ModuleErrorf("stl: %q is not a supported STL with sdk_version set", s)
return ""
}
} else if ctx.Os() == android.Windows {
- switch stl.Properties.Stl {
+ switch s {
case "libc++", "libc++_static", "libstdc++", "":
// libc++ is not supported on mingw
return "libstdc++"
case "none":
return ""
default:
- ctx.ModuleErrorf("stl: %q is not a supported STL for windows", stl.Properties.Stl)
+ ctx.ModuleErrorf("stl: %q is not a supported STL for windows", s)
return ""
}
} else {
- switch stl.Properties.Stl {
+ switch s {
case "libc++", "libc++_static":
- return stl.Properties.Stl
+ return s
case "none":
return ""
case "":
@@ -76,7 +80,7 @@
return "libc++"
}
default:
- ctx.ModuleErrorf("stl: %q is not a supported STL", stl.Properties.Stl)
+ ctx.ModuleErrorf("stl: %q is not a supported STL", s)
return ""
}
}