From ce4a1c751de71e8bb3f7fb57ba526955ff319a93 Mon Sep 17 00:00:00 2001 From: Matthijs van der Burgh Date: Mon, 29 Apr 2024 09:10:38 +0200 Subject: [PATCH] [tue-documentation] more env var fixes --- tue-documentation/README.md | 2 +- tue-documentation/setup | 29 +++++++++++++++++++++-------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/tue-documentation/README.md b/tue-documentation/README.md index 534b7e68b..40aa21ae9 100644 --- a/tue-documentation/README.md +++ b/tue-documentation/README.md @@ -13,7 +13,7 @@ To do this create a yaml file in the main folder of your package, for consistenc Check [Python](#Python) and [C++](#c) for the configuration of the `rosdoc` configuration. -The overview page is configured by the [catkin_tools_document_config.yaml](./catkin_tools_document_config.yaml) in this target. The image path is relative to the `$TUE_SYSTEM_DIR/build/docs`. It ends up here in this target. This is possible as the target location relative to the workspace is fixed. +The overview page is configured by the [catkin_tools_document_config.yaml](./catkin_tools_document_config.yaml) in this target. The image path is relative to the `${TUE_ENV_WS_DIR}/build/docs`. It ends up here in this target. This is possible as the target location relative to the workspace is fixed. ## Generation diff --git a/tue-documentation/setup b/tue-documentation/setup index b432c62f6..79459b81b 100644 --- a/tue-documentation/setup +++ b/tue-documentation/setup @@ -8,21 +8,31 @@ export CATKIN_TOOLS_DOCUMENT_CONFIG_FILE # Function to generate doucmentation of current workspace function tue-make-documentation { - if [ -n "$TUE_ROS_DISTRO" ] && [ -d "$TUE_SYSTEM_DIR" ] + # TODO(anyone): remove when tue-env is updated to new variable names + [[ -v TUE_ENV_WS_DIR || ! -v TUE_WS_DIR ]] || TUE_ENV_WS_DIR=${TUE_WS_DIR} + + # TODO(anyone): remove when tue-env is updated to new variable names + if [[ ! -v TUE_ENV_ROS_DISTRO && -v TUE_ROS_DISTRO ]] + then + TUE_ENV_ROS_DISTRO=${TUE_ROS_DISTRO} + >&2 echo "Change the config of your environment to use 'TUE_ENV_ROS_DISTRO' instead of 'TUE_ROS_DISTRO'" + fi + + if [[ -n "${TUE_ENV_ROS_DISTRO}" ]] && [[ -d "${TUE_ENV_WS_DIR}" ]] then local build_tool="" - if [ -f "$TUE_SYSTEM_DIR"/build/.built_by ] + if [[ -f "${TUE_ENV_WS_DIR}"/build/.built_by ]] then - build_tool=$(cat "$TUE_SYSTEM_DIR"/build/.built_by) + build_tool=$(cat "${TUE_ENV_WS_DIR}"/build/.built_by) fi case $build_tool in 'catkin build') - catkin document --workspace "$TUE_SYSTEM_DIR" "$@" + catkin document --workspace "${TUE_ENV_WS_DIR}" "$@" ;; '') - catkin config --init --mkdirs --workspace "$TUE_SYSTEM_DIR" --extend /opt/ros/"$TUE_ROS_DISTRO" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCATKIN_ENABLE_TESTING=OFF - catkin document --workspace "$TUE_SYSTEM_DIR" "$@" - touch "$TUE_SYSTEM_DIR"/devel/.catkin # hack to allow overlaying to this ws while being empty + catkin config --init --mkdirs --workspace "${TUE_ENV_WS_DIR}" --extend /opt/ros/"${TUE_ENV_ROS_DISTRO}" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCATKIN_ENABLE_TESTING=OFF + catkin document --workspace "${TUE_ENV_WS_DIR}" "$@" + touch "${TUE_ENV_WS_DIR}"/devel/.catkin # hack to allow overlaying to this ws while being empty ;; *) echo -e "\e$build_tool is not supported (anymore), use catkin tools\e[0m" @@ -36,6 +46,9 @@ export -f tue-make-documentation # Use complete function of tue-make complete -F _tue-make tue-make-documentation +# TODO(anyone): remove when tue-env is updated to new variable names +[[ -v TUE_ENV_WS_DIR || ! -v TUE_WS_DIR ]] || TUE_ENV_WS_DIR=${TUE_WS_DIR} + # Export docs path to open with desiserd browser -TUE_DOCS_PATH="$TUE_SYSTEM_DIR"/docs/index.html +TUE_DOCS_PATH="${TUE_ENV_WS_DIR}"/docs/index.html export TUE_DOCS_PATH