Skip to content

Commit 39f7cdf

Browse files
authored
Updated to support LTSC runtime (#25)
* Update docs for Build Infra. * Removed extraneous entry in RESX * Updated to remove CVE vulnerability in dependent packages * Updated projects to use .NET 8.0 (LTSC) as the target version Implements feature #24
1 parent 8f9fdb0 commit 39f7cdf

File tree

10 files changed

+83
-52
lines changed

10 files changed

+83
-52
lines changed

Build-All.ps1

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ using module "PSModules/RepoBuild/RepoBuild.psd1"
1414
1515
.DESCRIPTION
1616
This script is used by the automated build to perform the actual build. The Ubiquity.NET
17-
family of projects all employ a PowerShell driven build that is generally divorced from the
18-
automated build infrastructure used. This is done for several reasons, but the most
17+
family of projects all employ a PowerShell driven build that is generally divorced from
18+
the automated build infrastructure used. This is done for several reasons, but the most
1919
important ones are the ability to reproduce the build locally for inner development and
2020
for flexibility in selecting the actual back end. The back ends have changed a few times
2121
over the years and re-writing the entire build in terms of those back ends each time is
@@ -28,7 +28,8 @@ Param(
2828
[switch]$ForceClean
2929
)
3030

31-
Set-StrictMode -Version 3.0
31+
$ErrorActionPreference = "Stop"
32+
$InformationPreference = "Continue"
3233

3334
Push-Location $PSScriptRoot
3435
$oldPath = $env:Path
@@ -48,7 +49,7 @@ try
4849
Remove-Item -Recurse -Force $buildInfo['BuildOutputPath'] -ProgressAction SilentlyContinue | Out-Null
4950
}
5051

51-
mkdir $buildInfo['NuGetOutputPath'] -ErrorAction SilentlyContinue | Out-Null
52+
New-Item -ItemType Directory $buildInfo['NuGetOutputPath'] -ErrorAction SilentlyContinue | Out-Null
5253
dotnet build -c $Configuration --no-incremental 'src/Ubiquity.NET.Versioning.slnx'
5354
}
5455
catch

Directory.Packages.props

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,23 @@
44
Global references are included in ALL projects in this repository
55
-->
66
<ItemGroup>
7-
<GlobalPackageReference Include="Ubiquity.NET.Versioning.Build.Tasks" Version="5.0.6-alpha"/>
8-
7+
<GlobalPackageReference Include="Ubiquity.NET.Versioning.Build.Tasks" Version="5.0.6" />
98
<!--
109
NOTE: This analyzer is sadly, perpetually in "pre-release" mode. There have been many issues/discussion on the point
1110
and it has not changed official plans for the library. So policies regarding "NO-Prerelease" components need to be
1211
overruled on this one
1312
-->
1413
<GlobalPackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556" Condition="'$(UseStyleCop)' != 'false'" />
1514
</ItemGroup>
16-
1715
<!--
1816
Package versions made consistent across all packages referenced in this repository
1917
-->
2018
<ItemGroup>
2119
<PackageVersion Include="Sprache" Version="2.3.1" />
22-
2320
<!-- Tests all use the same framework versions -->
2421
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.0" />
2522
<PackageVersion Include="MSTest.TestAdapter" Version="3.9.1" />
2623
<PackageVersion Include="MSTest.TestFramework" Version="3.9.1" />
24+
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
2725
</ItemGroup>
2826
</Project>

PsModules/CommonBuild/Public/Get-CurrentBuildKind.ps1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ function Get-CurrentBuildKind
3030
$currentBuildKind = [BuildKind]::LocalBuild
3131

3232
# IsAutomatedBuild is the top level gate (e.g. if it is false, all the others must be false)
33+
# This supports identification of APPVEYOR or GitHub explicitly but also supports the common
34+
# `CI` environment variable. Additional build back-ends that don't set the env var therefore,
35+
# would need special handling here.
3336
$isAutomatedBuild = [System.Convert]::ToBoolean($env:CI) `
3437
-or [System.Convert]::ToBoolean($env:APPVEYOR) `
3538
-or [System.Convert]::ToBoolean($env:GITHUB_ACTIONS)
@@ -40,6 +43,12 @@ function Get-CurrentBuildKind
4043
# below, so default to a CiBuild (e.g. not a PR, And not a RELEASE)
4144
$currentBuildKind = [BuildKind]::CiBuild
4245

