Skip to content

Commit 8bbc770

Browse files
authored
Add support for System.CommandLine (#300)
* Add support for System.CommandLine * Updated support for console apps. NOTE: System.CommandLine is still in preview but is likely to "go live" along with .NET 10 which is soon enough. This repo will remain in preview until .NET 10 is released and then support .NET8.0 and .NET10.0 as LTSC variants. * Updated DOCFX build support * Included the CommandLine project * Removed use of `extension` keyword as DOCFX is ignoing the langversion and SDK settings for the build to do "it's own thing" (Been a problem for a long while now...) [TODO: write a custom metadata generator tool that can generate the metadata without the cruft of DOCFX] * Removed obsolete script `Build-Native.ps1`
1 parent 2927bce commit 8bbc770

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2167
-233
lines changed

Build-Native.ps1

Lines changed: 0 additions & 124 deletions
This file was deleted.

Directory.Packages.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
<PackageVersion Include="Microsoft.CodeAnalysis.VisualBasic.Features" Version="4.14.0" />
2727
<PackageVersion Include="Basic.Reference.Assemblies.Net80" Version="1.8.2" />
2828
<PackageVersion Include="PolySharp" Version="1.15.0" />
29+
<PackageVersion Include="System.Buffers" Version="4.6.1" />
2930
<PackageVersion Include="System.Collections.Immutable" Version="9.0.8" />
31+
<PackageVersion Include="System.CommandLine" Version="2.0.0-beta7.25380.108" />
3032
<PackageVersion Include="System.IO.Hashing" Version="9.0.8" />
3133
<!-- Workaround(2): https://github.com/dotnet/roslyn-sdk/issues/1191 -->
3234
<PackageVersion Include="System.Formats.Asn1" Version="9.0.7" />

IgnoredWords.dic

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Enums
5858
env
5959
exe
6060
facepalm
61+
fallback
6162
finalizer
6263
finalizers
6364
foo
@@ -74,6 +75,7 @@ inline
7475
inlined
7576
inlining
7677
Interop
78+
ints
7779
jit
7880
len
7981
Lexer
@@ -105,6 +107,8 @@ pages
105107
paren
106108
perf
107109
pointee
110+
polyfills
111+
pragma
108112
pragmas
109113
Pre
110114
proj
@@ -149,6 +153,7 @@ userdefinedop
149153
Users
150154
usings
151155
utils
156+
validator
152157
varargs
153158
variadic
154159
vcxproj

docfx/CommandLine/api/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# About
2+
Ubiquity.NET.CommandLines contains general extensions for .NET. to support command line
3+
parsing using `System.CommandLine`

docfx/CommandLine/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# About
2+
Ubiquity.NET.CommandLines contains general extensions for .NET. to support command line
3+
parsing using `System.CommandLine`

docfx/CommandLine/toc.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# TOC (Left nav) for the 'extensions' folder
2+
- name: Overview
3+
href: index.md
4+
- name: Namespaces
5+
href: api/toc.yml

docfx/docfx.json

Lines changed: 52 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,45 @@
44
// [Sigh] - docfx tooling will process and report warnings etc.. on projects found BEFORE it
55
// deals with the exclusion list so a simple glob for all csproj files doesn't work. It creates
66
// warnings and returns a non-success value which stops the build.
7+
// Each project is listed in the order they appear in the VS solution explorer so they are easier
8+
// to find and check etc...
79
{
8-
// LLVM OO Wrappers library
10+
// Interop helpers library
911
"memberLayout":"separatePages",
1012
"namespaceLayout":"nested",
1113
"src": [
1214
{
13-
"src": "../src/Ubiquity.NET.Llvm",
15+
"src": "../src/Ubiquity.NET.InteropHelpers",
1416
"files": ["**.csproj"]
1517
}
1618
],
17-
"dest": "llvm/api"
19+
"dest": "interop-helpers/api"
1820
},
21+
// NOTE: Ubiquity.NET.Llvm.Interop is intentionally NOT documented (It's considered an implementation detail)
22+
// NOTE: Sample projects are not generating docs, they are... samples 8^)
1923
{
20-
// Runtime utilities library
24+
// ANTLR Utilities library
2125
"memberLayout":"separatePages",
2226
"namespaceLayout":"nested",
2327
"src": [
2428
{
25-
"src": "../src/Ubiquity.NET.Runtime.Utils",
29+
"src": "../src/Ubiquity.NET.ANTLR.Utils",
2630
"files": ["**.csproj"]
2731
}
2832
],
29-
"dest": "runtime-utils/api"
33+
"dest": "antlr-utils/api"
34+
},
35+
{
36+
// ANTLR Utilities library
37+
"memberLayout":"separatePages",
38+
"namespaceLayout":"nested",
39+
"src": [
40+
{
41+
"src": "../src/Ubiquity.NET.CommandLine",
42+
"files": ["**.csproj"]
43+
}
44+
],
45+
"dest": "CommandLine/api"
3046
},
3147
{
3248
// Extensions library
@@ -41,28 +57,28 @@
4157
"dest": "extensions/api"
4258
},
4359
{
44-
// ANTLR Utilities library
60+
// LLVM OO Wrappers library
4561
"memberLayout":"separatePages",
4662
"namespaceLayout":"nested",
4763
"src": [
4864
{
49-
"src": "../src/Ubiquity.NET.ANTLR.Utils",
65+
"src": "../src/Ubiquity.NET.Llvm",
5066
"files": ["**.csproj"]
5167
}
5268
],
53-
"dest": "antlr-utils/api"
69+
"dest": "llvm/api"
5470
},
5571
{
56-
// Interop helpers library
72+
// Runtime utilities library
5773
"memberLayout":"separatePages",
5874
"namespaceLayout":"nested",
5975
"src": [
6076
{
61-
"src": "../src/Ubiquity.NET.InteropHelpers",
77+
"src": "../src/Ubiquity.NET.Runtime.Utils",
6278
"files": ["**.csproj"]
6379
}
6480
],
65-
"dest": "interop-helpers/api"
81+
"dest": "runtime-utils/api"
6682
},
6783
{
6884
// TextUX library
@@ -74,7 +90,10 @@
7490
"files": ["**.csproj"]
7591
}
7692
],
77-
"dest": "TextUX/api"
93+
"dest": "TextUX/api",
94+
"properties": {
95+
"DefineConstants": "DOCFX_BUILD"
96+
}
7897
}
7998
],
8099
"build": {
@@ -93,9 +112,9 @@
93112
]
94113
},
95114
{
96-
// LLVM project additional content, Includes the generated metadata API folder
115+
// InteropHelpers project additional content, Includes the generated metadata API folder
97116
"files": [
98-
"llvm/**.{md,yml}"
117+
"interop-helpers/**.{md,yml}"
99118
],
100119
// Exclude the namespace overwrites and XREF maps as they are listed explicitly elsewhere
101120
"exclude": [
@@ -123,10 +142,20 @@
123142
]
124143
},
125144
{
126-
// Runtime Utils project additional content, Includes the generated metadata API folder
127-
// NOTE: File paths are relative to the location of this file
145+
// ANTLR Utils project additional content, Includes the generated metadata API folder
128146
"files": [
129-
"runtime-utils/**.{md,yml}"
147+
"antlr-utils/**.{md,yml}"
148+
],
149+
// Exclude the namespace overwrites and XREF maps as they are listed explicitly elsewhere
150+
"exclude": [
151+
"**/namespaces/**.md",
152+
"**/*-xref.yml"
153+
]
154+
},
155+
{
156+
// CommandLine Utils project additional content, Includes the generated metadata API folder
157+
"files": [
158+
"CommandLine/**.{md,yml}"
130159
],
131160
// Exclude the namespace overwrites and XREF maps as they are listed explicitly elsewhere
132161
"exclude": [
@@ -146,9 +175,9 @@
146175
]
147176
},
148177
{
149-
// ANTLR Utils project additional content, Includes the generated metadata API folder
178+
// LLVM project additional content, Includes the generated metadata API folder
150179
"files": [
151-
"antlr-utils/**.{md,yml}"
180+
"llvm/**.{md,yml}"
152181
],
153182
// Exclude the namespace overwrites and XREF maps as they are listed explicitly elsewhere
154183
"exclude": [
@@ -157,9 +186,10 @@
157186
]
158187
},
159188
{
160-
// InteropHelpers project additional content, Includes the generated metadata API folder
189+
// Runtime Utils project additional content, Includes the generated metadata API folder
190+
// NOTE: File paths are relative to the location of this file
161191
"files": [
162-
"interop-helpers/**.{md,yml}"
192+
"runtime-utils/**.{md,yml}"
163193
],
164194
// Exclude the namespace overwrites and XREF maps as they are listed explicitly elsewhere
165195
"exclude": [

docfx/documentation.msbuildproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@
6161
<!-- Explicitly call out the non-generated files in the API folder-->
6262
<None Include="TextUX/api/index.md" />
6363
</ItemGroup>
64+
<ItemGroup>
65+
<!--Everything in the CommandLine sub-folders except the API folder as that contains generated files -->
66+
<None Include="CommandLine/**" Exclude="CommandLine/api/**" />
67+
<!-- Explicitly call out the non-generated files in the API folder-->
68+
<None Include="CommandLine/api/index.md" />
69+
</ItemGroup>
70+
6471
<Target Name="AlwaysRun" BeforeTargets="AfterBuild">
6572
<Message Importance="High" Text="NOTE: Building $(MSBuildProjectFile) does NOTHING, docs are built using the docfx tool. This project is simply a convenient placeholder for organizing/editing files" />
6673
</Target>

docfx/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ included.
1515
| [Ubiquity.NET.Extensions](extensions/index.md) | This library contains general extensions and helpers for many scenarios using .NET |
1616
| [Ubiquity.NET.Antlr.Utils](antlr-utils/index.md) | This library contains extensions and helpers for using ANTLR with .NET |
1717
| [Ubiquity.NET.TextUX](TextUX/index.md) | This library contains extensions and helpers for Text User eXperience (UX) applications (console) |
18+
| [Ubiquity.NET.CommandLine](CommandLine/index.md) | This library contains extensions and helpers for command line parsing via `System.CommandLine` |
1819
| [Ubiquity.NET.InteropHelpers](interop-helpers/index.md) | This library contains extensions and helpers for implementing interop support for native libraries |

docfx/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@
2121
href: TextUX/index.md
2222
- name: Interop Helpers
2323
href: interop-helpers/index.md
24+
- name: CommandLine Parsing
25+
href: CommandLine/index.md

0 commit comments

Comments
 (0)