-
Notifications
You must be signed in to change notification settings - Fork 63
Updated Green Hills Integrity (ghs) project generation #230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Updated Green Hills workspace generation
Generated source files could appear twice in the gpj, causing a linker error for multiply-defined symbols. Projects that don't use exeout shouldn't have a / prepended (use local dir)
Updated ghs project generation to fix two issues:
ghs projects: create a .cmd file for all custom commands
Also increase stack size
Enable Debug and Release configurations in ghs
WalkthroughThe 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
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
Poem
✨ Finishing Touches🧪 Generate Unit Tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
📒 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_staticflagsconfiguration 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, andproject_file_namemethods work cohesively to enable dynamic template selection based on theMPC_GHS_GENERATE_CMDenvironment variable.templates/ghs.mpd (4)
4-7: Simplified output path handling for executables.Good improvement using
exeoutdirectly instead of the relative path fallback pattern.
10-24: Improved shared/static library differentiation logic.The use of
need_staticflagseffectively resolves the ambiguity when bothsharednameandstaticnameare 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_fromcall properly excludes generated.cppfiles 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_DIRandGHS_BSP_NAMEprovide 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.
Summary by CodeRabbit
New Features
Improvements
Bug Fixes