2016-10-02 08:18:37 +00:00
|
|
|
# Simply sets up a few useful variables.
|
|
|
|
|
|
|
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
|
|
|
|
|
|
function relative() {
|
|
|
|
local full_path="${SCRIPT_DIR}/../${1}"
|
2016-10-02 08:23:28 +00:00
|
|
|
|
2016-10-04 00:25:55 +00:00
|
|
|
if [ -d "${full_path}" ]; then
|
2016-12-26 04:23:54 +00:00
|
|
|
# Try to use readlink as a fallback to readpath for cross-platform compat.
|
|
|
|
if command -v realpath >/dev/null 2>&1; then
|
2018-01-24 02:53:02 +00:00
|
|
|
realpath "${full_path}"
|
2016-12-26 04:23:54 +00:00
|
|
|
elif ! (readlink -f 2>&1 | grep illegal > /dev/null); then
|
2018-01-24 02:53:02 +00:00
|
|
|
readlink -f "${full_path}"
|
2016-10-04 00:25:55 +00:00
|
|
|
else
|
2016-12-26 04:23:54 +00:00
|
|
|
echo "Rocket's scripts require 'realpath' or 'readlink -f' support." >&2
|
|
|
|
echo "Install realpath or GNU readlink via your package manager." >&2
|
|
|
|
echo "Aborting." >&2
|
|
|
|
exit 1
|
2016-10-04 00:25:55 +00:00
|
|
|
fi
|
2016-10-02 08:23:28 +00:00
|
|
|
else
|
2016-10-04 00:25:55 +00:00
|
|
|
# when the directory doesn't exist, fallback to this.
|
|
|
|
echo "${full_path}"
|
2016-10-02 08:23:28 +00:00
|
|
|
fi
|
2016-10-02 08:18:37 +00:00
|
|
|
}
|
|
|
|
|
2020-01-29 22:16:50 +00:00
|
|
|
# Versioning information. These are toggled as versions change.
|
2019-05-13 23:18:48 +00:00
|
|
|
ROCKET_VERSION="0.5.0-dev"
|
|
|
|
CURRENT_RELEASE=false
|
2020-01-29 22:16:50 +00:00
|
|
|
PRE_RELEASE=true
|
|
|
|
|
|
|
|
# A generated codename for this version. Use the git branch for pre-releases.
|
|
|
|
case $PRE_RELEASE in
|
|
|
|
true) VERSION_CODENAME="$(git branch --show-current)" ;;
|
|
|
|
false) VERSION_CODENAME="$(echo "${ROCKET_VERSION}" | cut -d'.' -f1-2)" ;;
|
|
|
|
esac
|
2018-10-07 04:16:02 +00:00
|
|
|
|
2018-06-07 13:34:47 +00:00
|
|
|
# Root of workspace-like directories.
|
|
|
|
PROJECT_ROOT=$(relative "") || exit $?
|
|
|
|
CORE_ROOT=$(relative "core") || exit $?
|
|
|
|
CONTRIB_ROOT=$(relative "contrib") || exit $?
|
2018-10-07 04:16:02 +00:00
|
|
|
SITE_ROOT=$(relative "site") || exit $?
|
2018-06-07 13:34:47 +00:00
|
|
|
|
|
|
|
# Root of project-like directories.
|
|
|
|
CORE_LIB_ROOT=$(relative "core/lib") || exit $?
|
2018-10-22 06:53:09 +00:00
|
|
|
CORE_CODEGEN_ROOT=$(relative "core/codegen") || exit $?
|
2018-06-07 13:34:47 +00:00
|
|
|
CORE_HTTP_ROOT=$(relative "core/http") || exit $?
|
|
|
|
CONTRIB_LIB_ROOT=$(relative "contrib/lib") || exit $?
|
2018-10-07 04:16:02 +00:00
|
|
|
CONTRIB_CODEGEN_ROOT=$(relative "contrib/codegen") || exit $?
|
2018-06-07 13:34:47 +00:00
|
|
|
|
|
|
|
# Root of infrastructure directories.
|
2016-12-26 04:23:54 +00:00
|
|
|
EXAMPLES_DIR=$(relative "examples") || exit $?
|
|
|
|
DOC_DIR=$(relative "target/doc") || exit $?
|
2016-10-02 08:18:37 +00:00
|
|
|
|
2018-06-07 13:34:47 +00:00
|
|
|
ALL_PROJECT_DIRS=(
|
|
|
|
"${CORE_HTTP_ROOT}"
|
2018-10-29 11:52:31 +00:00
|
|
|
"${CORE_CODEGEN_ROOT}"
|
|
|
|
"${CORE_LIB_ROOT}"
|
2018-10-07 04:16:02 +00:00
|
|
|
"${CONTRIB_CODEGEN_ROOT}"
|
2018-10-29 11:52:31 +00:00
|
|
|
"${CONTRIB_LIB_ROOT}"
|
2018-06-07 13:34:47 +00:00
|
|
|
)
|
|
|
|
|
2016-10-02 08:18:37 +00:00
|
|
|
if [ "${1}" = "-p" ]; then
|
2019-05-13 23:18:48 +00:00
|
|
|
echo "ROCKET_VERSION: ${ROCKET_VERSION}"
|
|
|
|
echo "CURRENT_RELEASE: ${CURRENT_RELEASE}"
|
2020-01-29 22:16:50 +00:00
|
|
|
echo "PRE_RELEASE: ${PRE_RELEASE}"
|
|
|
|
echo "VERSION_CODENAME: ${VERSION_CODENAME}"
|
2018-06-07 13:34:47 +00:00
|
|
|
echo "SCRIPT_DIR: ${SCRIPT_DIR}"
|
|
|
|
echo "PROJECT_ROOT: ${PROJECT_ROOT}"
|
|
|
|
echo "CORE_ROOT: ${CORE_ROOT}"
|
|
|
|
echo "CONTRIB_ROOT: ${CONTRIB_ROOT}"
|
2018-10-07 04:16:02 +00:00
|
|
|
echo "SITE_ROOT: ${SITE_ROOT}"
|
2018-06-07 13:34:47 +00:00
|
|
|
echo "CORE_LIB_ROOT: ${CORE_LIB_ROOT}"
|
2018-10-22 06:53:09 +00:00
|
|
|
echo "CORE_CODEGEN_ROOT: ${CORE_CODEGEN_ROOT}"
|
2018-06-07 13:34:47 +00:00
|
|
|
echo "CORE_HTTP_ROOT: ${CORE_HTTP_ROOT}"
|
|
|
|
echo "CONTRIB_LIB_ROOT: ${CONTRIB_LIB_ROOT}"
|
2018-10-07 04:16:02 +00:00
|
|
|
echo "CONTRIB_CODEGEN_ROOT: ${CONTRIB_CODEGEN_ROOT}"
|
2018-06-07 13:34:47 +00:00
|
|
|
echo "EXAMPLES_DIR: ${EXAMPLES_DIR}"
|
|
|
|
echo "DOC_DIR: ${DOC_DIR}"
|
2018-10-07 04:16:02 +00:00
|
|
|
echo "ALL_PROJECT_DIRS: ${ALL_PROJECT_DIRS[*]}"
|
2016-10-02 08:18:37 +00:00
|
|
|
fi
|