Skip to content

Comments

Support hyphenated ROSIDL subdirs#1390

Merged
minggangw merged 1 commit intoRobotWebTools:developfrom
minggangw:fix-1388
Feb 12, 2026
Merged

Support hyphenated ROSIDL subdirs#1390
minggangw merged 1 commit intoRobotWebTools:developfrom
minggangw:fix-1388

Conversation

@minggangw
Copy link
Member

@minggangw minggangw commented Feb 12, 2026

This PR adds support for ROSIDL packages with hyphenated subdirectory names (e.g., msg-common, msg-ros2) by updating the subfolder extraction logic to normalize these to their base interface types (msg, srv, action).

Changes:

  • Modified getSubFolder() to extract base interface type from hyphenated subdirectory names using split('-')[0]
  • Added comprehensive test case using mrpt_msgs package to validate hyphenated subfolder support
  • Refactored test setup in test-native-loader.js to avoid repeated module reloading
  • Updated CI workflows to install mrpt-msgs package for testing
  • Simplified process exit handling in test runner script

Fix: #1388

Copilot AI review requested due to automatic review settings February 12, 2026 05:10
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for ROSIDL packages with hyphenated subdirectory names (e.g., msg-common, msg-ros2) by updating the subfolder extraction logic to normalize these to their base interface types (msg, srv, action).

Changes:

  • Modified getSubFolder() to extract base interface type from hyphenated subdirectory names using split('-')[0]
  • Added comprehensive test case using mrpt_msgs package to validate hyphenated subfolder support
  • Refactored test setup in test-native-loader.js to avoid repeated module reloading
  • Updated CI workflows to install mrpt-msgs package for testing
  • Simplified process exit handling in test runner script

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
rosidl_gen/packages.js Updated regex pattern and added logic to normalize hyphenated subfolder names to base interface types
test/test-rosidl-message-generator.js Added test case for mrpt_msgs with hyphenated subfolders to verify message loading and field access
test/test-native-loader.js Refactored module loading to cache native_loader.js and reuse TestHelpers between tests
scripts/run_test.js Simplified exit code handling by directly setting process.exitCode and calling process.exit()
.github/workflows/linux-x64-build-and-test.yml Added mrpt-msgs package installation for CI testing
.github/workflows/linux-arm64-build-and-test.yml Added mrpt-msgs package installation for CI testing

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 61 to 62
}
// If the |amentExecuted| equals to false, the file's extension will be assigned as
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the regex match fails (match is null or undefined), the function will fall through to line 64 which returns the file extension. However, if amentExecuted is true and the match fails, this might indicate a malformed path that should be handled differently. Consider adding an explicit else clause or a fallback return statement within the amentExecuted block to make the error handling more explicit, or add a comment explaining that falling through to line 64 is intentional for this case.

Suggested change
}
// If the |amentExecuted| equals to false, the file's extension will be assigned as
// If |amentExecuted| is true but the expected pattern is not found,
// fall back to using the file's extension as the subfolder name.
return path.parse(filePath).ext.substr(1);
}
// If |amentExecuted| equals to false, the file's extension will be assigned as

Copilot uses AI. Check for mistakes.
@coveralls
Copy link

Coverage Status

coverage: 85.464% (-0.1%) from 85.565%
when pulling 8fdcbe1 on minggangw:fix-1388
into c81c497 on RobotWebTools:develop.

@minggangw minggangw merged commit 358b955 into RobotWebTools:develop Feb 12, 2026
23 of 24 checks passed
minggangw added a commit that referenced this pull request Feb 14, 2026
This PR adds support for ROSIDL packages with hyphenated subdirectory names (e.g., `msg-common`, `msg-ros2`) by updating the subfolder extraction logic to normalize these to their base interface types (`msg`, `srv`, `action`).

**Changes:**
- Modified `getSubFolder()` to extract base interface type from hyphenated subdirectory names using `split('-')[0]`
- Added comprehensive test case using `mrpt_msgs` package to validate hyphenated subfolder support
- Refactored test setup in `test-native-loader.js` to avoid repeated module reloading
- Updated CI workflows to install `mrpt-msgs` package for testing
- Simplified process exit handling in test runner script

Fix: #1388
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mrpt-msgs causing generate-ros-messages to fail

2 participants