Skip to content

Commit 9ebb5ea

Browse files
authored
Rewrite of the parser (#85)
The commands are now async Introduce a new ICommandTypeProvider that is based on lambda Use Azure Pipelines to build the libraries Add documentation via DocFx
1 parent dbc79de commit 9ebb5ea

File tree

184 files changed

+3340
-2176
lines changed

Some content is hidden

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

184 files changed

+3340
-2176
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,4 +186,5 @@ FakesAssemblies/
186186

187187
.vs/
188188
artifacts/
189-
src/CommonFiles/VersionAssemblyInfo.cs
189+
src/CommonFiles/VersionAssemblyInfo.cs
190+
_BuildReports/

.vscode/launch.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
// Use IntelliSense to find out which attributes exist for C# debugging
3+
// Use hover for the description of the existing attributes
4+
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": ".NET Core Launch (console)",
9+
"type": "coreclr",
10+
"request": "launch",
11+
"preLaunchTask": "build",
12+
// If you have changed target frameworks, make sure to update the program path.
13+
"program": "${workspaceFolder}/tests/MGR.CommandLineParser.IntegrationTests/bin/Debug/netcoreapp2.0/MGR.CommandLineParser.IntegrationTests.dll",
14+
"args": [],
15+
"cwd": "${workspaceFolder}/tests/MGR.CommandLineParser.IntegrationTests",
16+
// For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window
17+
"console": "internalConsole",
18+
"stopAtEntry": false,
19+
"internalConsoleOptions": "openOnSessionStart"
20+
},
21+
{
22+
"name": ".NET Core Attach",
23+
"type": "coreclr",
24+
"request": "attach",
25+
"processId": "${command:pickProcess}"
26+
}
27+
,]
28+
}

.vscode/tasks.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "build",
6+
"command": "dotnet",
7+
"type": "process",
8+
"args": [
9+
"build",
10+
"${workspaceFolder}/tests/MGR.CommandLineParser.IntegrationTests/MGR.CommandLineParser.IntegrationTests.csproj"
11+
],
12+
"problemMatcher": "$msCompile"
13+
}
14+
]
15+
}

Directory.Build.props

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<Project>
2+
<PropertyGroup>
3+
<Product>MGR.CommandLineParser</Product>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
<DocumentationFile>bin\$(Configuration)\netstandard2.0\$(MSBuildProjectName).xml</DocumentationFile>
6+
<LangVersion>latest</LangVersion>
7+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
8+
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
9+
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
10+
<WarningsAsErrors />
11+
<DebugType>portable</DebugType>
12+
<IsPackable>true</IsPackable>
13+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
14+
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)$(Product).ruleset</CodeAnalysisRuleSet>
15+
16+
<Authors>Matthias GROSPERRIN</Authors>
17+
<Company></Company>
18+
<PackageProjectUrl>https://github.com/mgrosperrin/commandlineparser</PackageProjectUrl>
19+
<RepositoryUrl>https://github.com/mgrosperrin/commandlineparser</RepositoryUrl>
20+
<Description>MGR.CommandLineParser is a multi-command line parser. It uses System.ComponentModel.DataAnnotations to declare the commands.</Description>
21+
<RepositoryType>git</RepositoryType>
22+
<Copyright>Copyright © Matthias GROSPERRIN</Copyright>
23+
<NeutralLanguage>en-US</NeutralLanguage>
24+
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
25+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
26+
</PropertyGroup>
27+
28+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
29+
<Optimize>true</Optimize>
30+
</PropertyGroup>
31+
32+
</Project>

GitVersionConfig.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
branches:
2+
develop:
3+
tag: alpha

