build: incremental release on desktop development

This commit is contained in:
ardocrat 2024-10-12 15:26:01 +03:00
parent 18f52f877a
commit d7d1c53c52

View file

@ -1,25 +1,27 @@
#!/bin/bash
case $1 in
debug|release)
debug|build)
;;
*)
echo "Usage: build_run.sh [type] where is type is 'debug' or 'release'" >&2
echo "Usage: build_run.sh [type] where is type is 'debug' or 'build'" >&2
exit 1
esac
# Setup build directory
BASEDIR=$(cd $(dirname $0) && pwd)
cd ${BASEDIR}
BASEDIR=$(cd "$(dirname $0)" && pwd)
cd "${BASEDIR}" || return
cd ..
# Build application
type=$1
[[ ${type} == "release" ]] && release_param+=(--release)
cargo build ${release_param[@]}
[[ ${type} == "build" ]] && release_param+=(--release)
cargo --config profile.release.incremental=true build "${release_param[@]}"
# Start application
if [ $? -eq 0 ]
then
./target/${type}/grim
path=${type}
[[ ${type} == "build" ]] && path="release"
./target/"${path}"/grim
fi