Add support for dotnet solution filter files (monorepo support)#2579
Open
rocklan wants to merge 9 commits intotj-actions:mainfrom
Open
Add support for dotnet solution filter files (monorepo support)#2579rocklan wants to merge 9 commits intotj-actions:mainfrom
rocklan wants to merge 9 commits intotj-actions:mainfrom
Conversation
2 tasks
Contributor
|
bugbot run |
There was a problem hiding this comment.
Bug: Key Generation and Path Separator Issues
The code has two issues when processing solution filters:
- Key Generation: The
keygeneration usesreplace('.', '-'), which only replaces the first occurrence of a dot in the solution filter filename. This results in incorrect keys for filenames with multiple dots (e.g., "My.Project.Solution.slnf" becomes "My-Project.Solution" instead of "My-Project-Solution"). A global replace (.replace(/\./g, '-')) is required. - Path Handling: The logic for extracting project directory names (
project.lastIndexOf('\\')) assumes Windows-style backslash path separators. If project paths in the solution filter use forward slashes (common on non-Windows systems), this logic fails, causing valid.csprojfiles to be skipped and incorrect include strings to be generated. The code should handle both path separators or normalize paths.
src/utils.ts#L1311-L1320
Lines 1311 to 1320 in 091153e
Bug: Solution Filter Overwrites Project Patterns
When processing solution filters, the filePatterns array is incorrectly overwritten for each project within the same solution filter. This results in only the last project's directory pattern being retained for a given solution filter key, effectively losing all other projects from that same filter. The intended behavior is to accumulate all project directory patterns under a single key.
src/utils.ts#L1338-L1339
Lines 1338 to 1339 in 091153e
Learn more in the Cursor dashboard.
Was this report helpful? Give feedback by reacting with 👍 or 👎
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.
This PR adds support for being able to specify a list of dotnet solution filter files, and for those files to be parsed and converted to Yaml file patterns.
What this means in english is that if we have a solution filter file in our repo that looks like this:
MyApplication.slnf
and we supply it as an input parameter to this action:
it will be treated like a configuration yaml file that looks like so:
This is great because it means our
changed_files.yamlfile doesn't need to be manually kept in sync with our solution filters. If we add a new project to a solution or delete/rename a project it will automatically be picked up by changed-files. This may seem like a trivial request but the larger the repo the bigger this problem becomes, and adding this feature would simplify a lot of things. Currently we are generating this file as a separate step (and caching it) but it all becomes a lot simpler if it's just done inside this action.The way it works is by parsing the
slnffile specified, looking for theprojectsarray inside the file, then looking for.csprojfile references, and then filtering out the project file but keeping the path. Once we have the path, we append/**to the end of it and we have our filePattern. The key added is the name of the solution filter file converted to lowercase (and dots converted to dashes).This also provides great support for monorepos, because if you specify multiple solution filters, they will also be added to the configuration:
Plus, if you have extra files that are outside of the project directory, you can specify them in a yaml file and they will be appended:
project-files.yml
which will end up giving us:
The code submitted is definitely not awesome, all reviews extremely welcome :) I suspect this feature would be really helpful to a lot of .NET devs.