Skip to content

Source Code Transformation for .NET 8#136

Merged
feO2x merged 4 commits into
devfrom
135-source-code-transformation-for-dotnet-8
Jul 2, 2026
Merged

Source Code Transformation for .NET 8#136
feO2x merged 4 commits into
devfrom
135-source-code-transformation-for-dotnet-8

Conversation

@feO2x

@feO2x feO2x commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Closes #135

Source Code Transformation can now target .NET 8

feO2x added 3 commits July 2, 2026 06:30
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>
@feO2x feO2x self-assigned this Jul 2, 2026
@feO2x feO2x linked an issue Jul 2, 2026 that may be closed by this pull request
10 tasks
@feO2x feO2x requested a review from Copilot July 2, 2026 20:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.Source compile harness with a multi-targeted Light.GuardClauses.SourceValidation project 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>
@feO2x feO2x merged commit 6e5b28c into dev Jul 2, 2026
1 check passed
@feO2x feO2x deleted the 135-source-code-transformation-for-dotnet-8 branch July 2, 2026 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Source Code Transformation for .NET 8

2 participants