Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use msbuild -version, not %VisualStudioVersion% #92

Closed
wants to merge 10 commits into from

Conversation

rotu
Copy link
Contributor

@rotu rotu commented Aug 27, 2020

When building on Windows, instead of using %VisualStudioVersion%, use msbuild -version

This is intended to make colcon-cmake more friendly to Github actions. The microsoft/setup-msbuild action does not populate %VisualStudioVersion%, so colcon-cmake crashes on that platform.

Here is a workflow demonstrating the issue and the proposed fix:

https://github.com/rotu/ros2-ci/actions/runs/233271645/workflow

This is meant to make Colcon more friendly with github actions, since the Github action only sets the PATH to the current build tools.
@rotu
Copy link
Contributor Author

rotu commented Aug 27, 2020

FYI, the stuff in test.py and __init__.py was changed because the linter complained about it. I can revert those changes but it will make the tests fail locally for me

(.venv) C:\Users\dan\Documents\colcon-ws>pip list
Package               Version Location
--------------------- ------- -------------------------------------------------------
astroid               2.4.2
atomicwrites          1.4.0
attrs                 20.1.0
colcon-bash           0.4.2   c:\users\dan\documents\colcon-ws\.venv\src\colcon-bash
colcon-cmake          0.2.25  c:\users\dan\documents\colcon-ws\.venv\src\colcon-cmake
colcon-core           0.6.0   c:\users\dan\documents\colcon-ws\.venv\src\colcon-core
colcon-library-path   0.2.1
colcon-test-result    0.3.8
colorama              0.4.3
coloredlogs           14.0
coverage              5.2.1
distlib               0.3.1
empy                  3.3.4
flake8                3.8.3
flake8-blind-except   0.1.1
flake8-builtins       1.5.3
flake8-class-newline  1.6.0
flake8-comprehensions 3.2.3
flake8-deprecated     1.3
flake8-docstrings     1.5.0
flake8-import-order   0.18.1
flake8-polyfill       1.0.2
flake8-quotes         3.2.0
humanfriendly         8.2
iniconfig             1.0.1
isort                 5.4.2
lazy-object-proxy     1.5.1
mccabe                0.6.1
mock                  4.0.2
more-itertools        8.4.0
packaging             20.4
pep8-naming           0.11.1
pip                   20.2.2
pluggy                0.13.1
py                    1.9.0
pycodestyle           2.6.0
pydocstyle            5.1.0
pyflakes              2.2.0
pylint                2.6.0
pyparsing             2.4.7
pyreadline            2.1
pytest                6.0.1
pytest-cov            2.10.1
pytest-repeat         0.8.0
pytest-rerunfailures  9.1
scspell3k             2.2
setuptools            49.6.0

@rotu rotu marked this pull request as ready for review August 27, 2020 22:26
rotu added a commit to rotu/action-ros-ci that referenced this pull request Aug 28, 2020
rotu added a commit to rotu/action-ros-ci that referenced this pull request Aug 28, 2020
Copy link
Member

@dirk-thomas dirk-thomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the stuff in test.py and __init__.py was changed because the linter complained about it. I can revert those changes ...

Please do so to keep this patch minimal with only changes relevant to the topic of the PR..

colcon_cmake/task/cmake/__init__.py Outdated Show resolved Hide resolved
colcon_cmake/task/cmake/build.py Show resolved Hide resolved
@dirk-thomas

This comment has been minimized.

@rotu

This comment has been minimized.

colcon_cmake/task/cmake/__init__.py Outdated Show resolved Hide resolved
colcon_cmake/task/cmake/build.py Outdated Show resolved Hide resolved
colcon_cmake/task/cmake/build.py Outdated Show resolved Hide resolved
rotu added a commit to rotu/action-ros-ci that referenced this pull request Sep 11, 2020
- If the user has activated MSBuild (e.g. with the action `microsoft/setup-msbuild`), respect it instead of sourcing msbuild.
- (esp. if using PowerShell) don't wrap commands in an additional layer of cmd
- convert build-and-test to a github composite action
- add many more (too many?) variations to the ros2 matrix

Signed-off-by: Dan Rose <dan@digilabs.io>
Check for msbuild instead of %VisualStudioVersion%

Depends on colcon/colcon-cmake#92
Copy link
Member

@dirk-thomas dirk-thomas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function get_visual_studio_version() should be deprecated since it is no more used anywhere.

(I would have applied some of the changes I requested directly but it seems that editing the upstream branch is disabled.)


:rtype: str
"""
completed_process = subprocess.run(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please invoke check_output instead of run since that is what it is used for here.

@functools.lru_cache(maxsize=1)
def get_msbuild_version():
"""
Get the version of msbuild or throw an exception.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docblock should contain more information what kind of exceptions can be raised. This should use the :raises ExceptionType: ... style.

'14.0': 'Visual Studio 14 2015',
}
if vsv not in supported_vsv:
'msbuild is not found, '
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: instead if "is" it should be "was".

@rotu rotu marked this pull request as draft September 24, 2020 00:16
@dirk-thomas dirk-thomas added the enhancement New feature or request label Oct 2, 2020
@dirk-thomas
Copy link
Member

@rotu Friendly ping.

1 similar comment
@dirk-thomas
Copy link
Member

@rotu Friendly ping.

@dirk-thomas
Copy link
Member

Closing due to no response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

2 participants