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

Add support for more than one release of Visual Studio #74

Merged
merged 7 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cookbooks/ros2_windows/attributes/visual_studio.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Visual studio version, "buildtools" or "community"
default['ros2_windows']['vs_version'] = 'buildtools'
default['ros2_windows']['vs_release'] = '2019'
19 changes: 15 additions & 4 deletions cookbooks/ros2_windows/recipes/visual_studio.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,27 @@

installer_options = base_options + package_arguments

visual_studio_source = 'https://aka.ms/vs/16/release/vs_%s.exe' % node['ros2_windows']['vs_version']

vs_version_camel_case = {
'buildtools' => 'BuildTools',
'community' => 'Community',
'professional' => 'Professional',
'enterprise' => 'Enterprise'
}[node['ros2_windows']['vs_version']]

visual_studio_path = 'c:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\%s' % vs_version_camel_case
case node['ros2_windows']['vs_release']
when '2022'
visual_studio_source = 'https://aka.ms/vs/17/release/vs_%s.exe' % node['ros2_windows']['vs_version']
visual_studio_path = 'c:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\%s' % vs_version_camel_case
claraberendsen marked this conversation as resolved.
Show resolved Hide resolved
vc_target_path = 'MSBuild\\Microsoft\\VC\\v170\\'
when '2019'
visual_studio_source = 'https://aka.ms/vs/16/release/vs_%s.exe' % node['ros2_windows']['vs_version']
visual_studio_path = 'c:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\%s' % vs_version_camel_case
vc_target_path = 'MSBuild\\Microsoft\\VC\\v160\\'
else
raise "Unsupported Visual Studio version: #{node['ros2_windows']['vs_release']}"
end


windows_package 'Update VS' do
source visual_studio_source
installer_type :custom
Expand All @@ -61,6 +72,6 @@

windows_env 'VCTargetsPath' do
key_name 'VCTargetsPath'
value File.join(visual_studio_path, 'MSBuild\\Microsoft\\VC\\v160\\')
value File.join(visual_studio_path, vc_target_path)
action :create
end
3 changes: 2 additions & 1 deletion roles/ros2-development.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
"development": "true",
"download_sources": "true",
"vs_version": "buildtools",
"vs_release": "2019",
"source": {
"ros2.repos": "rolling"
},
"ros2_ws": "C:/dev/ros2_ws",
"install_connext": "false",
"install_connext": "false"
Copy link
Contributor

Choose a reason for hiding this comment

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

Sigh. JSON

}
},
"chef_type": "role",
Expand Down