Skip to content

Commit 7b0dfdd

Browse files
Windows: Split upstream workspace from target workspace (#460)
* Build upstream workspace in a different folder * Split cmake_args * Fix folders * Fix cmd.exe syntax * Fix cd command * Use skip_packages also for upstream ws * echo on * List packages * Use echo on after all setup.bat scripts * Fix packages-skip * Use --merge-install * Remove debug output
1 parent ff309bd commit 7b0dfdd

1 file changed

Lines changed: 39 additions & 15 deletions

File tree

.github/workflows/reusable-ros-tooling-win-build.yml

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,13 @@ on:
4343
default: ""
4444
required: false
4545
type: string
46-
cmake_args:
47-
description: "Additional arguments to pass to CMake, e.g. -DBUILD_TESTING=OFF"
46+
upstream_cmake_args:
47+
description: "Additional arguments to pass to CMake for upstream workspace, e.g. -DBUILD_TESTING=OFF"
48+
default: "-DBUILD_TESTING=OFF"
49+
required: false
50+
type: string
51+
target_cmake_args:
52+
description: "Additional arguments to pass to CMake for target workspace, e.g. -DBUILD_TESTING=OFF"
4853
default: ""
4954
required: false
5055
type: string
@@ -56,6 +61,7 @@ jobs:
5661
container: ${{ inputs.container }}
5762
env:
5863
ros_underlay_path: C:\dev
64+
upstream_workspace: C:\upstream_ws
5965
# this will be src/{repo-owner}/{repo-name}
6066
repo_path: src/${{ github.repository }}
6167
steps:
@@ -164,24 +170,25 @@ jobs:
164170
path: ${{ env.repo_path }}
165171
manifest-path: pixi.toml
166172

167-
- name: Install dependencies
173+
- name: Clone dependencies
168174
# check for repos files, and pass them to vcstool
169175
run: |
176+
mkdir -p ${{ env.upstream_workspace }}/src
170177
Invoke-Expression ((& pixi shell-hook -s powershell) -join "`n")
171178
$repo_file = "${{ env.repo_path }}\${{ steps.package_list_action.outputs.repo_name }}.${{ inputs.ros_distro }}.repos"
172179
if (Test-Path "$repo_file") {
173180
Write-Output "Local repos file found"
174-
vcs import --input $repo_file src
181+
vcs import --input $repo_file ${{ env.upstream_workspace }}/src
175182
}
176183
if (![string]::IsNullOrWhiteSpace("${{ inputs.windows_dependencies }}")) {
177184
$repo_file_win = "${{ env.repo_path }}\${{ inputs.windows_dependencies }}"
178185
if (Test-Path "$repo_file_win") {
179186
Write-Output "Windows repos file found"
180-
vcs import --input $repo_file_win src
187+
vcs import --input $repo_file_win ${{ env.upstream_workspace }}/src
181188
}
182189
}
183190
184-
- name: Build workspace
191+
- name: Build upstream workspace
185192
# use Ninja generator optionally for selected packages.
186193
# This is needed for RSL, but doesn't work for msg packages
187194
# https://github.com/search?q=repo%3APickNikRobotics%2FRSL%20ninja&type=code
@@ -192,18 +199,35 @@ jobs:
192199
call pixi_env.bat >nul 2>&1
193200
194201
call ${{ env.ros_underlay_path }}\ros2_${{ inputs.ros_distro }}\ros2-windows\setup.bat
202+
pushd ${{ env.upstream_workspace }}
203+
204+
@echo on
195205
196-
set up_to_arg=
197-
if not "${{ steps.package_list_action.outputs.package_list }}"=="" (
198-
set up_to_arg=--packages-up-to ${{ steps.package_list_action.outputs.package_list }}
199-
)
200206
set skip_arg=
201207
if not "${{ inputs.skip_packages }}"=="" (
202-
set skip_arg=--packages-skip ${{ inputs.skip_packages }}
208+
set skip_arg=${{ inputs.skip_packages }}
203209
)
204-
set skip_ninja_arg=
210+
205211
if not "${{ inputs.ninja_packages }}"=="" (
206-
colcon build --packages-up-to ${{ inputs.ninja_packages }} --cmake-args -G Ninja --event-handler console_cohesion+
207-
set skip_ninja_arg=--packages-skip ${{ inputs.ninja_packages }}
212+
colcon build --packages-up-to ${{ inputs.ninja_packages }} --cmake-args -G Ninja --event-handler console_cohesion+ --merge-install
213+
set skip_arg=%skip_arg% ${{ inputs.ninja_packages }}
214+
)
215+
216+
colcon build --packages-skip %skip_arg% --event-handler console_cohesion+ --cmake-args ${{ inputs.upstream_cmake_args }} --merge-install
217+
218+
- name: Build target workspace
219+
shell: cmd
220+
run: |
221+
call pixi shell-hook -s cmd > pixi_env.bat
222+
call pixi_env.bat >nul 2>&1
223+
224+
call ${{ env.ros_underlay_path }}\ros2_${{ inputs.ros_distro }}\ros2-windows\setup.bat
225+
call ${{ env.upstream_workspace }}\install\setup.bat
226+
227+
@echo on
228+
229+
set skip_arg=
230+
if not "${{ inputs.skip_packages }}"=="" (
231+
set skip_arg=--packages-skip ${{ inputs.skip_packages }}
208232
)
209-
colcon build %up_to_arg% %skip_arg% %skip_ninja_arg% --event-handler console_cohesion+ --cmake-args ${{ inputs.cmake_args }}
233+
colcon build %skip_arg% --event-handler console_cohesion+ --cmake-args ${{ inputs.target_cmake_args }} --merge-install

0 commit comments

Comments
 (0)