MGR.CommandLineParser.sln

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,18 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MGR.CommandLineParser.Integ
1515
EndProject
1616
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleApp", "samples\SimpleApp\SimpleApp.csproj", "{F192F36D-7EDD-4E1E-82A4-95CA11665D2B}"
1717
EndProject
18-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "CommonFiles", "CommonFiles", "{B5BDC6B3-1206-4DF3-A76C-22FE55064082}"
18+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SharedFiles", "SharedFiles", "{B5BDC6B3-1206-4DF3-A76C-22FE55064082}"
1919
ProjectSection(SolutionItems) = preProject
20-
src\CommonFiles\CommonAssemblyInfo.cs = src\CommonFiles\CommonAssemblyInfo.cs
21-
src\CommonFiles\VersionAssemblyInfo.cs = src\CommonFiles\VersionAssemblyInfo.cs
20+
src\SharedFiles\CommonAssemblyInfo.cs = src\SharedFiles\CommonAssemblyInfo.cs
21+
src\SharedFiles\VersionAssemblyInfo.cs = src\SharedFiles\VersionAssemblyInfo.cs
2222
EndProjectSection
2323
EndProject
2424
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{EF849FD3-293F-4CC8-B227-9680CF929A66}"
2525
ProjectSection(SolutionItems) = preProject
2626
.editorconfig = .editorconfig
2727
.gitattributes = .gitattributes
2828
.gitignore = .gitignore
29+
Directory.Build.props = Directory.Build.props
2930
LICENSE = LICENSE
3031
MGR.CommandLineParser.ruleset = MGR.CommandLineParser.ruleset
3132
MGR.CommandLineParser.runsettings = MGR.CommandLineParser.runsettings
@@ -35,8 +36,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
3536
EndProject
3637
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{07E4D8F7-2EDA-460D-B8E0-58B1BA42CD46}"
3738
ProjectSection(SolutionItems) = preProject
39+
azure-pipeline-build.yaml = azure-pipeline-build.yaml
3840
build\build.cake = build\build.cake
3941
build.ps1 = build.ps1
42+
GitVersionConfig.yaml = GitVersionConfig.yaml
4043
EndProjectSection
4144
EndProject
4245
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MGR.CommandLineParser.Tests.Commands", "tests\MGR.CommandLineParser.Tests.Commands\MGR.CommandLineParser.Tests.Commands.csproj", "{A422BACE-2758-4ABD-9DAA-ADF289FCCE65}"
@@ -51,6 +54,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{172E24C2-B
5154
EndProject
5255
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{FB795A12-C939-492F-9377-4C468D01EF3C}"
5356
EndProject
57+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MGR.CommandLineParser.Command.Lambda", "src\MGR.CommandLineParser.Command.Lambda\MGR.CommandLineParser.Command.Lambda.csproj", "{9F5A0142-E0A1-45A2-961E-55611B4440AD}"
58+
EndProject
5459
Global
5560
GlobalSection(SolutionConfigurationPlatforms) = preSolution
5661
Debug|Any CPU = Debug|Any CPU
@@ -77,6 +82,10 @@ Global
7782
{A422BACE-2758-4ABD-9DAA-ADF289FCCE65}.Debug|Any CPU.Build.0 = Debug|Any CPU
7883
{A422BACE-2758-4ABD-9DAA-ADF289FCCE65}.Release|Any CPU.ActiveCfg = Release|Any CPU
7984
{A422BACE-2758-4ABD-9DAA-ADF289FCCE65}.Release|Any CPU.Build.0 = Release|Any CPU
85+
{9F5A0142-E0A1-45A2-961E-55611B4440AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
86+
{9F5A0142-E0A1-45A2-961E-55611B4440AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
87+
{9F5A0142-E0A1-45A2-961E-55611B4440AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
88+
{9F5A0142-E0A1-45A2-961E-55611B4440AD}.Release|Any CPU.Build.0 = Release|Any CPU
8089
EndGlobalSection
8190
GlobalSection(SolutionProperties) = preSolution
8291
HideSolutionNode = FALSE
@@ -86,7 +95,9 @@ Global
8695
{22F60D05-F6DB-4410-80AD-E558EF1BDF6F} = {569ED12A-DA23-4457-B304-6B00C0CB335E}
8796
{7FD4CEB3-040B-4581-9B7C-EF8CB99B0951} = {569ED12A-DA23-4457-B304-6B00C0CB335E}
8897
{F192F36D-7EDD-4E1E-82A4-95CA11665D2B} = {0B84161D-C735-43F0-A525-4ED42CC4B17C}
98+
{B5BDC6B3-1206-4DF3-A76C-22FE55064082} = {FB795A12-C939-492F-9377-4C468D01EF3C}
8999
{A422BACE-2758-4ABD-9DAA-ADF289FCCE65} = {569ED12A-DA23-4457-B304-6B00C0CB335E}
100+
{9F5A0142-E0A1-45A2-961E-55611B4440AD} = {FB795A12-C939-492F-9377-4C468D01EF3C}
90101
EndGlobalSection
91102
GlobalSection(ExtensibilityGlobals) = postSolution
92103
SolutionGuid = {827031C5-AE76-4B4C-9503-E13F15B497E9}

azure-pipeline-build.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: MGR.CommandLineParser - $(GitVersion.SemVer)$(rev:.r)
2+
3+
variables:
4+
- name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE
5+
value: 1
6+
- name: System.Configuration
7+
value: Release
8+
- name: GitVersion.SemVer
9+
value: 1.0.0
10+
11+
jobs:
12+
- job: Main
13+
pool:
14+
vmImage: vs2017-win2016
15+
steps:
16+
- task: gittools.gitversion.gitversion-task.GitVersion@4
17+
displayName: 'Get version from Git'
18+
inputs:
19+
preferBundledVersion: false
20+
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['Build.SourceBranch'], 'refs/heads/dev'), startsWith(variables['Build.SourceBranch'], 'refs/heads/release-')))
21+
22+
- task: DotNetCoreCLI@2
23+
displayName: 'dotnet build'
24+
inputs:
25+
arguments: '-c $(System.Configuration) -p:Version=$(GitVersion.SemVer)'
26+
27+
- task: DotNetCoreCLI@2
28+
displayName: 'dotnet test'
29+
inputs:
30+
command: test
31+
projects: 'tests/**/*Tests.csproj'
32+
arguments: '-c $(System.Configuration) --no-build --logger "trx;LogFileName=TestsResults.trx" --logger "xunit;LogFileName=TestsResults.xml" /p:CollectCoverage=true /p:CoverletOutput=_BuildReports\Coverage\ /p:CoverletOutputFormat=cobertura /p:Exclude="[xunit.*]*%2c[*]JetBrains.*%2c[*Tests*]*"'
33+
continueOnError: true
34+
35+
- task: Palmmedia.reportgenerator.reportgenerator-build-release-task.reportgenerator@1
36+
displayName: ReportGenerator
37+
inputs:
38+
reports: '**/_BuildReports/Coverage/coverage.cobertura.xml'
39+
targetdir: '$(Build.ArtifactStagingDirectory)/Coverage'
40+
condition: succeededOrFailed()
41+
42+
- task: PublishCodeCoverageResults@1
43+
displayName: 'Publish code coverage from **/_BuildReports/Coverage/coverage.cobertura.xml'
44+
inputs:
45+
codeCoverageTool: Cobertura
46+
summaryFileLocation: '**/_BuildReports/Coverage/coverage.cobertura.xml'
47+
reportDirectory: '$(Build.ArtifactStagingDirectory)/Coverage'
48+
condition: succeededOrFailed()
49+
50+
- task: CopyFiles@2
51+
displayName: 'Copy Files to artifacts folder'
52+
inputs:
53+
SourceFolder: src/
54+
Contents: '**/MGR.CommandLineParser.*.nupkg'
55+
TargetFolder: '$(Build.ArtifactStagingDirectory)/nuget'
56+
flattenFolders: true
57+
58+
- task: PublishBuildArtifacts@1
59+
displayName: 'Publish Artifact: packages'
60+
inputs:
61+
PathtoPublish: '$(Build.ArtifactStagingDirectory)/nuget'
62+
ArtifactName: packages
63+
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), eq(variables['Build.SourceBranch'], 'refs/heads/dev'), startsWith(variables['Build.SourceBranch'], 'refs/heads/release-')))

