Skip to content

Commit

Permalink
[tue-documentation] more env var fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthijsBurgh committed Apr 29, 2024
1 parent 8097794 commit ce4a1c7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion tue-documentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
29 changes: 21 additions & 8 deletions tue-documentation/setup
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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

0 comments on commit ce4a1c7

Please sign in to comment.