You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.2 KiB
43 lines
1.2 KiB
#!/bin/bash
|
|
# rust-analyzer integration test.
|
|
# Ensure that the prebuilt version of rust-analyzer is able to parse our
|
|
# automatically generated rust-project.json. This script must be run in a valid
|
|
# repository tree.
|
|
#
|
|
# The following environment variables affect the result:
|
|
# DIST_DIR where the output of `rust-analyzer analysis-stats` will be stored.
|
|
|
|
set -e
|
|
|
|
readonly UNAME="$(uname)"
|
|
case "$UNAME" in
|
|
Linux)
|
|
readonly OS='linux'
|
|
;;
|
|
Darwin)
|
|
readonly OS='darwin'
|
|
;;
|
|
*)
|
|
echo "Unsupported OS '$UNAME'"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
readonly ANDROID_TOP="$(cd $(dirname $0)/../../..; pwd)"
|
|
cd "$ANDROID_TOP"
|
|
|
|
export OUT_DIR="${OUT_DIR:-out}"
|
|
readonly SOONG_OUT="${OUT_DIR}/soong"
|
|
readonly RUST_PROJECT_PATH="${SOONG_OUT}/rust-project.json"
|
|
|
|
# Generate rust-project.json.
|
|
build/soong/soong_ui.bash --make-mode SOONG_GEN_RUST_PROJECT=1 nothing
|
|
|
|
# Symlink it from ANDROID_TOP.
|
|
[ -f "${RUST_PROJECT_PATH}" ]
|
|
ln -s "${RUST_PROJECT_PATH}" .
|
|
trap "rm \"${ANDROID_TOP}\"/rust-project.json" EXIT
|
|
|
|
# Run rust-analyzer analysis-stats. It will return 0 if rust-project.json can be found and parsed.
|
|
prebuilts/rust/${OS}-x86/stable/rust-analyzer analysis-stats . 2>"${DIST_DIR}"/rust-analyzer-stats.log
|