Source Code Transformation for .NET 8#136
Merged
Merged
Conversation
Signed-off-by: Kenny Pflug <kenny.pflug@live.de>
…ormation Signed-off-by: Kenny Pflug <kenny.pflug@live.de>
…ent scenarios reliably Signed-off-by: Kenny Pflug <kenny.pflug@live.de>
10 tasks
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates Light.GuardClauses.SourceCodeTransformation so the single-file export can be flattened for a concrete target framework (netstandard2.0 by default, optionally net8.0), and reworks build validation to compile the generated file against the matching framework using a new Light.GuardClauses.SourceValidation project.
Changes:
- Introduces
SourceTargetFramework+SourceFileMergeOptions.TargetFramework, and centralizes Roslyn parse-options creation so both reachability analysis and merging agree on active preprocessor branches. - Always strips conditional-compilation trivia from the flattened output, and derives polyfill emission from the selected target framework (suppressed for net8).
- Replaces the old
Light.GuardClauses.Sourcecompile harness with a multi-targetedLight.GuardClauses.SourceValidationproject and updates the build validator + tests accordingly.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| Light.GuardClauses.SingleFile.cs | Removes #if/#endif blocks so the committed single-file is explicitly a netstandard2.0-shaped export. |
| Code/Light.GuardClauses.SourceValidation/Light.GuardClauses.SourceValidation.csproj | Adds a new multi-targeted validation project that compiles an injected generated source file. |
| Code/Light.GuardClauses.SourceCodeTransformation/SourceTargetFramework.cs | Adds an enum to select netstandard2.0 vs net8.0 export shape. |
| Code/Light.GuardClauses.SourceCodeTransformation/SourceReachabilityAnalyzer.cs | Adds parse-options factory and threads parse options into catalog parsing for consistent branch selection. |
| Code/Light.GuardClauses.SourceCodeTransformation/SourceFileMerger.cs | Uses target-framework parse options for the merged output, always removes directives, and derives polyfill emission from target framework. |
| Code/Light.GuardClauses.SourceCodeTransformation/SourceFileMergeOptions.cs | Adds TargetFramework option and updates default target/output path heuristics. |
| Code/Light.GuardClauses.SourceCodeTransformation/settings.json | Persists TargetFramework setting (defaults to NetStandard2_0). |
| Code/Light.GuardClauses.SourceCodeTransformation/Program.cs | Passes TargetFramework into build validation and adjusts default-path application. |
| Code/Light.GuardClauses.SourceCodeTransformation/GeneratedFileBuildValidator.cs | Builds the new validation project with the selected TFM and injects the generated file path via MSBuild property. |
| Code/Light.GuardClauses.SourceCodeTransformation.Tests/TestEnvironment.cs | Adds shared test helpers for locating repo directories + temp directories. |
| Code/Light.GuardClauses.SourceCodeTransformation.Tests/SourceFileMergerWhitelistTests.cs | Updates tests to use shared environment helper and sets explicit target framework in options. |
| Code/Light.GuardClauses.SourceCodeTransformation.Tests/SourceFileMergerFrameworkTests.cs | Adds tests for net8 vs netstandard export surface, directive removal, polyfill behavior, and validation. |
| Code/Light.GuardClauses.SourceCodeTransformation.Tests/ParseCSharpFilesWithRoslynTests.cs | Uses shared environment helper instead of duplicated directory discovery. |
| Code/Light.GuardClauses.SourceCodeTransformation.Tests/GeneratedFileBuildValidatorTests.cs | Updates build validation tests to the new validation-project approach. |
| Code/Light.GuardClauses.Source/Light.GuardClauses.Source.csproj | Removes the old netstandard-only compile-check harness project. |
| Code/Light.GuardClauses.AllProjects.sln | Swaps Light.GuardClauses.Source for Light.GuardClauses.SourceValidation in the solution. |
| Code/ai-plans/0135-source-code-transformation-for-dotnet-8.md | Adds an implementation plan/traceability document for issue #135. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…pan methods more specifically Signed-off-by: Kenny Pflug <kenny.pflug@live.de>
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.
Closes #135
Source Code Transformation can now target .NET 8