diff options
author | Colin Cross <ccross@android.com> | 2016-07-12 13:12:33 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2016-07-12 13:12:33 -0700 |
commit | 7924885eb31c1fc50189573580fb1394cbaf4545 (patch) | |
tree | 52dfdc19604d3e26aa2e6eb0089c72a026c07cde /cc | |
parent | a4190c10eb851edf04e6d034e103165f287e66ff (diff) | |
download | build_soong-7924885eb31c1fc50189573580fb1394cbaf4545.tar.gz build_soong-7924885eb31c1fc50189573580fb1394cbaf4545.tar.bz2 build_soong-7924885eb31c1fc50189573580fb1394cbaf4545.zip |
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
Diffstat (limited to 'cc')
-rw-r--r-- | cc/stl.go | 22 |
1 files changed, 13 insertions, 9 deletions
@@ -23,7 +23,7 @@ type StlProperties struct { // 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) props() []interface{} { 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 @@ func (stl *stl) begin(ctx BaseModuleContext) { 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 "" } } |