Skip to content

Commit a048ad8

Browse files
committed
删除不再使用的内部源生成器
1 parent a9f4669 commit a048ad8

File tree

6 files changed

+52
-83
lines changed

6 files changed

+52
-83
lines changed

DotNetCampus.CommandLine.sln

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotNetCampus.CommandLine.Sa
2727
EndProject
2828
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNetCampus.CommandLine", "src\DotNetCampus.CommandLine\DotNetCampus.CommandLine.csproj", "{B61424A0-02C5-4C24-819B-8153D52BC0B8}"
2929
EndProject
30-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dotnetCampus.CommandLine.PrivateAnalyzer", "src\dotnetCampus.CommandLine.PrivateAnalyzer\dotnetCampus.CommandLine.PrivateAnalyzer.csproj", "{4EECE03C-5989-498B-BFF4-7CF9B1E90337}"
31-
EndProject
3230
Global
3331
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3432
Debug|Any CPU = Debug|Any CPU
@@ -77,14 +75,6 @@ Global
7775
{B61424A0-02C5-4C24-819B-8153D52BC0B8}.Release|Any CPU.Build.0 = Release|Any CPU
7876
{B61424A0-02C5-4C24-819B-8153D52BC0B8}.Release|x86.ActiveCfg = Release|Any CPU
7977
{B61424A0-02C5-4C24-819B-8153D52BC0B8}.Release|x86.Build.0 = Release|Any CPU
80-
{4EECE03C-5989-498B-BFF4-7CF9B1E90337}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
81-
{4EECE03C-5989-498B-BFF4-7CF9B1E90337}.Debug|Any CPU.Build.0 = Debug|Any CPU
82-
{4EECE03C-5989-498B-BFF4-7CF9B1E90337}.Debug|x86.ActiveCfg = Debug|Any CPU
83-
{4EECE03C-5989-498B-BFF4-7CF9B1E90337}.Debug|x86.Build.0 = Debug|Any CPU
84-
{4EECE03C-5989-498B-BFF4-7CF9B1E90337}.Release|Any CPU.ActiveCfg = Release|Any CPU
85-
{4EECE03C-5989-498B-BFF4-7CF9B1E90337}.Release|Any CPU.Build.0 = Release|Any CPU
86-
{4EECE03C-5989-498B-BFF4-7CF9B1E90337}.Release|x86.ActiveCfg = Release|Any CPU
87-
{4EECE03C-5989-498B-BFF4-7CF9B1E90337}.Release|x86.Build.0 = Release|Any CPU
8878
EndGlobalSection
8979
GlobalSection(SolutionProperties) = preSolution
9080
HideSolutionNode = FALSE

samples/DotNetCampus.CommandLine.Sample/Program.cs

Lines changed: 52 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using System.Diagnostics;
1+
#define Benchmark
2+
using System.Data.Common;
3+
using System.Diagnostics;
24
using DotNetCampus.Cli.Compiler;
35
using DotNetCampus.Cli.Tests.Fakes;
46

@@ -8,6 +10,26 @@ class Program
810
{
911
static void Main(string[] args)
1012
{
13+
#if Benchmark
14+
var stopwatch = Stopwatch.StartNew();
15+
if (args.Length is 0)
16+
{
17+
}
18+
else if (args[0] == "3.x-parser")
19+
{
20+
Run3xParser(args);
21+
}
22+
else if (args[0] == "3.x-runtime")
23+
{
24+
Run3xRuntime(args);
25+
}
26+
else if (args[0] == "4.x")
27+
{
28+
Run4x(args);
29+
}
30+
stopwatch.Stop();
31+
Console.WriteLine($"[# Elapsed: {stopwatch.Elapsed.TotalMicroseconds} us #]");
32+
#else
1133
const int testCount = 1000000;
1234
CommandLineParsingOptions parsingOptions = CommandLineParsingOptions.DotNet;
1335

@@ -65,30 +87,41 @@ static void Main(string[] args)
6587
}
6688
stopwatch.Stop();
6789
Console.WriteLine($"{stopwatch.ElapsedMilliseconds.ToString(),7} ms | {stopwatch.ElapsedMilliseconds.ToString(),8} ms |");
90+
#endif
6891
}
6992

70-
private static int Run(Options options)
93+
private static void Run3xParser(string[] args)
7194
{
72-
return 0;
95+
_ = dotnetCampus.Cli.CommandLine.Parse(args).As(new OptionsParser());
7396
}
74-
}
75-
76-
[CollectCommandHandlersFromThisAssembly]
77-
internal partial class AssemblyCommandHandler;
78-
79-
[Verb("sample")]
80-
internal class SampleCommandHandler : ICommandHandler
81-
{
82-
[Option("SampleProperty")]
83-
public required string Option { get; init; }
8497

85-
[Value(Length = int.MaxValue)]
86-
public string? Argument { get; init; }
98+
private static void Run3xRuntime(string[] args)
99+
{
100+
_ = dotnetCampus.Cli.CommandLine.Parse(args).As<Options>();
101+
}
87102

88-
public Task<int> RunAsync()
103+
private static void Run4x(string[] args)
89104
{
90-
Console.WriteLine($"Option: {Option}");
91-
Console.WriteLine($"Argument: {Argument}");
92-
return Task.FromResult(0);
105+
_ = CommandLine.Parse(args, CommandLineParsingOptions.DotNet).As<Options>();
93106
}
94107
}
108+
109+
// [CollectCommandHandlersFromThisAssembly]
110+
// internal partial class AssemblyCommandHandler;
111+
112+
// [Verb("sample")]
113+
// internal class SampleCommandHandler : ICommandHandler
114+
// {
115+
// [Option("SampleProperty")]
116+
// public required string Option { get; init; }
117+
//
118+
// [Value(Length = int.MaxValue)]
119+
// public string? Argument { get; init; }
120+
//
121+
// public Task<int> RunAsync()
122+
// {
123+
// Console.WriteLine($"Option: {Option}");
124+
// Console.WriteLine($"Argument: {Argument}");
125+
// return Task.FromResult(0);
126+
// }
127+
// }

src/DotNetCampus.CommandLine/DotNetCampus.CommandLine.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@
2525
</PackageReference>
2626
<PackageReference Condition="'$(TargetFramework)' == 'net6.0'" Include="System.Collections.Immutable" Version="8.0.0" />
2727
</ItemGroup>
28-
29-
<ItemGroup>
30-
<ProjectReference Include="..\..\src\DotNetCampus.CommandLine.PrivateAnalyzer\DotNetCampus.CommandLine.PrivateAnalyzer.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
31-
</ItemGroup>
3228

3329
<Target Name="_IncludeAllDependencies" BeforeTargets="_GetPackageFiles">
3430
<ItemGroup>

src/dotnetCampus.CommandLine.PrivateAnalyzer/Generators/ArgumentValueConverterGenerator.cs

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

src/dotnetCampus.CommandLine.PrivateAnalyzer/Properties/launchSettings.json

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

src/dotnetCampus.CommandLine.PrivateAnalyzer/dotnetCampus.CommandLine.PrivateAnalyzer.csproj

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

0 commit comments

Comments
 (0)