Skip to content

Commit 3df1972

Browse files
Merge pull request #19 from TimeWarpEngineering/Cramer/2025-12-22/dev
feat: MSBuild variables in runfiles and CancelKeyPress event
2 parents 04e5d9e + 63615e5 commit 3df1972

40 files changed

Lines changed: 141 additions & 41 deletions
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI/CD
1+
name: CI/CD Workflow
22

33
on:
44
push:
@@ -51,9 +51,9 @@ jobs:
5151
- name: Run CI Pipeline
5252
run: |
5353
if [ "${{ github.event_name }}" == "release" ]; then
54-
dotnet run tools/dev-cli/dev.cs -- ci --api-key "${{ steps.nuget-login.outputs.NUGET_API_KEY }}"
54+
dotnet run tools/dev-cli/dev.cs -- workflow --api-key "${{ steps.nuget-login.outputs.NUGET_API_KEY }}"
5555
else
56-
dotnet run tools/dev-cli/dev.cs -- ci
56+
dotnet run tools/dev-cli/dev.cs -- workflow
5757
fi
5858
5959
- name: Upload Artifacts
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Update all runfile #:project directives to use MSBuild variables
2+
3+
## Description
4+
5+
Update all `#:project` directives in runfiles to use MSBuild variables (e.g., `$(SourceDirectory)`) instead of hardcoded relative paths. This leverages .NET 10's support for MSBuild property expansion in `#:project` directives (PR #51108).
6+
7+
## Checklist
8+
9+
### samples/ (5 files)
10+
- [x] samples/table-widget.cs (already updated)
11+
- [x] samples/hyperlink-widget.cs
12+
- [x] samples/emoji-table-widget.cs
13+
- [x] samples/rule-widget.cs
14+
- [x] samples/panel-widget.cs
15+
16+
### tests/ (23 files)
17+
- [x] tests/table-widget-01-basic.cs
18+
- [x] tests/table-widget-02-borders.cs
19+
- [x] tests/table-widget-03-styling.cs
20+
- [x] tests/table-widget-04-expand.cs
21+
- [x] tests/table-widget-05-shrink.cs
22+
- [x] tests/table-widget-06-emoji.cs
23+
- [x] tests/table-widget-07-grow.cs
24+
- [x] tests/panel-widget-01-basic.cs
25+
- [x] tests/panel-widget-02-terminal-extensions.cs
26+
- [x] tests/panel-widget-03-word-wrap.cs
27+
- [x] tests/rule-widget-01-basic.cs
28+
- [x] tests/rule-widget-02-terminal-extensions.cs
29+
- [x] tests/hyperlink-01-basic.cs
30+
- [x] tests/terminal-static-01-basic.cs
31+
- [x] tests/terminal-static-02-properties.cs
32+
- [x] tests/terminal-static-03-operations.cs
33+
- [x] tests/terminal-static-04-format.cs
34+
- [x] tests/terminal-static-05-widgets.cs
35+
- [x] tests/terminal-static-06-color.cs
36+
- [x] tests/ansi-string-utils-01-basic.cs
37+
- [x] tests/ansi-string-utils-02-wrap-text.cs
38+
- [x] tests/ansi-string-utils-03-emoji-width.cs
39+
- [x] tests/unicode-width-01-basic.cs
40+
41+
### Verification
42+
- [x] Run all updated runfiles to verify they work
43+
- [x] Commit changes
44+
45+
## Notes
46+
47+
### MSBuild Variable Support
48+
49+
.NET 10.0.201 supports MSBuild variable expansion in `#:project` directives (merged in PR #51108). The `Directory.Build.props` imports `msbuild/repository.props` which defines:
50+
51+
- `$(SourceDirectory)` = `$(RepositoryRoot)source/`
52+
- `$(TestsDirectory)` = `$(RepositoryRoot)tests/`
53+
- `$(SamplesDirectory)` = `$(RepositoryRoot)samples/`
54+
55+
### Change Pattern
56+
57+
Replace:
58+
```csharp
59+
#:project ../source/timewarp-terminal/timewarp-terminal.csproj
60+
```
61+
62+
With:
63+
```csharp
64+
#:project $(SourceDirectory)timewarp-terminal/timewarp-terminal.csproj
65+
```
66+
67+
### Benefits
68+
69+
1. **Consistency** - All runfiles use the same path resolution mechanism
70+
2. **Maintainability** - If project structure changes, only `repository.props` needs updating
71+
3. **Clarity** - Intent is clearer (`SourceDirectory` vs `../source`)
72+
73+
## Results
74+
75+
Successfully updated all 28 runfiles to use MSBuild variables in `#:project` directives.
76+
77+
### Files Changed
78+
- 5 files in `samples/`: table-widget.cs, hyperlink-widget.cs, emoji-table-widget.cs, rule-widget.cs, panel-widget.cs
79+
- 23 files in `tests/`: all test runfiles
80+
81+
### Change Made
82+
Replaced: `#:project ../source/timewarp-terminal/timewarp-terminal.csproj`
83+
With: `#:project $(SourceDirectory)timewarp-terminal/timewarp-terminal.csproj`
84+
85+
### Verification
86+
- Ran multiple runfiles to verify they execute correctly
87+
- All tests pass with the new variable-based paths
88+
89+
### Commits
90+
- `refactor: use MSBuild variables in all runfile #:project directives` (9ae34e9)

msbuild/repository.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<TestsDirectory>$(RepositoryRoot)tests/</TestsDirectory>
99
<SamplesDirectory>$(RepositoryRoot)samples/</SamplesDirectory>
1010
<BenchmarksDirectory>$(RepositoryRoot)benchmarks/</BenchmarksDirectory>
11-
<ScriptsDirectory>$(RepositoryRoot)scripts/</ScriptsDirectory>
11+
<ToolsDirectory>$(RepositoryRoot)tools/</ToolsDirectory>
1212
<ArtifactsDirectory>$(RepositoryRoot)artifacts/</ArtifactsDirectory>
1313
<PackagesDirectory>$(ArtifactsDirectory)packages/</PackagesDirectory>
1414
</PropertyGroup>

samples/emoji-table-widget.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/dotnet --
2-
#:project ../source/timewarp-terminal/timewarp-terminal.csproj
2+
#:project $(SourceDirectory)timewarp-terminal/timewarp-terminal.csproj
33

44
// Demonstrates emoji and wide character alignment in table/panel/rule borders
55
using TimeWarp.Terminal;

samples/hyperlink-widget.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/dotnet --
22
// hyperlink-widget-demo - Demonstrates OSC 8 hyperlinks in terminal output
33
// GitHub Issue: https://github.com/TimeWarpEngineering/timewarp-terminal/issues/95
4-
#:project ../source/timewarp-terminal/timewarp-terminal.csproj
4+
#:project $(SourceDirectory)timewarp-terminal/timewarp-terminal.csproj
55

66
using TimeWarp.Terminal;
77

@@ -74,6 +74,16 @@
7474
.Padding(2, 1))
7575
.WriteLine();
7676

