Skip to content

Commit ed1b6d6

Browse files
committed
Merge remote-tracking branch 'origin/master' into release/v6
2 parents ff24de9 + 786d191 commit ed1b6d6

File tree

710 files changed

+30174
-11723
lines changed

Some content is hidden

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

710 files changed

+30174
-11723
lines changed

.config/dotnet-tools.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
"commands": [
88
"dotnet-dotcover"
99
]
10+
},
11+
"timeitsharp": {
12+
"version": "0.0.8",
13+
"commands": [
14+
"dotnet-timeit"
15+
]
1016
}
1117
}
1218
}

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,4 @@ Artifacts
258258

259259
# Build server tooling
260260
/secure-file
261-
/Tools/reportgenerator.exe
262-
/Tools/.store/
263-
/Tools/Temp
261+
/.tools/

Build/build-functions.psm1

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
$root = "$PSScriptRoot\.."
1+
$root = (Resolve-Path "$PSScriptRoot\..").Path
22
$artifactsDir = "$root\Artifacts"
3-
$nugetOutDir = "$root\Artifacts\NuGet"
4-
$testReportDir = "$root\Artifacts\Logs"
5-
$testCoverageDir = "$root\Artifacts\Coverage"
6-
$nuget = "$root\Tools\NuGet.exe"
3+
$nugetOutDir = "$artifactsDir\NuGet"
4+
$logsDir = "$artifactsDir\Logs"
5+
$testReportDir = "$artifactsDir\TestResults"
6+
$testCoverageDir = "$artifactsDir\Coverage"
7+
$toolsDir = "$root\.tools"
8+
9+
$nuget = "$toolsDir\NuGet.exe"
710
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
811
$msbuildPath = & $vswhere -latest -products * -requires Microsoft.Component.MSBuild -property installationPath
12+
913
if ($msbuildPath) {
10-
$msbuild = join-path $msbuildPath 'MSBuild\Current\Bin\MSBuild.exe'
1114
$msbuildx64 = join-path $msbuildPath 'MSBuild\Current\Bin\amd64\MSBuild.exe'
1215
}
1316

