Skip to content

Commit 773a61a

Browse files
authored
Merge pull request #42 from randlee/feature/multi-tfm-support
feat: Multi-TFM Support - Complete & Ready for Review
2 parents e6b96a4 + 041fbac commit 773a61a

34 files changed

+13787
-18
lines changed

CHANGELOG.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,49 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
- Git integration (compare commits, branches)
1414
- F# support via FSharp.Compiler.Service
1515

16+
## [0.9.0] - 2026-01-20
17+
18+
### Added
19+
20+
#### Multi-Target Framework (Multi-TFM) Support
21+
- **Target Framework Analysis** - Analyze code differences across multiple .NET target frameworks simultaneously
22+
- **TFM-Specific Change Detection** - Identify which changes apply to specific target frameworks vs. all frameworks
23+
- **Conditional Compilation Awareness** - Properly handles `#if` directives and framework-specific code
24+
- **Per-TFM Semantic Analysis** - Runs full Roslyn analysis for each target framework with correct compilation symbols
25+
26+
#### CLI Enhancements
27+
- `--target-framework` / `-t` - Specify one or more target frameworks for analysis (can be repeated)
28+
- `-T` / `--target-frameworks` - Specify semicolon-separated list of target frameworks (e.g., "net8.0;net10.0")
29+
- TFM validation with helpful error messages for invalid framework identifiers
30+
- Support for common TFM formats: `net8.0`, `net10.0`, `netcoreapp3.1`, `netstandard2.0`, `net462`, etc.
31+
32+
#### Output Format Enhancements
33+
- **JSON Output** - Added `targetFrameworks` array in metadata and `applicableToTfms` per change
34+
- **HTML Output** - Displays target frameworks in summary and annotates TFM-specific changes
35+
- **Text/Plain Output** - Shows TFM annotations like `[.NET 8.0]` for framework-specific changes
36+
- **Terminal Output** - Rich display of multi-framework analysis results
37+
38+
#### Architecture Improvements
39+
- `TfmResultMerger` - Intelligent merging of per-TFM analysis results
40+
- `TfmChangeCorrelator` - Correlates changes across TFMs to identify commonalities
41+
- Enhanced `DiffResult` model with `TargetFrameworks` and per-change `ApplicableToTfms`
42+
- Optimized multi-TFM analysis with parallel processing
43+
44+
#### Documentation
45+
- Comprehensive TFM support guide (`docs/tfm-support.md`)
46+
- Sample files demonstrating conditional compilation scenarios
47+
- Usage examples for single and multiple framework analysis
48+
49+
### Changed
50+
- Enhanced `DiffOptions` with `TargetFrameworks` property
51+
- Updated all output formatters to handle TFM metadata
52+
- Improved error messages for TFM-related validation failures
53+
54+
### Performance
55+
- Multi-TFM overhead is minimal (~2-2.5x for 3 frameworks vs. single framework)
56+
- Parallel TFM processing where possible
57+
- Efficient change correlation algorithms
58+
1659
## [0.5.0] - 2026-01-15
1760

1861
### Added

README.md

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,19 @@ Fine-grained whitespace handling with language-aware detection:
4545

4646
See [Whitespace Handling Guide](docs/whitespace-handling.md) for comprehensive details.
4747

48+
### Multi-Target Framework Analysis (v0.9.0) 🎯
49+
50+
Analyze code changes across multiple .NET target frameworks simultaneously:
51+
52+
- **Multi-TFM diff support**: Compare code compiled for different target frameworks (net8.0, net10.0, etc.)
53+
- **Conditional compilation detection**: Identifies changes within `#if`, `#elif`, preprocessor blocks
54+
- **Symbol resolution**: Automatically resolves TFM-specific symbols (NET8_0, NET10_0_OR_GREATER, etc.)
55+
- **TFM-specific change tracking**: Each change indicates which frameworks it applies to
56+
- **Performance optimized**: Pre-scan detects preprocessor directives, skips multi-TFM analysis when not needed
57+
- **Parallel processing**: Analyzes multiple TFMs concurrently for faster results
58+
59+
See [Multi-TFM Support Guide](docs/tfm-support.md) for comprehensive details.
60+
4861
### Core Features
4962

