Break out OutputText and RuleTextParts#177
Merged
elliotgoodrich merged 1 commit intomainfrom Nov 10, 2025
Merged
Conversation
d7e51b3 to
d251970
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the BuildContext class in trimutil.cpp to improve code organization and encapsulation. The main changes involve extracting functionality into smaller, well-documented classes and renaming existing classes to better reflect their purpose.
- Extracted
OutputTextclass to manage the final output text of the ninja file trimming - Extracted
RuleTextPartsclass to manage the parts of a ninja rule withinOutputText - Renamed
RuletoRuleVariablesto better represent that it holds rule variables - Renamed
RuleCommandtoRuleto better represent a complete ninja rule
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 |
|---|---|
| src/trimutil.cpp | Introduced new OutputText, RuleTextParts, and Rule classes; updated BuildContext to use these new classes; migrated all usage of old types to new types |
| src/rulevariables.h | Updated header guard and renamed Rule class to RuleVariables |
| src/rulevariables.cpp | Updated include path and renamed all Rule method implementations to RuleVariables |
| src/edgescope.h | Updated include path from rule.h to rulevariables.h and updated type references |
| CMakeLists.txt | Updated source file reference from src/rule.cpp to src/rulevariables.cpp |
| src/all.natvis | Updated debugger visualization for OutputText::Index type |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/trimutil.cpp
Outdated
| * @param start The index of the start of the rule, up to the start of the | ||
| * rule name | ||
| * @param name The index of the name of the rule | ||
| * @param end The index of the rest of the rule after the name, including all |
There was a problem hiding this comment.
The documentation parameter name @param end does not match the actual parameter name rest. The documentation should use @param rest instead of @param end.
Suggested change
| * @param end The index of the rest of the rule after the name, including all | |
| * @param rest The index of the rest of the rule after the name, including all |
d251970 to
4f3e7ea
Compare
Continue breaking up `BuildContext` into smaller, more-encapsulated, and documented classes so that future work in `trimutil.cpp` is easier. As part of this we rename `Rule` to `RuleVariables` and `RuleCommand` to `Rule` to reflect better what these classes represent.
4f3e7ea to
0148665
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Continue breaking up
BuildContextinto smaller, more-encapsulated, and documented classes so that future work intrimutil.cppis easier.As part of this we rename
RuletoRuleVariablesandRuleCommandtoRuleto reflect better what these classes represent.