Skip to content

Commit dc3d85b

Browse files
ojasjoshiOjas Joshi
andauthored
Fetching dependencies in both workspaces (robomaker-sample-app-ci) (#11)
* Fetching dependencies in both workspaces * Merging with base master * updating index.ts * simplifying exec option to vcs import * update index.ts * change comments * Adding comments for the change Co-authored-by: Ojas Joshi <[email protected]>
1 parent be89309 commit dc3d85b

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

robomaker-sample-app-ci/dist/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -737,8 +737,12 @@ function fetchRosinstallDependencies() {
737737
let packages = [];
738738
// Download dependencies not in apt if .rosinstall exists
739739
try {
740+
for (let workspace of ["robot_ws", "simulation_ws"]) {
741+
if (fs.existsSync(path.join(workspace, '.rosinstall'))) {
742+
yield exec.exec("vcs", ["import", "--input", ".rosinstall"], {cwd: workspace});
743+
}
744+
}
740745
if (fs.existsSync(path.join(WORKSPACE_DIRECTORY, '.rosinstall'))) {
741-
yield exec.exec("vcs", ["import", "--input", ".rosinstall"], getWorkingDirExecOptions());
742746
yield exec.exec("colcon", ["list", "--names-only"], getWorkingDirExecOptions(colconListAfter));
743747
const packagesAfter = colconListAfter.stdout.split("\n");
744748
packagesAfter.forEach(packageName => {
@@ -752,6 +756,7 @@ function fetchRosinstallDependencies() {
752756
return Promise.resolve(packages);
753757
});
754758
}
759+
755760
function setup() {
756761
return __awaiter(this, void 0, void 0, function* () {
757762
try {

robomaker-sample-app-ci/src/aws-robomaker-sample-application-ci.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ async function loadROSEnvVariables() {
3030
await exec.exec("bash", ["-c", `source /opt/ros/${ROS_DISTRO}/setup.bash && printenv`], options)
3131
}
3232

33-
3433
function getWorkingDirExecOptions(listenerBuffers?): ExecOptions {
3534
return getExecOptions(WORKSPACE_DIRECTORY, ".", listenerBuffers);
3635
}
@@ -73,14 +72,21 @@ async function getSampleAppVersion() : Promise<string> {
7372
return Promise.resolve(version);
7473
}
7574

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.
7776
async function fetchRosinstallDependencies(): Promise<string[]> {
7877
let colconListAfter = {stdout: '', stderr: ''};
7978
let packages: string[] = [];
8079
// Download dependencies not in apt if .rosinstall exists
8180
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
8289
if (fs.existsSync(path.join(WORKSPACE_DIRECTORY, '.rosinstall'))) {
83-
await exec.exec("vcs", ["import", "--input", ".rosinstall"], getWorkingDirExecOptions());
8490
await exec.exec("colcon", ["list", "--names-only"], getWorkingDirExecOptions(colconListAfter));
8591
const packagesAfter = colconListAfter.stdout.split("\n");
8692
packagesAfter.forEach(packageName => {

0 commit comments

Comments
 (0)