Skip to content

Commit fc6f06b

Browse files
luli0401ArdentLogicianangularsengojanpaolo
authored
Add UnitsNet.NumberExtensions nuget (#742)
* Add number extensions back to Units.NET as separate nuget UnitsNet.NumberExtensions * Change the build process, include the UnitsNet.NumberExtensions project and add the version bump scripts. * Create UnitsNet.NumberExtensions.Tests project. * Sync the Extension project version number with the main library, add a test project for extension methods, and improve the Extension project decription. Co-authored-by: Anthony Langlois <[email protected]> Co-authored-by: Andreas Gullberg Larsen <[email protected]> Co-authored-by: Jan Paolo Go <[email protected]>
1 parent 73ada82 commit fc6f06b

File tree

214 files changed

+14630
-6
lines changed

Some content is hidden

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

214 files changed

+14630
-6
lines changed

Build/build-functions.psm1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ function Start-Build([boolean] $IncludeWindowsRuntimeComponent = $false) {
6060
function Start-Tests {
6161
$projectPaths = @(
6262
"UnitsNet.Tests\UnitsNet.Tests.csproj",
63+
"UnitsNet.NumberExtensions.Tests\UnitsNet.NumberExtensions.Tests.csproj",
6364
"UnitsNet.Serialization.JsonNet.Tests\UnitsNet.Serialization.JsonNet.Tests.csproj",
6465
"UnitsNet.Serialization.JsonNet.CompatibilityTests\UnitsNet.Serialization.JsonNet.CompatibilityTests.csproj"
6566
)
@@ -97,7 +98,8 @@ function Start-Tests {
9798
function Start-PackNugets {
9899
$projectPaths = @(
99100
"UnitsNet\UnitsNet.csproj",
100-
"UnitsNet.Serialization.JsonNet\UnitsNet.Serialization.JsonNet.csproj"
101+
"UnitsNet.Serialization.JsonNet\UnitsNet.Serialization.JsonNet.csproj",
102+
"UnitsNet.NumberExtensions\UnitsNet.NumberExtensions.csproj"
101103
)
102104

103105
write-host -foreground blue "Pack nugets...`n---"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@echo off
22
SET scriptdir=%~dp0
33
call powershell -NoProfile %scriptdir%\set-version-UnitsNet.ps1 -bump major
4+
call powershell -NoProfile %scriptdir%\set-version-UnitsNet.NumberExtensions.ps1 -bump major
45
if %errorlevel% neq 0 exit /b %errorlevel%
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@echo off
22
SET scriptdir=%~dp0
33
call powershell -NoProfile %scriptdir%\set-version-UnitsNet.ps1 -bump minor
4+
call powershell -NoProfile %scriptdir%\set-version-UnitsNet.NumberExtensions.ps1 -bump minor
45
if %errorlevel% neq 0 exit /b %errorlevel%
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@echo off
22
SET scriptdir=%~dp0
33
call powershell -NoProfile %scriptdir%\set-version-UnitsNet.ps1 -bump patch
4+
call powershell -NoProfile %scriptdir%\set-version-UnitsNet.NumberExtensions.ps1 -bump patch
45
if %errorlevel% neq 0 exit /b %errorlevel%
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@echo off
22
SET scriptdir=%~dp0
33
call powershell -NoProfile %scriptdir%\set-version-UnitsNet.ps1 -bump suffix
4+
call powershell -NoProfile %scriptdir%\set-version-UnitsNet.NumberExtensions.ps1 -bump suffix
45
if %errorlevel% neq 0 exit /b %errorlevel%
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@echo off
2+
SET scriptdir=%~dp0
3+
call powershell -NoProfile %scriptdir%\set-version-UnitsNet.NumberExtensions.ps1 -bump major
4+
if %errorlevel% neq 0 exit /b %errorlevel%
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@echo off
2+
SET scriptdir=%~dp0
3+
call powershell -NoProfile %scriptdir%\set-version-UnitsNet.NumberExtensions.ps1 -bump minor
4+
if %errorlevel% neq 0 exit /b %errorlevel%
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@echo off
2+
SET scriptdir=%~dp0
3+
call powershell -NoProfile %scriptdir%\set-version-UnitsNet.NumberExtensions.ps1 -bump patch
4+
if %errorlevel% neq 0 exit /b %errorlevel%
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@echo off
2+
SET scriptdir=%~dp0
3+
call powershell -NoProfile %scriptdir%\set-version-UnitsNet.NumberExtensions.ps1 -bump suffix
4+
if %errorlevel% neq 0 exit /b %errorlevel%
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<# .SYNOPSIS
2+
Updates the version of all UnitsNet.Extensions projects.
3+
.DESCRIPTION
4+
Updates the <Version> property of the .csproj project files.
5+
.PARAMETER set
6+
Set new version
7+
.PARAMETER bump
8+
Bump major, minor, patch or semver suffix number. Only one can be specified at a time, and bumping one part will reset all the lesser parts.
9+
.EXAMPLE
10+
Set new version.
11+
-v 2.3.4-beta3: 1.0.0 => 2.3.4-beta3
12+
.EXAMPLE
13+
Bump the major, minor, patch or suffix part of the version.
14+
-b major: 1.2.3-alpha1 => 2.0.0
15+
-b minor: 1.2.3-alpha1 => 1.3.0
16+
-b patch: 1.2.3-alpha1 => 1.2.4
17+
-b suffix: 1.2.3-alpha => 1.2.3-alpha2
18+
-b suffix: 1.2.3-alpha2 => 1.2.3-alpha3
19+
-b suffix: 1.2.3-beta2 => 1.2.3-beta3
20+
-b suffix: 1.2.3-rc2 => 1.2.3-rc3
21+
22+
.NOTES
23+
Author: Lu Li
24+
Date: Jan 15, 2020
25+
Based on original work by Luis Rocha from: http://www.luisrocha.net/2009/11/setting-assembly-version-with-windows.html
26+
#>
27+
[CmdletBinding()]
28+
Param(
29+
[Parameter(Mandatory=$true, Position=0, ParameterSetName="set", HelpMessage="Set version string")]
30+
[Alias("version")]
31+
[string]$setVersion,
32+
33+
[Parameter(Mandatory=$true, Position=0, ParameterSetName="bump", HelpMessage="Bump one or more version parts")]
34+
[Alias("bump")]
35+
[ValidateSet('major','minor','patch','suffix')]
36+
[string]$bumpVersion
37+
)
38+
39+
function Help {
40+
"Sets the AssemblyVersion and AssemblyFileVersion of AssemblyInfo.cs files`n"
41+
".\SetVersion.ps1 [VersionNumber]`n"
42+
" [VersionNumber] The version number to set, for example: 1.1.9301.0"
43+
" If not provided, a version number will be generated.`n"
44+
}
45+
46+
# Import functions: Get-NewProjectVersion, Set-ProjectVersion, Invoke-CommitAndTagVersion
47+
Import-Module "$PSScriptRoot\set-version.psm1"
48+
49+
$root = Resolve-Path "$PSScriptRoot\.."
50+
$paramSet = $PsCmdlet.ParameterSetName
51+
$projFile = "$root\UnitsNet.NumberExtensions\UnitsNet.NumberExtensions.csproj"
52+
$versionFiles = @($projFile)
53+
$projectName = "UnitsNet.NumberExtensions"
54+
55+
# Use UnitsNet.Common.props version as base if bumping major/minor/patch
56+
$newVersion = Get-NewProjectVersion $projFile $paramSet $setVersion $bumpVersion
57+
58+
Set-ProjectVersion $projFile $newVersion
59+
Invoke-CommitAndTagVersion $projectName $versionFiles $newVersion

0 commit comments

Comments
 (0)