Save all the detected native shared library backing by mainline modules.
Test: TARGET_BUILD_APPS=com.google.android.adbd m dist apps_only Change-Id: I510292542bf2550c9244e9374cd6f7b40a971486
This commit is contained in:
parent
2a109db10b
commit
9a6eabf952
2 changed files with 9 additions and 34 deletions
|
@ -716,12 +716,10 @@ func (a *apexBundle) buildUnflattenedApex(ctx android.ModuleContext) {
|
|||
}
|
||||
}
|
||||
apisBackedbyOutputFile := android.PathForModuleOut(ctx, a.Name()+"_backing.txt")
|
||||
ndkLibraryList := android.PathForSource(ctx, "system/core/rootdir/etc/public.libraries.android.txt")
|
||||
rule := android.NewRuleBuilder(pctx, ctx)
|
||||
rule.Command().
|
||||
Tool(android.PathForSource(ctx, "build/soong/scripts/gen_ndk_backedby_apex.sh")).
|
||||
Output(apisBackedbyOutputFile).
|
||||
Input(ndkLibraryList).
|
||||
Flags(libNames)
|
||||
rule.Build("ndk_backedby_list", "Generate API libraries backed by Apex")
|
||||
a.apisBackedByModuleFile = apisBackedbyOutputFile
|
||||
|
|
|
@ -21,52 +21,29 @@
|
|||
# After the parse function below "dlopen" would be write to the output file.
|
||||
printHelp() {
|
||||
echo "**************************** Usage Instructions ****************************"
|
||||
echo "This script is used to generate the Mainline modules backed-by NDK symbols."
|
||||
echo "This script is used to generate the native libraries backed by Mainline modules."
|
||||
echo ""
|
||||
echo "To run this script use: ./gen_ndk_backed_by_apex.sh \$OUTPUT_FILE_PATH \$NDK_LIB_NAME_LIST \$MODULE_LIB1 \$MODULE_LIB2..."
|
||||
echo "To run this script use: ./gen_ndk_backed_by_apex.sh \$OUTPUT_FILE_PATH \$MODULE_LIB1 \$MODULE_LIB2..."
|
||||
echo "For example: If output write to /backedby.txt then the command would be:"
|
||||
echo "./gen_ndk_backed_by_apex.sh /backedby.txt /ndkLibList.txt lib1.so lib2.so"
|
||||
echo "./gen_ndk_backed_by_apex.sh /backedby.txt lib1.so lib2.so"
|
||||
echo "If the module1 is backing lib1 then the backedby.txt would contains: "
|
||||
echo "lib1"
|
||||
echo "lib1.so lib2.so"
|
||||
}
|
||||
|
||||
contains() {
|
||||
val="$1"
|
||||
shift
|
||||
for x in "$@"; do
|
||||
if [ "$x" = "$val" ]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
|
||||
genBackedByList() {
|
||||
genAllBackedByList() {
|
||||
out="$1"
|
||||
shift
|
||||
ndk_list="$1"
|
||||
shift
|
||||
rm -f "$out"
|
||||
touch "$out"
|
||||
while IFS= read -r line
|
||||
do
|
||||
soFileName=$(echo "$line" | sed 's/\(.*so\).*/\1/')
|
||||
if [[ ! -z "$soFileName" && "$soFileName" != *"#"* ]]
|
||||
then
|
||||
if contains "$soFileName" "$@"; then
|
||||
echo "$soFileName" >> "$out"
|
||||
fi
|
||||
fi
|
||||
done < "$ndk_list"
|
||||
echo "$@" >> "$out"
|
||||
}
|
||||
|
||||
if [[ "$1" == "help" ]]
|
||||
then
|
||||
printHelp
|
||||
elif [[ "$#" -lt 2 ]]
|
||||
elif [[ "$#" -lt 1 ]]
|
||||
then
|
||||
echo "Wrong argument length. Expecting at least 2 argument representing output path, path to ndk library list, followed by a list of libraries in the Mainline module."
|
||||
echo "Wrong argument length. Expecting at least 1 argument representing output path, followed by a list of libraries in the Mainline module."
|
||||
else
|
||||
genBackedByList "$@"
|
||||
genAllBackedByList "$@"
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue