From 8c4bcd2edfe1f02fd1d8285f9ff7f9c1aec441d5 Mon Sep 17 00:00:00 2001 From: Marco Massenzio Date: Sat, 27 Nov 2021 23:04:53 -0800 Subject: [PATCH] Updated release & scripts to be self-standing --- README.md | 4 ++-- build.sh | 17 ++++++++++++++--- release | 8 +++++--- test.sh => runtests.sh | 13 ++++++++++--- 4 files changed, 31 insertions(+), 11 deletions(-) rename test.sh => runtests.sh (81%) diff --git a/README.md b/README.md index 14ce38b..68a873a 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # common-utils -- Shared utilities [![Author](https://img.shields.io/badge/Author-M.%20Massenzio-green)](https://bitbucket.org/marco) -![Version](https://img.shields.io/badge/Version-0.3.0-blue) -![Released](https://img.shields.io/badge/Released-2021.11.22-green) +![Version](https://img.shields.io/badge/Version-0.4.0-blue) +![Released](https://img.shields.io/badge/Released-2021.11.27-green) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) diff --git a/build.sh b/build.sh index 8ce79de..8db49fe 100755 --- a/build.sh +++ b/build.sh @@ -5,17 +5,28 @@ # Where `build_type` can be one of either `Release` or `Debug` (default) set -eu -source $(dirname $0)/env.sh + +if [[ -z ${UTILS_DIR} || ! -d ${UTILS_DIR} ]]; then + echo "[ERROR] The \$UTILS_DIR env var must be defined and " \ + "point to the directory which contains the Common Utilities" + exit 1 +fi + +source ${UTILS_DIR}/utils +source env.sh BUILD=${1:-Debug} +msg "Build folder in ${BUILDDIR}" mkdir -p ${BUILDDIR} cd ${BUILDDIR} -if [[ -f ${BASEDIR}/conanfile.txt ]]; then - conan install ${BASEDIR} -if=${BUILDDIR} -pr=default --build=missing +if [[ -f conanfile.txt ]]; then + conan install . -if=${BUILDDIR} -pr=default --build=missing fi +UTILS="-DCOMMON_UTILS_DIR=${UTILS_DIR}" + cmake -DCMAKE_CXX_COMPILER=${CLANG} \ -DCMAKE_BUILD_TYPE=${BUILD} \ ${UTILS} .. diff --git a/release b/release index f88b171..02d79cd 100755 --- a/release +++ b/release @@ -1,14 +1,15 @@ #!/usr/bin/env bash # # Packages this project's scripts into a downloadable tarball -set -eux +set -eu source utils.sh -VERSION=0.3.0 +VERSION=0.4.0 DEST=/tmp/common-utils +msg "Bulding Common Utilities release ${VERSION}" mkdir -p ${DEST} -for f in build parse-args test utils; do +for f in build parse-args runtests utils; do cp $f.* ${DEST}/$f chmod +x $DEST/$f done @@ -17,3 +18,4 @@ cp commons.cmake $DEST/ mkdir -p rel tar cvf rel/common-utils-$VERSION.tar.gz -C /tmp common-utils rm -rf $DEST +success "Release tarball in rel/common-utils-$VERSION.tar.gz" diff --git a/test.sh b/runtests.sh similarity index 81% rename from test.sh rename to runtests.sh index a39147d..c7d2eca 100755 --- a/test.sh +++ b/runtests.sh @@ -1,13 +1,20 @@ #!/bin/bash set -eu -source $(dirname $0)/env.sh -source ${COMMON_UTILS_DIR}/utils.sh + +if [[ -z ${UTILS_DIR} || ! -d ${UTILS_DIR} ]]; then + echo "[ERROR] The \$UTILS_DIR env var must be defined and " \ + "point to the directory which contains the Common Utilities" + exit 1 +fi + +source ${UTILS_DIR}/utils +source env.sh verbose="" memcheck="" valgrind_bin="${BUILDDIR}/tests/bin/unit_tests" -source $(${COMMON_UTILS_DIR}/parse_args verbose- memcheck- valgrind_bin~ -- $@) +source $(parse-args verbose- memcheck- valgrind_bin~ -- $@) # Runs tests of the given type (unit, integration)