build.ps1

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@ Param(
55
[string]$Configuration = "Release",
66
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
77
[string]$Verbosity = "Minimal",
8-
[string]$MyGetFeed,
9-
[string]$BuildNumber,
8+
[string]$MyGetFeed,
9+
[string]$BuildNumber,
1010
[switch]$Experimental,
1111
[switch]$WhatIf
1212
)
13+
$env:DOTNET_CLI_TELEMETRY_OPTOUT = "1"
1314

1415
$BUILD_DIR = Join-Path $PSScriptRoot "build"
1516
$ARTIFACTS_DIR = Join-Path $PSScriptRoot "artifacts"
@@ -18,8 +19,8 @@ $NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
1819
$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe"
1920

2021
if(!(Test-Path $TOOLS_DIR)){
21-
Write-Host "Create tools directory"
22-
New-Item -ItemType Directory $TOOLS_DIR
22+
Write-Host "Create tools directory"
23+
New-Item -ItemType Directory $TOOLS_DIR
2324
}
2425

2526
# Should we use experimental build of Roslyn?
@@ -36,7 +37,7 @@ if($WhatIf.IsPresent) {
3637

3738
# Try download NuGet.exe if do not exist.
3839
if (!(Test-Path $NUGET_EXE)) {
39-
Write-Host "Download Nuget.exe"
40+
Write-Host "Download Nuget.exe"
4041
Invoke-WebRequest -Uri https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile $NUGET_EXE
4142
}
4243

0 commit comments

Comments
 (0)