Skip to content

Conversation

@mitza-oci
Copy link
Member

@mitza-oci mitza-oci commented Jun 20, 2025

Summary by CodeRabbit

  • New Features

    • Added support for multiple template types for project file generation, including a new Windows batch script template.
    • Enhanced handling of project and workspace file paths, supporting both absolute and relative paths.
    • Improved environment variable usage and configuration options in workspace and project generation.
  • Improvements

    • Refined output path logic and target type handling in build file templates.
    • Updated default settings for heap size and stack length in generated integrity project files.
    • Simplified and clarified template logic for shared and static library targets.
    • Improved filtering of source files in custom build rules.
  • Bug Fixes

    • Corrected minor typos and clarified comments for better readability.

@coderabbitai
Copy link

coderabbitai bot commented Jun 20, 2025

Walkthrough

The changes introduce enhanced support for multiple Green Hills Software (GHS) project template types, including new logic for template selection, file visibility, and project file naming. Path handling is improved for both Unix and Windows systems, and workspace/project generation logic is refined, especially for INTEGRITY projects. Template files are updated and a new Windows batch script template is added.

Changes

File(s) Change Summary
modules/GHSProjectCreator.pm Introduced internal template mapping, default template logic, new methods for template selection and file visibility, and overridden project file naming to support multiple template types.
modules/GHSWorkspaceCreator.pm Added absolute path detection, improved path handling, updated environment variable usage, refined workspace and integrity project generation, and cleaned up project mixing logic.
templates/ghs.mpd, templates/ghscommon.mpt Simplified output path handling, clarified static/shared target logic, improved include/lib path usage, and introduced need_staticflags configuration flag.
templates/ghscmd.mpd Added new template for generating Windows batch scripts to process custom types and input files with directory creation and command execution logic.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GHSProjectCreator
    participant GHSWorkspaceCreator
    participant Templates

    User->>GHSProjectCreator: Request project file name
    GHSProjectCreator->>GHSProjectCreator: get_template (checks env var)
    GHSProjectCreator->>GHSProjectCreator: file_visible (checks template)
    GHSProjectCreator->>GHSProjectCreator: project_file_name (adjusts extension if needed)
    GHSProjectCreator-->>User: Return project file name

    User->>GHSWorkspaceCreator: Create workspace/project
    GHSWorkspaceCreator->>GHSWorkspaceCreator: is_absolute_path (for files)
    GHSWorkspaceCreator->>GHSWorkspaceCreator: Read env vars, set macros
    GHSWorkspaceCreator->>Templates: Use updated templates for output
    Templates-->>GHSWorkspaceCreator: Generated files
    GHSWorkspaceCreator-->>User: Workspace/project files created
Loading

Poem

In the warren where code bunnies dwell,
New templates and scripts now work so well!
Paths are checked—absolute or not—
Extensions swapped, commands are caught.
With static flags and batch delight,
This hop brings GHS projects to new height!
🐇✨

✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
templates/ghscmd.mpd (2)

1-20: Consider adding error handling for batch script robustness.

The batch script template executes commands without checking for failures. Consider adding error handling to ensure build failures are properly propagated.

You could add error checking after each command execution:

 <%translate_vars(custom_type->command, win32)%> ^
 <%if(flag_overrides(custom_type->input_file, commandflags))%>
   <%translate_vars(flag_overrides(custom_type->input_file, commandflags), win32)%> ^
 <%else%>
   <%translate_vars(custom_type->commandflags, win32)%> ^
 <%endif%>
 <%if(custom_type->output_option)%>
   <%custom_type->input_file%> <%custom_type->output_option%> <%custom_type->input_file->output_file%>
 <%else%>
   <%custom_type->input_file%>
 <%endif%>
+if errorlevel 1 (
+  popd
+  exit /b %errorlevel%
+)

21-21: Add a newline at the end of the file.

The file should end with a newline character for better compatibility with various tools.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4abacbc and 9842d6f.

📒 Files selected for processing (5)
  • modules/GHSProjectCreator.pm (3 hunks)
  • modules/GHSWorkspaceCreator.pm (5 hunks)
  • templates/ghs.mpd (3 hunks)
  • templates/ghscmd.mpd (1 hunks)
  • templates/ghscommon.mpt (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: windows-2022 vs2022
  • GitHub Check: ubuntu-22.04 g++-12
  • GitHub Check: build
  • GitHub Check: VS2022Release32
  • GitHub Check: VS2022Debug64
  • GitHub Check: macos-14-C++17
  • GitHub Check: macos-13-C++17
  • GitHub Check: ubuntu-24.04 g++-10
🔇 Additional comments (11)
templates/ghscommon.mpt (1)

8-8: LGTM!

The addition of the need_staticflags configuration flag is appropriate for controlling static/shared library target differentiation in the GHS templates.

modules/GHSProjectCreator.pm (2)

28-31: Well-structured template mapping implementation.

The template configuration with sorted keys and default template selection provides a clean foundation for multi-template support.


88-105: Clean implementation of multi-template support methods.

The get_template, file_visible, and project_file_name methods work cohesively to enable dynamic template selection based on the MPC_GHS_GENERATE_CMD environment variable.

templates/ghs.mpd (4)

4-7: Simplified output path handling for executables.

Good improvement using exeout directly instead of the relative path fallback pattern.


10-24: Improved shared/static library differentiation logic.

The use of need_staticflags effectively resolves the ambiguity when both sharedname and staticname are defined. The comments clearly explain the rationale.


47-52: Cleaner include and library path handling.

Removing the reltop_ prefix simplifies the template and makes the path handling more direct.


138-139: Source file filtering for custom build outputs.

The remove_from call properly excludes generated .cpp files from the main source list, preventing duplicate compilation.

modules/GHSWorkspaceCreator.pm (4)

53-56: Robust absolute path detection.

The helper function correctly handles both Unix-style and Windows-style absolute paths.


83-85: Good use of environment variables with sensible defaults.

The fallback values for GHS_OS_DIR and GHS_BSP_NAME provide reasonable defaults when environment variables are not set.


151-155: Verify the heap and stack size increases are appropriate for your use cases.

The heap size increase from 64KB to 2MB and stack size from 0x8000 (32KB) to 0xa000 (40KB) are reasonable for most applications, but ensure these values align with your specific INTEGRITY application requirements.


181-193: Cleaner project type handling logic.

The simplified approach of not appending compiler/linker options to the workspace file makes sense, as these should be defined in individual project files.

@mitza-oci mitza-oci requested a review from sonndinh June 20, 2025 18:16
@mitza-oci mitza-oci merged commit b085809 into DOCGroup:master Jun 23, 2025
12 checks passed
@mitza-oci mitza-oci deleted the ghs-update branch June 23, 2025 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants