Ignore obsolete lines when converting makefiles

Specifically this skips cases where LOCAL_MODULE_PATH
is TARGET_OUT_OPTIONAL_EXECUTABLES or TARGET_OUT_DATA_APPS.

Test: Added tests
Test: Treehugger
Change-Id: Ib64f22fc3936703c665d07dbb25d8ebf3b9f56c5
This commit is contained in:
Trevor Radcliffe
2021-10-11 19:21:58 +00:00
parent 371dc53d18
commit 93295f27e4
2 changed files with 23 additions and 1 deletions

View File

@@ -639,6 +639,12 @@ func prebuiltModulePath(ctx variableAssignmentContext) error {
if len(val.Variables) == 1 && varLiteralName(val.Variables[0]) != "" && len(val.Strings) == 2 && val.Strings[0] == "" {
fixed = val.Strings[1]
varname = val.Variables[0].Name.Strings[0]
// TARGET_OUT_OPTIONAL_EXECUTABLES puts the artifact in xbin, which is
// deprecated. TARGET_OUT_DATA_APPS install location will be handled
// automatically by Soong
if varname == "TARGET_OUT_OPTIONAL_EXECUTABLES" || varname == "TARGET_OUT_DATA_APPS" {
return nil
}
} else if len(val.Variables) == 2 && varLiteralName(val.Variables[0]) == "PRODUCT_OUT" && varLiteralName(val.Variables[1]) == "TARGET_COPY_OUT_VENDOR" &&
len(val.Strings) == 3 && val.Strings[0] == "" && val.Strings[1] == "/" {
fixed = val.Strings[2]

View File

@@ -1516,7 +1516,23 @@ android_app {
],
}
`,
},
}, {
desc: "Obsolete LOCAL_MODULE_PATH",
in: `
include $(CLEAR_VARS)
LOCAL_MODULE := foo
LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES)
LOCAL_CTS_TEST_PACKAGE := bar
LOCAL_USE_AAPT2 := blah
include $(BUILD_PACKAGE)
`,
expected: `
android_app {
name: "foo",
}
`},
}
func TestEndToEnd(t *testing.T) {