Skip to content

Commit

Permalink
Update URDF deps, fix environment (#1144)
Browse files Browse the repository at this point in the history
  • Loading branch information
polyhobbyist authored Sep 27, 2023
1 parent dbbb607 commit d08f828
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 39 deletions.
32 changes: 16 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,8 @@
"test-compile": "npm run webpack"
},
"dependencies": {
"@polyhobbyist/babylon_ros": "^0.0.5",
"@polyhobbyist/babylon-collada-loader": "^0.0.3",
"@polyhobbyist/babylon_ros": "^0.0.6",
"@polyhobbyist/babylon-collada-loader": "^0.0.4",
"@vscode/debugadapter": "^1.59.0",
"@vscode/extension-telemetry": "^0.6.2",
"@vscode/webview-ui-toolkit": "^1.2.2",
Expand Down
3 changes: 2 additions & 1 deletion src/build-tool/colcon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as child_process from "child_process";
import * as extension from "../extension";
import * as common from "./common";
import * as rosShell from "./ros-shell";
import { env } from "process";

function makeColcon(command: string, verb: string, args: string[], category?: string): vscode.Task {
let installType = '--symlink-install';
Expand Down Expand Up @@ -53,7 +54,7 @@ export async function isApplicable(dir: string): Promise<boolean> {
colconCommand = `colcon --log-base /dev/null list --base-paths ${srcDir}`;
}

const { stdout, stderr } = await child_process.exec(colconCommand);
const { stdout, stderr } = await child_process.exec(colconCommand, { env: extension.env });

// Does this workspace have packages?
for await (const line of stdout) {
Expand Down
46 changes: 26 additions & 20 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,12 @@ async function activateEnvironment(context: vscode.ExtensionContext) {
await sourceRosAndWorkspace();

if (typeof env.ROS_DISTRO === "undefined") {
processingWorkspace = false;
return;
}

if (typeof env.ROS_VERSION === "undefined") {
processingWorkspace = false;
return;
}

Expand Down Expand Up @@ -377,28 +379,32 @@ async function sourceRosAndWorkspace(): Promise<void> {
newEnv = process.env;
}
}
// Source the workspace setup over the top.
// TODO: we should test what's the build tool (catkin vs colcon).
let workspaceOverlayPath: string;
workspaceOverlayPath = path.join(`${baseDir}`, "devel_isolated");
if (!await pfs.exists(workspaceOverlayPath)) {
workspaceOverlayPath = path.join(`${baseDir}`, "devel");
}
if (!await pfs.exists(workspaceOverlayPath)) {
workspaceOverlayPath = path.join(`${baseDir}`, "install");
}
let wsSetupScript: string = path.format({
dir: workspaceOverlayPath,
name: "setup",
ext: setupScriptExt,
});

if (newEnv && typeof newEnv.ROS_DISTRO !== "undefined" && await pfs.exists(wsSetupScript)) {
try {
newEnv = await ros_utils.sourceSetupFile(wsSetupScript, newEnv);
} catch (_err) {
vscode.window.showErrorMessage("Failed to source the workspace setup file.");
let workspaceOverlayPath: string = "";
if (baseDir !== undefined) {
// Source the workspace setup over the top.
// TODO: we should test what's the build tool (catkin vs colcon).
workspaceOverlayPath = path.join(`${baseDir}`, "devel_isolated");
if (!await pfs.exists(workspaceOverlayPath)) {
workspaceOverlayPath = path.join(`${baseDir}`, "devel");
}
if (!await pfs.exists(workspaceOverlayPath)) {
workspaceOverlayPath = path.join(`${baseDir}`, "install");
}
let wsSetupScript: string = path.format({
dir: workspaceOverlayPath,
name: "setup",
ext: setupScriptExt,
});

if (newEnv && typeof newEnv.ROS_DISTRO !== "undefined" && await pfs.exists(wsSetupScript)) {
try {
newEnv = await ros_utils.sourceSetupFile(wsSetupScript, newEnv);
} catch (_err) {
vscode.window.showErrorMessage("Failed to source the workspace setup file.");
}
}

}

env = newEnv;
Expand Down

0 comments on commit d08f828

Please sign in to comment.