Support multiple module name queries with bmod.
Test: bmod libc libm libdl Test: bmod adb framework-minus-apex libdl Change-Id: I156cc31185d3f97d6b5d74c232bd6cd9287cee02
This commit is contained in:
29
envsetup.sh
29
envsetup.sh
@@ -1613,8 +1613,8 @@ function allmod() {
|
|||||||
# Return the Bazel label of a Soong module if it is converted with bp2build.
|
# Return the Bazel label of a Soong module if it is converted with bp2build.
|
||||||
function bmod()
|
function bmod()
|
||||||
(
|
(
|
||||||
if [ $# -ne 1 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
echo "usage: bmod <module>" >&2
|
echo "usage: bmod <module 1> <module 2> ... <module n>" >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -1631,19 +1631,24 @@ function bmod()
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local target_label=$(python3 -c "import json
|
modules=()
|
||||||
module = '$1'
|
for m in "$@"; do
|
||||||
|
modules+=("\"$m\",")
|
||||||
|
done
|
||||||
|
local res=$(python3 -c "import json
|
||||||
|
modules = [${modules[*]}]
|
||||||
converted_json='$converted_json'
|
converted_json='$converted_json'
|
||||||
bp2build_converted_map = json.load(open(converted_json))
|
bp2build_converted_map = json.load(open(converted_json))
|
||||||
if module not in bp2build_converted_map:
|
for module in modules:
|
||||||
exit(1)
|
if module not in bp2build_converted_map:
|
||||||
print(bp2build_converted_map[module] + ':' + module)")
|
print(module + ' is not converted to Bazel.')
|
||||||
|
else:
|
||||||
|
print(bp2build_converted_map[module] + ':' + module)")
|
||||||
|
|
||||||
if [ -z "${target_label}" ]; then
|
echo "${res}"
|
||||||
echo "$1 is not converted to Bazel." >&2
|
unconverted_count=$(echo "${res}" | grep -c "not converted to Bazel")
|
||||||
return 1
|
if [[ ${unconverted_count} -ne 0 ]]; then
|
||||||
else
|
return 1
|
||||||
echo "${target_label}"
|
|
||||||
fi
|
fi
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user