77+
// 7b. Hyperlink inside a table row
78+
terminal
79+
.WriteLine("7b. Hyperlink in a table row:")
80+
.WriteLine()
81+
.WriteTable(table => table
82+
.AddColumn("Name")
83+
.AddColumn("Link")
84+
.AddRow("TimeWarp", "Website".Link("https://timewarp.software").Cyan()))
85+
.WriteLine();
86+
7787
// 8. Conditional hyperlinks
7888
terminal.WriteLine("8. Graceful degradation:");
7989
if (terminal.SupportsHyperlinks)

samples/panel-widget.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/dotnet --
22
// panel-widget-demo - Demonstrates the Panel widget for bordered boxes
33
// GitHub Issue: https://github.com/TimeWarpEngineering/timewarp-terminal/issues/90
4-
#:project ../source/timewarp-terminal/timewarp-terminal.csproj
4+
#:project $(SourceDirectory)timewarp-terminal/timewarp-terminal.csproj
55

66
using TimeWarp.Terminal;
77

samples/rule-widget.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/dotnet --
22
// rule-widget-demo - Demonstrates the Rule widget for horizontal divider lines
33
// GitHub Issue: https://github.com/TimeWarpEngineering/timewarp-terminal/issues/89
4-
#:project ../source/timewarp-terminal/timewarp-terminal.csproj
4+
#:project $(SourceDirectory)timewarp-terminal/timewarp-terminal.csproj
55

66
using TimeWarp.Terminal;
77

samples/table-widget.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/dotnet --
2-
#:project ../source/timewarp-terminal/timewarp-terminal.csproj
2+
#:project $(SourceDirectory)timewarp-terminal/timewarp-terminal.csproj
33

44
// Demonstrates the Table widget for rendering columnar data
55
using TimeWarp.Terminal;

source/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<!-- Default package metadata (can be overridden in individual projects) -->
66
<PropertyGroup Label="Package Metadata">
7-
<Version>1.0.0-beta.7</Version>
7+
<Version>1.0.0-beta.8</Version>
88
<Authors>Steven T. Cramer</Authors>
99
<RepositoryUrl>https://github.com/TimeWarpEngineering/timewarp-terminal</RepositoryUrl>
1010
<PackageLicenseExpression>Unlicense</PackageLicenseExpression>

tests/ansi-string-utils-01-basic.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/dotnet --
2-
#:project ../source/timewarp-terminal/timewarp-terminal.csproj
2+
#:project $(SourceDirectory)timewarp-terminal/timewarp-terminal.csproj
33

44
// Test AnsiStringUtils functionality
55

0 commit comments

Comments
 (0)