From d08f8281274e2d938640403baf132f5d1fa085ba Mon Sep 17 00:00:00 2001 From: Lou Amadio <95253123+polyhobbyist@users.noreply.github.com> Date: Tue, 26 Sep 2023 18:09:06 -0700 Subject: [PATCH] Update URDF deps, fix environment (#1144) --- package-lock.json | 32 ++++++++++++++-------------- package.json | 4 ++-- src/build-tool/colcon.ts | 3 ++- src/extension.ts | 46 +++++++++++++++++++++++----------------- 4 files changed, 46 insertions(+), 39 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3e093c19..6ddb6c62 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,16 +1,16 @@ { "name": "vscode-ros", - "version": "0.9.4", + "version": "0.9.5", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "vscode-ros", - "version": "0.9.4", + "version": "0.9.5", "license": "SEE LICENSE IN LICENSE", "dependencies": { - "@polyhobbyist/babylon_ros": "^0.0.4", - "@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", @@ -371,9 +371,9 @@ } }, "node_modules/@polyhobbyist/babylon_ros": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/@polyhobbyist/babylon_ros/-/babylon_ros-0.0.4.tgz", - "integrity": "sha512-t3pbnutuv6h5Kh+KI1baVu5DC93h5x0PO9ias2m5ELMFXLAjbMu3U4CjeyqjTAPoGFfrW9UvNKDBv06mEh6cjA==", + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/@polyhobbyist/babylon_ros/-/babylon_ros-0.0.6.tgz", + "integrity": "sha512-dFhLmQ7vPaBTIJB+JzWbXA1ReeLO52/PDsPvLNX9No3SYg0jM1+mcatzHLn5WzpTU9ZosB/m+4tbLs4FJs1+Sg==", "dependencies": { "@types/xml2js": "^0.4.11", "babylonjs": "^5.53.0", @@ -390,9 +390,9 @@ } }, "node_modules/@polyhobbyist/babylon-collada-loader": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/@polyhobbyist/babylon-collada-loader/-/babylon-collada-loader-0.0.3.tgz", - "integrity": "sha512-G8sosoJhdaLA/dN8lChrlgM5B9VzkAiISfNY0c5hySYigUQajqcCecYkMkoyPp7PfXabUu6uf93P89jSPibJlQ==", + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/@polyhobbyist/babylon-collada-loader/-/babylon-collada-loader-0.0.4.tgz", + "integrity": "sha512-13gJQAWhxXg5HVBPw7Cf13d6dYo/OoYC8rU2MWYZgk3hTqmXndlK9twz8dc3My0/DwKUaewg3tb9RBOkqroagw==", "dependencies": { "@types/xml2js": "^0.4.11", "babylonjs": "^5.53.0", @@ -5627,9 +5627,9 @@ } }, "@polyhobbyist/babylon_ros": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/@polyhobbyist/babylon_ros/-/babylon_ros-0.0.4.tgz", - "integrity": "sha512-t3pbnutuv6h5Kh+KI1baVu5DC93h5x0PO9ias2m5ELMFXLAjbMu3U4CjeyqjTAPoGFfrW9UvNKDBv06mEh6cjA==", + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/@polyhobbyist/babylon_ros/-/babylon_ros-0.0.6.tgz", + "integrity": "sha512-dFhLmQ7vPaBTIJB+JzWbXA1ReeLO52/PDsPvLNX9No3SYg0jM1+mcatzHLn5WzpTU9ZosB/m+4tbLs4FJs1+Sg==", "requires": { "@types/xml2js": "^0.4.11", "babylonjs": "^5.53.0", @@ -5646,9 +5646,9 @@ } }, "@polyhobbyist/babylon-collada-loader": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/@polyhobbyist/babylon-collada-loader/-/babylon-collada-loader-0.0.3.tgz", - "integrity": "sha512-G8sosoJhdaLA/dN8lChrlgM5B9VzkAiISfNY0c5hySYigUQajqcCecYkMkoyPp7PfXabUu6uf93P89jSPibJlQ==", + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/@polyhobbyist/babylon-collada-loader/-/babylon-collada-loader-0.0.4.tgz", + "integrity": "sha512-13gJQAWhxXg5HVBPw7Cf13d6dYo/OoYC8rU2MWYZgk3hTqmXndlK9twz8dc3My0/DwKUaewg3tb9RBOkqroagw==", "requires": { "@types/xml2js": "^0.4.11", "babylonjs": "^5.53.0", diff --git a/package.json b/package.json index 682af6f4..909092b5 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/build-tool/colcon.ts b/src/build-tool/colcon.ts index 63b1c29b..dfc34e74 100644 --- a/src/build-tool/colcon.ts +++ b/src/build-tool/colcon.ts @@ -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'; @@ -53,7 +54,7 @@ export async function isApplicable(dir: string): Promise { 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) { diff --git a/src/extension.ts b/src/extension.ts index c70277f1..22557de0 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -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; } @@ -377,28 +379,32 @@ async function sourceRosAndWorkspace(): Promise { 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;