betwo / vscode-catkin-tools

VS Code extension for catkin_tools support
https://marketplace.visualstudio.com/items?itemName=betwo.b2-catkin-tools
MIT License
24 stars 7 forks source link

Extension does not work with packages being symlinks #10

Closed Timple closed 5 years ago

Timple commented 5 years ago

Output

> Executing task: cd "/home/tim/catkin_ws/src/mypkg/include/mypkg" && catkin locate > /dev/null && source "$(catkin locate -d)/setup.bash" && catkin build --this -v --no-deps <

ERROR: No workspace found containing '/home/tim/repos/https_/github.com/mypkg.git/include/mypkg'
The terminal process terminated with exit code: 1

Terminal will be reused by tasks, press any key to close it.

In this case I have a symlink to mypkg in the catkin_ws folder. Normal catkin operation works. Also catkin build --this works fine in a terminal.

However catkin locate gives the absolute path instead of the symlinked version. There doesn't seem to be a nice python solution to get the symbolic link. (Otherwise I've would have opened a PR there).

Could the sourcing of the devel space be done relative the the workspace maybe? Because the root is always the workspace. So {workspace}/devel/setup.bash should be fine. Or make an option to select a setup.bash file.

betwo commented 5 years ago

Thank you @Timple for the the report, I could not respond sooner due to summer vacation.

Could the sourcing of the devel space be done relative the the workspace maybe? Because the root is always the workspace. So {workspace}/devel/setup.bash should be fine. Or make an option to select a setup.bash file.

Very good idea. The only problem with hard coding {workspace}/devel/setup.bash is:

  1. we cannot assume .bash, there could be another shell in use (another open bug)
  2. we cannot assume devel, there could be another catkin profile in use

However, we can:

  1. Repeatedly change to the parent directory until .catkin_tools is found
  2. Then call catkin locate -d in this directory
  3. Change back to the original directory
  4. Call catkin build --this
betwo commented 5 years ago

Version 1.5.2 contains the described solution.

@Timple, please feel free to re-open this issue if it does not work for you!

Timple commented 5 years ago

Seems to work, great thanks!