Merge "Fix how soong converts LOCAL_STRIP_MODULE."
This commit is contained in:
commit
153c2f8ba3
|
@ -51,6 +51,7 @@ var rewriteProperties = map[string](func(variableAssignmentContext) error){
|
|||
"LOCAL_MODULE_HOST_OS": hostOs,
|
||||
"LOCAL_SANITIZE": sanitize(""),
|
||||
"LOCAL_SANITIZE_DIAG": sanitize("diag."),
|
||||
"LOCAL_STRIP_MODULE": strip(),
|
||||
"LOCAL_CFLAGS": cflags,
|
||||
"LOCAL_UNINSTALLABLE_MODULE": invert("installable"),
|
||||
"LOCAL_PROGUARD_ENABLED": proguardEnabled,
|
||||
|
@ -81,7 +82,6 @@ func init() {
|
|||
map[string]string{
|
||||
"LOCAL_MODULE": "name",
|
||||
"LOCAL_CXX_STL": "stl",
|
||||
"LOCAL_STRIP_MODULE": "strip",
|
||||
"LOCAL_MULTILIB": "compile_multilib",
|
||||
"LOCAL_ARM_MODE_HACK": "instruction_set",
|
||||
"LOCAL_SDK_VERSION": "sdk_version",
|
||||
|
@ -463,6 +463,29 @@ func sanitize(sub string) func(ctx variableAssignmentContext) error {
|
|||
}
|
||||
}
|
||||
|
||||
func strip() func(ctx variableAssignmentContext) error {
|
||||
return func(ctx variableAssignmentContext) error {
|
||||
val, err := makeVariableToBlueprint(ctx.file, ctx.mkvalue, bpparser.StringType)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if _, ok := val.(*bpparser.String); !ok {
|
||||
return fmt.Errorf("unsupported strip expression")
|
||||
}
|
||||
|
||||
bpTrue := &bpparser.Bool{
|
||||
Value: true,
|
||||
}
|
||||
v := val.(*bpparser.String).Value
|
||||
sub := (map[string]string{"false": "none", "true": "all", "keep_symbols": "keep_symbols"})[v]
|
||||
if sub == "" {
|
||||
return fmt.Errorf("unexpected strip option: %s", v)
|
||||
}
|
||||
return setVariable(ctx.file, false, ctx.prefix, "strip."+sub, bpTrue, true)
|
||||
}
|
||||
}
|
||||
|
||||
func prebuiltClass(ctx variableAssignmentContext) error {
|
||||
class := ctx.mkvalue.Value(ctx.file.scope)
|
||||
if v, ok := prebuiltTypes[class]; ok {
|
||||
|
|
|
@ -692,6 +692,47 @@ include $(call all-makefiles-under,$(LOCAL_PATH))
|
|||
}
|
||||
`,
|
||||
},
|
||||
{
|
||||
desc: "LOCAL_STRIP_MODULE",
|
||||
in: `
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := libtest
|
||||
LOCAL_STRIP_MODULE := false
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := libtest2
|
||||
LOCAL_STRIP_MODULE := true
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := libtest3
|
||||
LOCAL_STRIP_MODULE := keep_symbols
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
`,
|
||||
expected: `
|
||||
cc_library_shared {
|
||||
name: "libtest",
|
||||
strip: {
|
||||
none: true,
|
||||
}
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "libtest2",
|
||||
strip: {
|
||||
all: true,
|
||||
}
|
||||
}
|
||||
|
||||
cc_library_shared {
|
||||
name: "libtest3",
|
||||
strip: {
|
||||
keep_symbols: true,
|
||||
}
|
||||
}
|
||||
`,
|
||||
},
|
||||
}
|
||||
|
||||
func TestEndToEnd(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue