@@ -30,7 +30,6 @@ async function loadROSEnvVariables() {
30
30
await exec . exec ( "bash" , [ "-c" , `source /opt/ros/${ ROS_DISTRO } /setup.bash && printenv` ] , options )
31
31
}
32
32
33
-
34
33
function getWorkingDirExecOptions ( listenerBuffers ?) : ExecOptions {
35
34
return getExecOptions ( WORKSPACE_DIRECTORY , "." , listenerBuffers ) ;
36
35
}
@@ -73,14 +72,21 @@ async function getSampleAppVersion() : Promise<string> {
73
72
return Promise . resolve ( version ) ;
74
73
}
75
74
76
- // If .rosinstall exists, run 'rosws update ' and return a list of names of the packages that were added.
75
+ // If .rosinstall exists, run 'vcs import ' and return a list of names of the packages that were added in both workspaces .
77
76
async function fetchRosinstallDependencies ( ) : Promise < string [ ] > {
78
77
let colconListAfter = { stdout : '' , stderr : '' } ;
79
78
let packages : string [ ] = [ ] ;
80
79
// Download dependencies not in apt if .rosinstall exists
81
80
try {
81
+ // When generate-sources: true, the expected behavior is to include sources from both workspaces including their dependencies.
82
+ // In order to make generate-sources work as expected, dependencies are fetched in both the workspaces here.
83
+ for ( let workspace of [ "robot_ws" , "simulation_ws" ] ) {
84
+ if ( fs . existsSync ( path . join ( workspace , '.rosinstall' ) ) ) {
85
+ await exec . exec ( "vcs" , [ "import" , "--input" , ".rosinstall" ] , { cwd : workspace } ) ;
86
+ }
87
+ }
88
+ // this is outside the loop as we don't want to build both the dependency packages
82
89
if ( fs . existsSync ( path . join ( WORKSPACE_DIRECTORY , '.rosinstall' ) ) ) {
83
- await exec . exec ( "vcs" , [ "import" , "--input" , ".rosinstall" ] , getWorkingDirExecOptions ( ) ) ;
84
90
await exec . exec ( "colcon" , [ "list" , "--names-only" ] , getWorkingDirExecOptions ( colconListAfter ) ) ;
85
91
const packagesAfter = colconListAfter . stdout . split ( "\n" ) ;
86
92
packagesAfter . forEach ( packageName => {
0 commit comments