46+
# Based on back-end type - determine if this is a release or CI build
47+
# The assumption here is that a TAG is pushed to the repo for releases
48+
# and therefore that is what distinguishes a release build. Other conditions
49+
# would need to use other criteria to determine a PR buddy build, CI build
50+
# and release build.
51+
4352
# IsPullRequestBuild indicates an automated buddy build and should not be trusted
4453
$isPullRequestBuild = $env:GITHUB_BASE_REF -or $env:APPVEYOR_PULL_REQUEST_NUMBER
4554

PsModules/CommonBuild/Public/Initialize-CommonBuildEnvironment.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ function Initialize-CommonBuildEnvironment
8787

8888
# On Windows setup the equivalent of a Developer prompt.
8989
#
90-
# other platform runners may have different defaulted paths etc...
90+
# Other platform runners may have different defaulted paths etc...
9191
# to account for here.
9292
if ($IsWindows)
9393
{
@@ -100,7 +100,7 @@ function Initialize-CommonBuildEnvironment
100100
# "profile" and the actual command is exposed.
101101
if($null -eq (Find-OnPath vswhere))
102102
{
103-
# NOTE: automated builds in Github do NOT include winget (for reasons unknown)
103+
# NOTE: automated builds in Github do NOT include WinGet (for reasons unknown)
104104
# However, they do contain VSWHERE so should not hit this.
105105
winget install Microsoft.VisualStudio.Locator | Out-Null
106106
}

PsModules/CommonBuild/Public/Show-FullBuildInfo.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function Show-FullBuildInfo
99
properties so that the full details are available in logs.
1010
1111
.DESCRIPTION
12-
This function displays all the properties of the build info to the information stream. Additionally,
12+
This function displays all the properties of the buildinfo to the information stream. Additionally,
1313
details of the current PATH, the .NET SDKs and runtimes installed is logged to the Verbose stream.
1414
#>
1515
Param($buildInfo)

PsModules/RepoBuild/Public/Initialize-BuildEnvironment.ps1

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ function Initialize-BuildEnvironment
4747
{
4848
# use common repo-neutral function to perform most of the initialization
4949
$buildInfo = Initialize-CommonBuildEnvironment $repoRoot -FullInit:$FullInit
50+
51+
# Add repo specific values
5052
$buildInfo['OfficialGitRemoteUrl'] = 'https://github.com/UbiquityDotNET/Ubiquity.NET.Versioning.git'
5153

5254
# make sure directories required (but not created by build tools) exist

README.md

Lines changed: 45 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,31 @@
11
# Ubiquity.NET.Versioning
22
This repo includes support for versioning numbers. This support includes:
3-
1) Automated Constrained Semantic Versioning ([CSemVer](https:/csemver.org)) for MSBuild
3+
1) Automated Constrained Semantic Versioning ([CSemVer](https://csemver.org)) for MSBuild
44
projects.
55
2) A standalone library useful for parsing, sorting and validating versions.
66
- [SemVer](https://semver.org)
77
- [CSemVer](https://csemver.org)
88
- This is a Constrained Semantic Version (That is, a strict subset of a SemVer)
99
- [CSemVer-CI](https://csemver.org)
10-
- This is also a Constrained Semantic Version but is designed for ***POST-RELEASE*** CI
11-
build numbering. It is NOT a CSemVer but IS a SemVer.
10+
- This is also a Constrained Semantic Version but is designed for ***POST-RELEASE***
11+
CI build numbering. It is NOT a CSemVer but IS a SemVer.
1212

1313
## Status
1414
[![NuGet Version](https://img.shields.io/nuget/vpre/Ubiquity.NET.Versioning)](https://www.nuget.org/packages/Ubiquity.NET.Versioning)
1515
![NuGet](https://img.shields.io/nuget/dt/Ubiquity.NET.Versioning.svg)
1616
![PR/CI Work Flow Status](https://img.shields.io/github/actions/workflow/status/UbiquityDotNET/Ubiquity.NET.Versioning/pr-build.yml?label=PR%2FCI%20Build%20Status)
1717
![Release Work Flow Status](https://img.shields.io/github/actions/workflow/status/UbiquityDotNET/Ubiquity.NET.Versioning/release-build.yml?label=Release%20Build%20Status)
1818

19+
## Supported Runtimes
20+
This library supports the following .NET runtime versions.
21+
* .NET 8.0 (LTSC) and later
22+
23+
.NET standard 2.0 does not support the many uses of `static abstract` that are utilized
24+
in this library. Therefore, supporting that runtime is not possible with simple PolyFill's.
25+
It requires fairly significant preprocessor conditional coding AND major changes to the
26+
tests to validate BOTH variants. Thus, unless there is a strong compelling case that's not
27+
something this library will support.
28+
1929
## Overview
2030
Officially, NuGet Packages use a SemVer 2.0 (see http://semver.org).
2131
However, SemVer 2.0 doesn't consider or account for publicly available CI builds.
@@ -26,41 +36,46 @@ allowing for automated CI builds. These new versions are called a [Constrained S
2636
Version](http://csemver.org) (CSemVer).
2737

2838
## Constrained use of Constrained Semantic Versions
29-
A CSemVer is unique for each CI build and always increments while supporting official releases.
30-
In the real world there are often cases where there are additional builds that are distinct
31-
from official releases and CI builds. Including Local developer builds, builds generated from a
32-
Pull Request (a.k.a Automated buddy build). CSemVer doesn't explicitly define any format for
33-
these cases. So this library defines a pattern of versioning that is fully compatible with
34-
CSemVer and allows for the additional build types in a way that retains precedence having the
35-
least surprising consequences. In particular, local build packages have a higher precedence
36-
than automated builds (CI or release) versions if all other components of the version match.
37-
This ensures that what you are building includes the dependent packages you just built instead
38-
of the last one released publicly.
39+
A CSemVer is unique for each CI build and always increments while supporting official
40+
releases. In the real world there are often cases where there are additional builds that
41+
are distinct from official releases and CI builds. Including Local developer builds,
42+
builds generated from a Pull Request (a.k.a Automated buddy build). CSemVer doesn't
43+
explicitly define any format for these cases. So this library defines a pattern of
44+
versioning that is fully compatible with CSemVer and allows for the additional build types
45+
in a way that retains precedence having the least surprising consequences. In particular,
46+
local build packages have a higher precedence than automated builds (CI or release)
47+
versions if all other components of the version match. This ensures that what you are
48+
building includes the dependent packages you just built instead of the last one released
49+
publicly.
3950

4051
>[!WARNING]
41-
> The formal 'spec' for [CSemVer](https://csemver.org) remains silent on the point of the short
42-
> format.<sup>[1](#footnote_1)</sup> Instead it relies on only examples. However, the examples are inconsistent on the
43-
> requirement of a delimiter between the short name and number components of a version. It
44-
> shows two examples '1.0.0-b03-01' ***AND*** '5.0.0-r-04-13'. So, which is it? Is the
45-
> delimiter required or not?
52+
> The formal 'spec' for [CSemVer](https://csemver.org) remains silent on the point of the
53+
> short format.<sup>[1](#footnote_1)</sup> Instead it relies on only examples. However,
54+
> the examples are inconsistent on the requirement of a delimiter between the short name
55+
> and number components of a version. It shows two examples '1.0.0-b03-01' ***AND***
56+
> '5.0.0-r-04-13'. So, which is it? Is the delimiter required or not?
4657
>
4758
> This may seem like an entirely academic issue, but when parsing an input it impacts the
48-
> validity of inputs. Also, when the dealing with ordering and the length of otherwise equal
49-
> components comes into play it can impact the behavior as well. How are `1.0.0-b03-01` and
50-
> `1.0.0-b-03-01` ordered in relation to each other? Is the former even a valid CSemVer?
59+
> validity of inputs. Also, when the dealing with ordering and the length of otherwise
60+
> equal components comes into play it can impact the behavior as well. How are
61+
> `1.0.0-b03-01` and `1.0.0-b-03-01` ordered in relation to each other? Is the former
62+
> even a valid CSemVer?
5163
>
52-
> ***This implementation is making no assumptions and simply does NOT support the short form.***
53-
> That may seem like a hard stance but given the ambiguities of the spec, documenting the behavior
54-
> is difficult. Additionally, handling all the potential variations makes for extremely complex
55-
> implementation code. All of that for a feature in support of a NuGet client that is now obsolete.
56-
> (NuGet v3 can handle the full name just fine!). Thus, the lack of support in this library.
64+
> ***This implementation is making no assumptions and simply does NOT support the short
65+
> form.*** That may seem like a hard stance but given the ambiguities of the spec,
66+
> documenting the behavior is difficult. Additionally, handling all the potential
67+
> variations makes for extremely complex implementation code. All of that for a feature
68+
> in support of a NuGet client that is now obsolete. (NuGet v3 can handle the full name
69+
> just fine!). Thus, the lack of support in this library.
5770
5871
## End User Documentation
59-
Full documentation on the tasks is available in the project's [docs site](https://ubiquitydotnet.github.io/Ubiquity.NET.Versioning/)
72+
Full documentation on the tasks is available in the project's
73+
[docs site](https://ubiquitydotnet.github.io/Ubiquity.NET.Versioning/)
6074

6175
## Building the tasks
62-
Documentation on building and general maintenance of this repo are provided in the [Wiki](https://github.com/UbiquityDotNET/Ubiquity.NET.Versioning/wiki).
76+
Documentation on building and general maintenance of this repo are provided in the
77+
[Wiki](https://github.com/UbiquityDotNET/Ubiquity.NET.Versioning/wiki).
6378

6479
----
65-
<sup><a id="footnote_1">1</a></sup>See: [This issue](https://github.com/CK-Build/csemver.org/issues/2) which was reported upon
66-
testing this library and found ambiguities.
80+
<sup><a id="footnote_1">1</a></sup>See: [This issue](https://github.com/CK-Build/csemver.org/issues/2)
81+
which was reported upon testing this library and found ambiguities.
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net9.0</TargetFramework>
3+
<TargetFramework>net8.0</TargetFramework>
44
<IsPackable>false</IsPackable>
55
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
66
</PropertyGroup>
7+
78
<ItemGroup>
89
<PackageReference Include="Microsoft.NET.Test.Sdk" />
910
<PackageReference Include="MSTest.TestFramework" />
1011
<PackageReference Include="MSTest.TestAdapter" />
1112
</ItemGroup>
13+
1214
<ItemGroup>
1315
<ProjectReference Include="..\Ubiquity.NET.Versioning\Ubiquity.NET.Versioning.csproj" />
1416
</ItemGroup>
17+
1518
<ItemGroup>
1619
<None Update="TestBuildVersion.xml">
1720
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
1821
</None>
1922
</ItemGroup>
23+
2024
</Project>

src/Ubiquity.NET.Versioning/Properties/Resources.resx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,4 @@
145145
<value>'{0}' must be in range {1}. {2}</value>
146146
<comment>{0} - Value name; {1} - range notation for the value; {2} post message text (Usually a spec reference)</comment>
147147
</data>
148-
<data name="value_0_must_be_in_range_1" xml:space="preserve">
149-
<value>'{0}' must be in range {1}.</value>
150-
<comment>{0} - Value name; {1} - range notation for the value</comment>
151-
</data>
152-
</root>
148+
</root>

src/Ubiquity.NET.Versioning/Ubiquity.NET.Versioning.csproj

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFramework>net9.0</TargetFramework>
3+
<TargetFramework>net8.0</TargetFramework>
44
<Nullable>enable</Nullable>
5+
<IsAotCompatible>true</IsAotCompatible>
6+
<NeutralLanguage>en-US</NeutralLanguage>
7+
58
<PackageId>Ubiquity.NET.Versioning</PackageId>
69
<Authors>UbiquityDotNET</Authors>
710
<Copyright>Copyright (C) 2017-2020, Ubiquity.NET Contributors</Copyright>
@@ -15,20 +18,23 @@
1518
<PackageTags>Version;CSemVer;CI;SemVer</PackageTags>
1619
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1720
<GenerateDocumentationFile>True</GenerateDocumentationFile>
18-
<PackageReadmeFile>ReadMe.md</PackageReadmeFile>
19-
<IsAotCompatible>True</IsAotCompatible>
20-
<NeutralLanguage>en-US</NeutralLanguage>
21+
<PackageReadmeFile>PackageReadMe.md</PackageReadmeFile>
2122
</PropertyGroup>
23+
2224
<ItemGroup>
2325
<PackageReference Include="Sprache" />
26+
<!-- Override dependent version with explicit form to resolve CVE vulnerability -->
27+
<PackageReference Include="System.Text.RegularExpressions" />
2428
</ItemGroup>
29+
2530
<ItemGroup>
2631
<Compile Update="Properties\Resources.Designer.cs">
2732
<DesignTime>True</DesignTime>
2833
<AutoGen>True</AutoGen>
2934
<DependentUpon>Resources.resx</DependentUpon>
3035
</Compile>
3136
</ItemGroup>
37+
3238
<ItemGroup>
3339
<EmbeddedResource Update="Properties\Resources.resx">
3440
<Generator>ResXFileCodeGenerator</Generator>
@@ -37,6 +43,6 @@
3743
</ItemGroup>
3844

3945
<ItemGroup>
40-
<None Update="PackageReadMe.md" Pack="true" PackagePath="ReadMe.md" />
46+
<None Include="PackageReadMe.md" Pack="true" PackagePath="/" />
4147
</ItemGroup>
4248
</Project>

0 commit comments

Comments
 (0)