5063
- **Semantic Diff** - Understands code structure, not just text changes
@@ -115,6 +128,25 @@ roslyn-diff diff old.cs new.cs --html report.html --open
115128
roslyn-diff diff old.cs new.cs --git
116129
```
117130

131+
### Multi-Target Framework Analysis
132+
133+
```bash
134+
# Analyze for a single target framework
135+
roslyn-diff diff old.cs new.cs -t net8.0
136+
137+
# Analyze multiple target frameworks (repeatable flag)
138+
roslyn-diff diff old.cs new.cs -t net8.0 -t net10.0
139+
140+
# Analyze multiple TFMs (semicolon-separated)
141+
roslyn-diff diff old.cs new.cs -T "net8.0;net10.0"
142+
143+
# Multi-TFM with JSON output
144+
roslyn-diff diff old.cs new.cs -t net8.0 -t net10.0 --json
145+
146+
# Multi-TFM with HTML report
147+
roslyn-diff diff old.cs new.cs -T "net8.0;net9.0;net10.0" --html report.html --open
148+
```
149+
118150
### Compare Specific Classes
119151

120152
```bash
@@ -175,6 +207,12 @@ roslyn-diff diff <old-file> <new-file> [options]
175207
| `--whitespace-mode <mode>` | | Whitespace handling: `exact`, `ignore-leading-trailing`, `ignore-all`, `language-aware` | `exact` |
176208
| `--ignore-whitespace` | `-w` | Shortcut for `--whitespace-mode ignore-all` | `false` |
177209

210+
**Multi-TFM Options (v0.9.0):**
211+
| Option | Short | Description | Default |
212+
|--------|-------|-------------|---------|
213+
| `--target-framework <tfm>` | `-t` | Target framework moniker (repeatable: `-t net8.0 -t net10.0`) | `null` (NET10_0 assumed) |
214+
| `--target-frameworks <tfms>` | `-T` | Semicolon-separated TFMs (e.g., `"net8.0;net10.0"`) | `null` |
215+
178216
**Diff Mode Options:**
179217
| Option | Short | Description | Default |
180218
|--------|-------|-------------|---------|
@@ -246,11 +284,13 @@ roslyn-diff diff old.cs new.cs --json analysis.json
246284
{
247285
"$schema": "roslyn-diff-output-v2",
248286
"metadata": {
249-
"version": "0.8.0",
287+
"version": "0.9.0",
250288
"timestamp": "2026-01-19T22:45:12Z",
251289
"mode": "roslyn",
290+
"analyzedTfms": ["net8.0", "net10.0"],
252291
"options": {
253-
"includeNonImpactful": false
292+
"includeNonImpactful": false,
293+
"targetFrameworks": ["net8.0", "net10.0"]
254294
}
255295
},
256296
"summary": {
@@ -272,6 +312,7 @@ roslyn-diff diff old.cs new.cs --json analysis.json
272312
"name": "Process",
273313
"impact": "breakingPublicApi",
274314
"visibility": "public",
315+
"applicableToTfms": ["net8.0", "net10.0"],
275316
"caveats": ["Parameter rename may break callers using named arguments"]
276317
}]
277318
}]
@@ -284,6 +325,7 @@ See [Output Formats Guide](docs/output-formats.md) for complete schema documenta
284325

285326
Interactive HTML report with:
286327
- **Impact classification badges** - Color-coded indicators (Breaking Public API, Breaking Internal API, Non-Breaking, Formatting Only)
328+
- **TFM badges** - Framework-specific indicators (net8.0, net10.0) showing which TFMs each change applies to
287329
- **Caveat warnings** - Yellow warning boxes for edge cases (e.g., "Parameter rename may break named arguments")
288330
- **Whitespace issue indicators** - Warnings for indentation changes, mixed tabs/spaces, etc.
289331
- Side-by-side diff view with syntax highlighting
@@ -313,13 +355,14 @@ roslyn-diff diff old.cs new.cs --text
313355
```
314356
Diff: old.cs -> new.cs
315357
Mode: Roslyn (semantic)
358+
Target Frameworks: net8.0, net10.0
316359
317360
Summary: +2 (2 total changes)
318361
319362
Changes:
320363
File: new.cs
321-
[+] Method: Multiply (line 5-8)
322-
[+] Method: Divide (line 10-13)
364+
[+] Method: Multiply (line 5-8) [net8.0, net10.0]
365+
[+] Method: Divide (line 10-13) [net8.0, net10.0]
323366
```
324367

325368
### Git Unified Diff (`--git`)
@@ -525,6 +568,7 @@ See the [Synaptic Canvas documentation](https://github.com/randlee/synaptic-canv
525568

526569
- **[Impact Classification Guide](docs/impact-classification.md)** - Complete guide to impact levels, filtering, caveats, and use cases (v0.7.0)
527570
- **[Whitespace Handling Guide](docs/whitespace-handling.md)** - Whitespace modes, language-aware detection, and best practices (v0.8.0)
571+
- **[Multi-TFM Support Guide](docs/tfm-support.md)** - Multi-target framework analysis, conditional compilation detection, and advanced scenarios (v0.9.0)
528572
- [Output Formats](docs/output-formats.md) - Format specifications, JSON Schema v2, and feature comparison
529573
- [Sample Outputs](samples/README.md) - Example diffs with impact classification
530574

0 commit comments

Comments
 (0)