Add support for USES_LIBRARIES to androidmk

And OPTIONAL_USES_LIBRARIES. Also includes lint fix.

Fixes: 202163928
Test: Ran tool against development/apps/Development/Android.mk
Test: Added integration test cases
Change-Id: I9c8130b19f05df938f01957852384c0532e73433
This commit is contained in:
Trevor Radcliffe 2021-10-06 18:24:17 +00:00
parent f3c6843b33
commit 31b48a72d0
2 changed files with 42 additions and 1 deletions

View file

@ -15,11 +15,12 @@
package androidmk
import (
mkparser "android/soong/androidmk/parser"
"fmt"
"sort"
"strings"
mkparser "android/soong/androidmk/parser"
bpparser "github.com/google/blueprint/parser"
)
@ -128,6 +129,8 @@ func init() {
"LOCAL_STATIC_LIBRARIES": "static_libs",
"LOCAL_WHOLE_STATIC_LIBRARIES": "whole_static_libs",
"LOCAL_SYSTEM_SHARED_LIBRARIES": "system_shared_libs",
"LOCAL_USES_LIBRARIES": "uses_libs",
"LOCAL_OPTIONAL_USES_LIBRARIES": "optional_uses_libs",
"LOCAL_ASFLAGS": "asflags",
"LOCAL_CLANG_ASFLAGS": "clang_asflags",
"LOCAL_COMPATIBILITY_SUPPORT_FILES": "data",

View file

@ -1477,6 +1477,44 @@ android_test {
name: "foo",
lineage: "lineage",
}
`,
},
{
desc: "LOCAL_USES_LIBRARIES",
in: `
include $(CLEAR_VARS)
LOCAL_MODULE := foo
LOCAL_USES_LIBRARIES := foo.test bar.test baz.test
include $(BUILD_PACKAGE)
`,
expected: `
android_app {
name: "foo",
uses_libs: [
"foo.test",
"bar.test",
"baz.test",
],
}
`,
},
{
desc: "LOCAL_OPTIONAL_USES_LIBRARIES",
in: `
include $(CLEAR_VARS)
LOCAL_MODULE := foo
LOCAL_OPTIONAL_USES_LIBRARIES := foo.test bar.test baz.test
include $(BUILD_PACKAGE)
`,
expected: `
android_app {
name: "foo",
optional_uses_libs: [
"foo.test",
"bar.test",
"baz.test",
],
}
`,
},
}