Emit error if expression cannot be evaluated to boolean during androidmk conversion
Fixes: 127517965 Test: run androidmk /sdx/asmundak/repos/iandr/vendor/google_paintbox/amber/camera/tests/Android.mk Change-Id: If7b6bcb88bb8f25d3f421a847750a82b1e50833e
This commit is contained in:
@@ -383,11 +383,15 @@ func local32BitOnly(ctx variableAssignmentContext) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if val.(*bpparser.Bool).Value {
|
||||
boolValue, ok := val.(*bpparser.Bool)
|
||||
if !ok {
|
||||
return fmt.Errorf("value should evaluate to boolean literal")
|
||||
}
|
||||
if boolValue.Value {
|
||||
thirtyTwo := &bpparser.String{
|
||||
Value: "32",
|
||||
}
|
||||
setVariable(ctx.file, false, ctx.prefix, "compile_multilib", thirtyTwo, true)
|
||||
return setVariable(ctx.file, false, ctx.prefix, "compile_multilib", thirtyTwo, true)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@@ -1338,6 +1338,25 @@ android_app_import {
|
||||
},
|
||||
apk: "foo.apk",
|
||||
|
||||
}
|
||||
`,
|
||||
},
|
||||
{
|
||||
desc: "undefined_boolean_var",
|
||||
in: `
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_SRC_FILES:= a.cpp
|
||||
LOCAL_MODULE:= test
|
||||
LOCAL_32_BIT_ONLY := $(FLAG)
|
||||
include $(BUILD_EXECUTABLE)
|
||||
`,
|
||||
expected: `
|
||||
cc_binary {
|
||||
name: "test",
|
||||
srcs: ["a.cpp"],
|
||||
// ANDROIDMK TRANSLATION ERROR: value should evaluate to boolean literal
|
||||
// LOCAL_32_BIT_ONLY := $(FLAG)
|
||||
|
||||
}
|
||||
`,
|
||||
},
|
||||
|
Reference in New Issue
Block a user