From c725cd7f147b272a20a2e55e5b79b2747285fc21 Mon Sep 17 00:00:00 2001 From: Dorota Czaplejewicz Date: Tue, 10 Sep 2019 10:15:25 +0000 Subject: [PATCH] cargo: Allow for manual cargo invokations --- README.md | 9 +++++++++ cargo.sh | 15 ++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index aa91d705..3f082686 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,15 @@ $ cd ../build/ $ src/squeekboard ``` +### Maintenance + +Use the `cargo.sh` script for maintaining the Cargo part of the build. The script takes the usual Cargo commands, after the first 2 positionsl arguments: source directory, and output artifact. So, `cargo test` becomes: + +``` +cd build_dir +/source_path/cargo.sh /source_path '' test +``` + ### Testing ``` diff --git a/cargo.sh b/cargo.sh index 3fb0c97c..fc8d8971 100644 --- a/cargo.sh +++ b/cargo.sh @@ -1,13 +1,22 @@ -#!/bin/sh +#!/bin/bash + +# This script manages Cargo operations +# while keeping the artifact directory within the build tree +# instead of the source tree + set -e +SOURCE_DIR="$1" + export CARGO_TARGET_DIR=`pwd` if [ ! -z ${2} ]; then OUT_PATH=`realpath "${2}"` fi -cd $1 -cargo $3 -p rs +cd $SOURCE_DIR +shift +shift +cargo $BUILD_ARG $@ if [ ! -z ${OUT_PATH} ]; then cp "${CARGO_TARGET_DIR}"/debug/librs.a "${OUT_PATH}"