On Ubuntu 18.04, /bin/sh is symlinked to dash. Executing codegen under
dash results in the following error:
codegen: Syntax error: "(" unexpected
To prevent this, explicitly use bash.
Test: manual ($ANDROID_BUILD_TOP/development/scripts/codegen --help)
Change-Id: I11bd5e41757a8d26f5e9d7d3340306d5ff4da1f9
21 lines
551 B
Bash
Executable File
21 lines
551 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
top="$(dirname $0)/../.."
|
|
|
|
function buildCodegen() {
|
|
$top/build/soong/soong_ui.bash --build-mode --all-modules --dir="$PWD" -j codegen_cli 1>&2
|
|
}
|
|
|
|
if ! command -v codegen_cli 2>&1 >/dev/null; then
|
|
# First time running codegen
|
|
buildCodegen
|
|
else
|
|
latestVersion=$(cat $top/frameworks/base/tools/codegen/src/com/android/codegen/SharedConstants.kt | grep 'CODEGEN_VERSION =' | awk '{ print $5 }' | tr -d '"')
|
|
if [[ $(codegen_cli --version) != $latestVersion ]]; then
|
|
# Update codegen
|
|
buildCodegen
|
|
fi
|
|
fi
|
|
|
|
exec codegen_cli "$@"
|