Tamarin/lib/build.sh

47 lines
966 B
Bash
Executable File

#!/usr/bin/env bash
LIB_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
export TAMARIN_UTIL="${LIB_DIR}/util.sh"
source "${TAMARIN_UTIL}"
DIST_DIR="${BASE_DIR}/dist"
SRC_DIR="${BASE_DIR}/src"
PROJECT_NAME=${1}
BUILD_BRANCH=${2}
BUILD_DIR=${3}
BUILD_TAG=${4}
function build_project()
{
info "Building project '${PROJECT_NAME}'..."
set_opt project_name "${PROJECT_NAME}"
set_opt build_dir "${BUILD_DIR}"
set_opt build_branch "${BUILD_BRANCH}"
set_opt build_tag "${BUILD_TAG}"
local workspace=$(mktemp -p ${BUILD_DIR} -d)/${PROJECT_NAME}
info "Build dir is ${workspace}"
mkdir -p "${workspace}"
# Copy sources to workspace
cd ${SRC_DIR}
cp -r ${SRC_DIR}/. "${workspace}"
exec_hooks "prebuild" "${workspace}"
cd "${workspace}"
dpkg-buildpackage -us -uc 2> >(error) 1> >(info)
if [ $? != 0 ]; then
fatal "The build process has not completed successfuly !"
fi
exec_hooks "postbuild" "${workspace}"
}
build_project