-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Azure DevOps + AspNetCore3.1 support + Rename (#91)
- Switching build pipeline to Azure DevOps - Updating support for generator to AspNetCore 3.1 (somewhat) - Renaming package to Beffyman.* - Made Newtonsoft.Json serializers into a package instead of the default - System.Text.Json is the default serializer now - #85 - Switched over to Nuke.Build - Switched over to XUnit - Updated Generator to netstandard2.1/net472
- Loading branch information
Showing
296 changed files
with
22,241 additions
and
21,735 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# You can modify the rules from these initially generated values to suit your own policies | ||
# You can learn more about editorconfig here: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference | ||
[*.cs] | ||
|
||
#Core editorconfig formatting - indentation | ||
|
||
#use hard tabs for indentation | ||
indent_style = tab | ||
|
||
#Formatting - new line options | ||
|
||
#require braces to be on a new line for types and methods (also known as "Allman" style) | ||
csharp_new_line_before_open_brace = types, methods | ||
|
||
#Formatting - organize using options | ||
|
||
#sort System.* using directives alphabetically, and place them before other usings | ||
dotnet_sort_system_directives_first = true | ||
|
||
#Formatting - spacing options | ||
|
||
#place a space character after the opening parenthesis and before the closing parenthesis of a method declaration parameter list. | ||
csharp_space_between_method_declaration_parameter_list_parentheses = false | ||
|
||
#Style - expression bodied member options | ||
|
||
#prefer block bodies for constructors | ||
csharp_style_expression_bodied_constructors = false : suggestion | ||
#prefer block bodies for methods | ||
csharp_style_expression_bodied_methods = false : suggestion | ||
|
||
#Style - language keyword and framework type options | ||
|
||
#prefer the language keyword for local variables, method parameters, and class members, instead of the type name, for types that have a keyword to represent them | ||
dotnet_style_predefined_type_for_locals_parameters_members = true : suggestion | ||
|
||
#Style - qualification options | ||
|
||
#prefer properties not to be prefaced with this. or Me. in Visual Basic | ||
dotnet_style_qualification_for_property = false : suggestion | ||
|
||
csharp_new_line_before_open_brace = all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Beffyman.AspNetCore.Client.sln |
461 changes: 236 additions & 225 deletions
461
AspNetCore.Client.sln → Beffyman.AspNetCore.Client.sln
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,126 +1,139 @@ | ||
# Make so the script will stop when it hits an error. | ||
$ErrorActionPreference = "Stop" | ||
|
||
# Get the executing directory and set it to the current directory. | ||
$scriptBin = "" | ||
Try { $scriptBin = "$(Split-Path -Parent $MyInvocation.MyCommand.Definition)" } Catch {} | ||
If ([string]::IsNullOrEmpty($scriptBin)) { $scriptBin = $pwd } | ||
Set-Location $scriptBin | ||
|
||
$version = $env:APPVEYOR_BUILD_VERSION; | ||
$localBuild = $false; | ||
#For local builds, appveyor will be provided version | ||
if([System.String]::IsNullOrEmpty($version)){ | ||
$version = & git describe --tags; | ||
$localBuild = $true; | ||
[CmdletBinding()] | ||
Param( | ||
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] | ||
[string[]]$BuildArguments | ||
) | ||
|
||
Write-Output "PowerShell $($PSVersionTable.PSEdition) version $($PSVersionTable.PSVersion)" | ||
|
||
Set-StrictMode -Version 2.0; | ||
$ErrorActionPreference = "Stop"; | ||
$ConfirmPreference = "None"; | ||
trap { | ||
Write-Error $_; | ||
exit 1 | ||
} | ||
#Filter out - branch commit locally | ||
if($version -Match "-"){ | ||
$version = $version.Split("-")[0]; | ||
} | ||
|
||
#Filter out +Build# from CI builds | ||
if($version -Match "\+"){ | ||
$version = $version.Split("+")[0]; | ||
} | ||
|
||
|
||
if($localBuild -eq $true){ | ||
$build = & git rev-list --count HEAD; | ||
$version = "$($version)$build"; | ||
} | ||
|
||
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent | ||
|
||
Write-Host "---Version $version will be used---" -ForegroundColor Magenta; | ||
########################################################################### | ||
# CONFIGURATION | ||
########################################################################### | ||
|
||
$artifacts = "$scriptBin/artifacts"; | ||
$testGenerator = Resolve-Path "$scriptBin/test/AspNetCore.Client.Test.Generator"; | ||
$BuildProjectFile = "$PSScriptRoot\build\_build.csproj" | ||
$TempDirectory = "$PSScriptRoot\\.tmp" | ||
|
||
Get-ChildItem -Path $artifacts -Filter "*.nupkg" -Recurse | Remove-item -ErrorAction Ignore; | ||
$outputDir = Resolve-Path $artifacts; | ||
$DotNetGlobalFile = "$PSScriptRoot\\global.json" | ||
$DotNetInstallUrlPowershell = "https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.ps1" | ||
$DotNetInstallUrlBash = "https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.sh" | ||
$DotNetChannel = "Current" | ||
|
||
Write-Host ">> dotnet --info" -ForegroundColor Magenta; | ||
dotnet --info | ||
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1 | ||
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1 | ||
$env:NUGET_XMLDOC_MODE = "skip" | ||
|
||
Write-Host ">> dotnet clean -c Release -v m" -ForegroundColor Magenta; | ||
dotnet clean -c Release -v m | ||
########################################################################### | ||
# EXECUTION | ||
########################################################################### | ||
|
||
Write-Host ">> dotnet build -c Release -v m;" -ForegroundColor Magenta; | ||
dotnet build -c Release -v m; | ||
function ExecSafe([scriptblock] $cmd) { | ||
& $cmd | ||
|
||
if($LastExitCode -ne 0){ | ||
throw "Build failed" | ||
if((Get-Variable -Name "LASTEXITCODE" -Scope Global -ErrorAction SilentlyContinue) -ne $null) { | ||
if ($LASTEXITCODE) { | ||
exit $LASTEXITCODE | ||
} | ||
} | ||
} | ||
|
||
#Run the test project generators | ||
Push-Location -Path $testGenerator -StackName "Run"; | ||
Write-Host ">> dotnet run -c Release -v m;" -ForegroundColor Magenta; | ||
dotnet run -c Release -v m --framework netcoreapp2.2; | ||
Pop-Location -StackName "Run"; | ||
|
||
#Build again, making sure that our clients that were just regenerated via the previous command build | ||
Write-Host ">> dotnet build -c Release -v m;" -ForegroundColor Magenta; | ||
dotnet build -c Release -v m; | ||
|
||
|
||
if($LastExitCode -ne 0){ | ||
throw "Build failed" | ||
# If global.json exists, load expected version | ||
if (Test-Path $DotNetGlobalFile) { | ||
$DotNetGlobal = $(Get-Content $DotNetGlobalFile | Out-String | ConvertFrom-Json) | ||
if ($DotNetGlobal.PSObject.Properties["sdk"] -and $DotNetGlobal.sdk.PSObject.Properties["version"]) { | ||
$DotNetVersion = $DotNetGlobal.sdk.version | ||
} | ||
} | ||
|
||
Write-Host ">> dotnet test -c Release -v m;" -ForegroundColor Magenta; | ||
dotnet test -c Release -v m; | ||
|
||
|
||
if($LastExitCode -ne 0){ | ||
throw "Tests failed" | ||
# If dotnet is installed locally, and expected version is not set or installation matches the expected version | ||
if((Get-Variable IsWindows -ErrorAction SilentlyContinue) -eq $null){ | ||
$DotNetSuffix = "win"; | ||
$DotNetExtension = ".exe"; | ||
$DotNetInstallUrl = $DotNetInstallUrlPowershell; | ||
$DotNetInstallExtension = "ps1"; | ||
} | ||
|
||
Write-Host ">> dotnet pack -c Release /p:Version=$version -o $outputDir -v m" -ForegroundColor Magenta; | ||
dotnet pack -c Release /p:Version="$version" -o $outputDir -v m | ||
|
||
|
||
if($LastExitCode -ne 0){ | ||
throw "Pack failed" | ||
else{ | ||
$DotNetSuffix = if($IsWindows -eq $false -or $IsWindows -eq $null){"unix"} else{"win"}; | ||
$DotNetExtension = if($IsWindows -eq $false -or $IsWindows -eq $null){""} else{".exe"}; | ||
$DotNetInstallUrl = if($IsWindows -eq $false -or $IsWindows -eq $null){$DotNetInstallUrlBash} else{$DotNetInstallUrlPowershell}; | ||
$DotNetInstallExtension = if($IsWindows -eq $false -or $IsWindows -eq $null){"sh"} else{"ps1"}; | ||
} | ||
|
||
Write-Host "Remove Client.cs files so we can regenerate them with the msbuild task to make that works" -ForegroundColor Magenta; | ||
Get-ChildItem -Path "**/Clients.cs" -Recurse | Remove-Item -Force | ||
|
||
#Remove the generator from the solution so we don't have two references to it's assembly which causes the generator to fail. | ||
|
||
dotnet sln remove "test/AspNetCore.Client.Test.Generator/AspNetCore.Client.Test.Generator.csproj" | ||
dotnet sln remove "src/AspNetCore.Client.Generator/AspNetCore.Client.Generator.csproj" | ||
|
||
try{ | ||
Write-Host ">> dotnet clean -c Release -v m" -ForegroundColor Magenta; | ||
dotnet clean -c Release -v m | ||
|
||
#Build again, making sure our build task works | ||
Write-Host ">> dotnet build -c Release -v m /p:GenerateWithNuget=true" -ForegroundColor Magenta; | ||
dotnet build -c Release /p:GenerateWithNuget=true; | ||
$DotNetDirectory = "$TempDirectory\dotnet-$DotNetSuffix" | ||
$DotNetVersionDirectory = "$DotNetDirectory\sdk\$DotNetVersion" | ||
$env:DOTNET_EXE = "$DotNetDirectory\dotnet$DotNetExtension" | ||
|
||
|
||
if($LastExitCode -ne 0){ | ||
throw "Build failed" | ||
} | ||
if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue) -and ` | ||
(!(Test-Path variable:DotNetVersion) -or "$(& dotnet --version | Select-Object -First 1)" -eq "$DotNetVersion")) { | ||
|
||
Write-Host ">> dotnet test -c Release -v m /p:GenerateWithNuget=true" -ForegroundColor Magenta; | ||
dotnet test -c Release; | ||
Write-Host "Existing dotnet install discovered"; | ||
|
||
if($LastExitCode -ne 0){ | ||
throw "Tests failed" | ||
} | ||
(dotnet --list-sdks) | Out-Host | ||
|
||
$env:DOTNET_EXE = (Get-Command "dotnet").Path | ||
} | ||
catch{ | ||
throw $_ | ||
} | ||
finally{ | ||
#Readd them, for locals | ||
dotnet sln add "test/AspNetCore.Client.Test.Generator/AspNetCore.Client.Test.Generator.csproj" | ||
dotnet sln add "src/AspNetCore.Client.Generator/AspNetCore.Client.Generator.csproj" | ||
else{ | ||
if(!(Test-Path $DotNetVersionDirectory)){ | ||
# Download install script | ||
$DotNetInstallFile = "$TempDirectory\dotnet-install.$DotNetInstallExtension" | ||
New-Item -ItemType Directory -Force -Path $TempDirectory | Out-Null | ||
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl, $DotNetInstallFile) | ||
|
||
# Install by channel or version | ||
if (!(Test-Path variable:DotNetVersion)) { | ||
if($DotNetInstallExtension -eq "ps1"){ | ||
ExecSafe { & $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath } | ||
} | ||
elseif ($DotNetInstallExtension -eq "sh"){ | ||
ExecSafe { & "$DotNetInstallFile" --install-dir "$DotNetDirectory" --channel "$DotNetChannel" --no-path } | ||
} | ||
else{ | ||
throw "Unknown install extension"; | ||
} | ||
} else { | ||
if($DotNetInstallExtension -eq "ps1"){ | ||
ExecSafe { & $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath } | ||
} | ||
elseif ($DotNetInstallExtension -eq "sh"){ | ||
ExecSafe { & "$DotNetInstallFile" --install-dir "$DotNetDirectory" --version "$DotNetVersion" --no-path } | ||
} | ||
else{ | ||
throw "Unknown install extension"; | ||
} | ||
} | ||
} | ||
} | ||
|
||
$env:PATH += $DotNetDirectory; | ||
$env:DOTNET_ROOT = $DotNetDirectory; | ||
|
||
Write-Output "Microsoft (R) .NET Core SDK version $(& $env:DOTNET_EXE --version)" | ||
|
||
|
||
#Output a bunch of diag info | ||
Write-Host "[DotNetVersion] = $DotNetVersion"; | ||
Write-Host "[DotNetSuffix] = $DotNetSuffix"; | ||
Write-Host "[DotNetExtension] = $DotNetExtension"; | ||
Write-Host "[DotNetInstallUrl] = $DotNetInstallUrl"; | ||
Write-Host "[DotNetInstallExtension] = $DotNetInstallExtension"; | ||
Write-Host "[DotNetDirectory] = $DotNetDirectory"; | ||
Write-Host "[DotNetVersionDirectory] = $DotNetVersionDirectory"; | ||
Write-Host "[env:DOTNET_EXE] = $env:DOTNET_EXE"; | ||
Write-Host "[env:DOTNET_ROOT] = $env:DOTNET_ROOT"; | ||
Write-Host "[env:PATH] = $env:PATH"; | ||
|
||
try{ | ||
ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile -c Release /nodeReuse:false } | ||
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile -c Release --no-build -- $BuildArguments } | ||
}finally{ | ||
ExecSafe { & $env:DOTNET_EXE build-server shutdown --msbuild --vbcscompiler} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<LangVersion>latest</LangVersion> | ||
<IsPackable>false</IsPackable> | ||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> | ||
<TieredCompilation>true</TieredCompilation> | ||
<TieredCompilationQuickJit>true</TieredCompilationQuickJit> | ||
</PropertyGroup> | ||
|
||
<!--Define nupkg --> | ||
<PropertyGroup> | ||
<Copyright>Copyright 2020</Copyright> | ||
<Authors>Beffyman</Authors> | ||
<RepositoryType>git</RepositoryType> | ||
<RepositoryUrl>https://github.com/Beffyman/AspNetCore.Client</RepositoryUrl> | ||
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance> | ||
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile> | ||
<SymbolPackageFormat>snupkg</SymbolPackageFormat> | ||
<IncludeSymbols>true</IncludeSymbols> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Include="..\..\LICENSE.txt" Pack="true" PackagePath="$(PackageLicenseFile)" /> | ||
</ItemGroup> | ||
|
||
<!--Define Analyzers --> | ||
<ItemGroup> | ||
<PackageReference Include="ErrorProne.NET.Structs" Version="0.2.0-beta.7 "> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> | ||
</PackageReference> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mode: ContinuousDeployment |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.