@@ -31,13 +34,9 @@ function Update-GeneratedCode {
3134
function Start-Build([boolean] $IncludeNanoFramework = $false) {
3235
write-host -foreground blue "Start-Build...`n---"
3336

34-
$fileLoggerArg = "/logger:FileLogger,Microsoft.Build;logfile=$testReportDir\UnitsNet.msbuild.log"
37+
$fileLoggerArg = "/logger:FileLogger,Microsoft.Build;logfile=$logsDir\UnitsNet.msbuild.log"
3538

36-
$appVeyorLoggerDll = "C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
37-
$appVeyorLoggerNetCoreDll = "C:\Program Files\AppVeyor\BuildAgent\dotnetcore\Appveyor.MSBuildLogger.dll"
38-
$appVeyorLoggerArg = if (Test-Path "$appVeyorLoggerNetCoreDll") { "/logger:$appVeyorLoggerNetCoreDll" } else { "" }
39-
40-
dotnet build --configuration Release /p:ContinuousIntegrationBuild=true "$root\UnitsNet.sln" $fileLoggerArg $appVeyorLoggerArg
39+
dotnet build --configuration Release /p:ContinuousIntegrationBuild=true "$root\UnitsNet.sln" $fileLoggerArg
4140
if ($lastexitcode -ne 0) { exit 1 }
4241

4342
if (-not $IncludeNanoFramework)
@@ -47,13 +46,13 @@ function Start-Build([boolean] $IncludeNanoFramework = $false) {
4746
else
4847
{
4948
write-host -foreground green "Build .NET nanoFramework."
50-
$fileLoggerArg = "/logger:FileLogger,Microsoft.Build;logfile=$testReportDir\UnitsNet.NanoFramework.msbuild.log"
51-
$appVeyorLoggerArg = if (Test-Path "$appVeyorLoggerDll") { "/logger:$appVeyorLoggerDll" } else { "" }
49+
$fileLoggerArg = "/logger:FileLogger,Microsoft.Build;logfile=$logsDir\UnitsNet.NanoFramework.msbuild.log"
5250

5351
# msbuild does not auto-restore nugets for this project type
5452
& "$nuget" restore "$root\UnitsNet.NanoFramework\GeneratedCode\UnitsNet.nanoFramework.sln"
53+
5554
# now build
56-
& "$msbuildx64" "$root\UnitsNet.NanoFramework\GeneratedCode\UnitsNet.nanoFramework.sln" /verbosity:minimal /p:Configuration=Release /p:Platform="Any CPU" /p:ContinuousIntegrationBuild=true $fileLoggerArg $appVeyorLoggerArg
55+
& "$msbuildx64" "$root\UnitsNet.NanoFramework\GeneratedCode\UnitsNet.nanoFramework.sln" /verbosity:minimal /p:Configuration=Release /p:Platform="Any CPU" /p:ContinuousIntegrationBuild=true $fileLoggerArg
5756
if ($lastexitcode -ne 0) { exit 1 }
5857
}
5958

@@ -74,7 +73,6 @@ function Start-Tests {
7473
write-host -foreground blue "Run tests...`n---"
7574
foreach ($projectPath in $projectPaths) {
7675
$projectFileNameNoEx = [System.IO.Path]::GetFileNameWithoutExtension($projectPath)
77-
$reportFile = "$testReportDir\${projectFileNameNoEx}.xunit.xml"
7876
$coverageReportFile = "$testCoverageDir\${projectFileNameNoEx}.coverage.xml"
7977
$projectDir = [System.IO.Path]::GetDirectoryName($projectPath)
8078

@@ -84,6 +82,8 @@ function Start-Tests {
8482
# Create coverage report for this test project
8583
& dotnet dotcover test `
8684
--no-build `
85+
--logger trx `
86+
--results-directory "$testReportDir" `
8787
--dotCoverFilters="+:module=UnitsNet*;-:module=*Tests" `
8888
--dotCoverOutput="$coverageReportFile" `
8989
--dcReportType=DetailedXML
@@ -93,7 +93,7 @@ function Start-Tests {
9393
}
9494

9595
# Generate a summarized code coverage report for all test projects
96-
& "Tools/reportgenerator.exe" -reports:"$root/Artifacts/Coverage/*.coverage.xml" -targetdir:"$root/Artifacts/Coverage" -reporttypes:HtmlSummary
96+
& "$toolsDir/reportgenerator.exe" -reports:"$testCoverageDir/*.coverage.xml" -targetdir:"$testCoverageDir" -reporttypes:HtmlSummary
9797

9898
write-host -foreground blue "Run tests...END`n"
9999
}

Build/build-pack-nano-nugets.psm1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
$root = "$PSScriptRoot\.."
1+
$root = (Resolve-Path "$PSScriptRoot\..").Path
22
$nugetOutDir = "$root\Artifacts\NuGet"
3-
$nuget = "$root\Tools\NuGet.exe"
3+
$toolsDir = "$root\.tools"
4+
$nuget = "$toolsDir\NuGet.exe"
45

56
function Invoke-BuildNanoNugets {
67

Build/clean.ps1

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
# Don't allow using undeclared variables
22
Set-Strictmode -version latest
33

4-
$root = "$PSScriptRoot\.."
4+
$root = (Resolve-Path "$PSScriptRoot\..").Path
5+
$artifactsDir = "$root\Artifacts"
6+
$toolsDir = "$root\.tools"
7+
8+
Write-Host -Foreground Blue "Delete .tools"
9+
Remove-Item -Recurse -Force -ErrorAction Ignore "$toolsDir"
10+
11+
Write-Host -Foreground Blue "Delete Artifacts"
12+
Remove-Item -Recurse -Force -ErrorAction Ignore "$artifactsDir"
13+
514
Write-Host -Foreground Blue "Delete dirs: bin, obj"
615

716
[int]$deleteCount = 0
@@ -20,8 +29,8 @@ if ($failedToDeleteDirs) {
2029
$failCount = $failedToDeleteDirs.Count
2130
Write-Host ""
2231
Write-Host -Foreground Red "Failed to delete $failCount dirs:"
23-
$failedToDeleteDirs | %{
32+
$failedToDeleteDirs | %{
2433
Write-Host -Foreground Red $_.FullName
2534
}
2635
exit /B 1
27-
}
36+
}

Build/init.ps1

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
11
# Don't allow using undeclared variables
22
Set-Strictmode -version latest
33

4-
$root = "$PSScriptRoot\.."
4+
$root = (Resolve-Path "$PSScriptRoot\..").Path
5+
$nugetPath = "$root/.tools/NuGet.exe"
6+
57
Write-Host -Foreground Blue "Initializing..."
68

79
# Ensure temp dir exists
8-
$tempDir = "$root/Tools/Temp"
10+
$tempDir = "$root/.tools/temp_init"
911
[system.io.Directory]::CreateDirectory($tempDir) | out-null
1012

11-
if (-not (Test-Path "$root/Tools/reportgenerator.exe")) {
12-
Write-Host -Foreground Blue "Download dotnet-reportgenerator-globaltool..."
13-
dotnet tool install dotnet-reportgenerator-globaltool --tool-path Tools
14-
Write-Host -Foreground Green "Download dotnet-reportgenerator-globaltool...OK."
13+
# Report generator for unit test coverage reports.
14+
if (-not (Test-Path "$root/.tools/reportgenerator.exe")) {
15+
Write-Host -Foreground Blue "Install dotnet-reportgenerator-globaltool..."
16+
dotnet tool install dotnet-reportgenerator-globaltool --tool-path .tools
17+
Write-Host -Foreground Green "✅ Installed dotnet-reportgenerator-globaltool"
18+
}
19+
20+
# NuGet.exe for non-SDK style projects, like UnitsNet.nanoFramework.
21+
if (-not (Test-Path "$nugetPath")) {
22+
Write-Host -Foreground Blue "Downloading NuGet.exe..."
23+
Invoke-WebRequest -Uri https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile $nugetPath
24+
Write-Host -Foreground Green "✅ Downloaded NuGet.exe: $nugetPath"
1525
}
1626

1727
###################################################

CodeGen/CodeGen.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
@@ -11,7 +11,7 @@
1111

1212
<ItemGroup>
1313
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
14-
<PackageReference Include="NuGet.Protocol" Version="6.2.2" />
14+
<PackageReference Include="NuGet.Protocol" Version="6.2.4" />
1515
<PackageReference Include="Serilog" Version="2.11.0" />
1616
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
1717
<PackageReference Include="System.CommandLine.DragonFruit" Version="0.2.0-alpha.19174.3" />

CodeGen/Generators/NanoFrameworkGen/NuspecGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public string Generate()
2525
<package xmlns=""http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd"">
2626
<metadata>
2727
<id>UnitsNet.nanoFramework.{_quantity.Name}</id>
28-
<version>5.5.0</version>
28+
<version>5.25.0</version>
2929
<title>Units.NET {_quantity.Name} - nanoFramework</title>
3030
<authors>Andreas Gullberg Larsen,nanoFramework project contributors</authors>
3131
<owners>UnitsNet</owners>

CodeGen/Generators/NanoFrameworkGenerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public static bool UpdateNanoFrameworkDependencies(
137137
{
138138
StartInfo = new ProcessStartInfo
139139
{
140-
FileName = Path.Combine(rootDir, "Tools/nuget.exe"),
140+
FileName = Path.Combine(rootDir, ".tools/nuget.exe"),
141141
Arguments = $"restore {path}\\UnitsNet.nanoFramework.sln",
142142
UseShellExecute = false,
143143
CreateNoWindow = true,
@@ -188,7 +188,7 @@ public static bool UpdateNanoFrameworkDependencies(
188188
{
189189
StartInfo = new ProcessStartInfo
190190
{
191-
FileName = Path.Combine(rootDir, "Tools/nuget.exe"),
191+
FileName = Path.Combine(rootDir, ".tools/NuGet.exe"),
192192
Arguments = $"update {path}\\UnitsNet.nanoFramework.sln -PreRelease",
193193
UseShellExecute = false,
194194
CreateNoWindow = true,

CodeGen/Generators/QuantityJsonFilesParser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ private static Quantity ParseQuantityFile(string jsonFileName)
6060

6161
private static void OrderUnitsByName(Quantity quantity)
6262
{
63-
quantity.Units = quantity.Units.OrderBy(u => u.SingularName).ToArray();
63+
quantity.Units = quantity.Units.OrderBy(u => u.SingularName, StringComparer.OrdinalIgnoreCase).ToArray();
6464
}
6565

6666
private static void FixConversionFunctionsForDecimalValueTypes(Quantity quantity)

0 commit comments

Comments
 (0)