| # Copyright lowRISC contributors. |
| # Licensed under the Apache License, Version 2.0, see LICENSE for details. |
| # SPDX-License-Identifier: Apache-2.0 |
| # invoke_cargo.sh is a wrapper to invoke Cargo from Meson. This is a workaround |
| # solution to read the rust-toolchain file and set the the relevant environment |
| if [[ -f $TOOLCHAIN_FILE ]]; then |
| TOOLCHAIN="$(cat ${TOOLCHAIN_FILE})" |
| export MESON_SOURCE_ROOT="${6}" |
| export MESON_BUILD_ROOT="${7}" |
| if [ "${CARGO_TEST}" == 1 ]; then |
| "${CARGO}" fmt ${CARGO_FMT_FLAG} |
| "${CARGO}" +"${TOOLCHAIN}" test ${CARGO_FLAGS} --workspace |
| "${CARGO}" +"${TOOLCHAIN}" build ${CARGO_FLAGS} |
| "${CARGO}" fmt ${CARGO_FMT_FLAG} |
| "${CARGO}" +"${TOOLCHAIN}" build ${CARGO_FLAGS} |