Skip to content

Commit a603c7f

Browse files
GitHubSync update - release-6.1 (#4630)
* GitHubSync update - release-6.1 * Remove redundant setting * Update Particular.Licensing.Sources * Update transitive package references * Update Microsoft.NET.Test.Sdk * Update Microsoft.Build.CopyOnWrite --------- Co-authored-by: internalautomation[bot] <85681268+internalautomation[bot]@users.noreply.github.com> Co-authored-by: Brandon Ording <[email protected]>
1 parent 155e83c commit a603c7f

File tree

7 files changed

+107
-14
lines changed

7 files changed

+107
-14
lines changed

src/Custom.Build.props

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
<!-- Remove after upgrading to NServiceBus 8.x -->
1212
<ParticularAnalyzersVersion>0.9.0</ParticularAnalyzersVersion>
1313
<ServerGarbageCollection>true</ServerGarbageCollection>
14-
<NuGetAuditMode>all</NuGetAuditMode>
1514
</PropertyGroup>
1615

1716
<PropertyGroup>

src/Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
<EnableNETAnalyzers>true</EnableNETAnalyzers>
88
<AnalysisLevel Condition="'$(AnalysisLevel)' == ''">5.0</AnalysisLevel>
99
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
10-
<!-- NuGetAuditMode set to 'all' for tool projects in Directory.Build.targets, other project types default to 'direct' -->
1110
<NuGetAuditLevel>low</NuGetAuditLevel>
11+
<NuGetAuditMode Condition="'$(NuGetAuditMode)' == ''">all</NuGetAuditMode>
1212
<!-- To lock the version of Particular.Analyzers, for example, in a release branch, set this property in Custom.Build.props -->
13-
<ParticularAnalyzersVersion Condition="'$(ParticularAnalyzersVersion)' == ''">2.1.2</ParticularAnalyzersVersion>
13+
<ParticularAnalyzersVersion Condition="'$(ParticularAnalyzersVersion)' == ''">2.1.3</ParticularAnalyzersVersion>
1414
<NServiceBusKey>0024000004800000940000000602000000240000525341310004000001000100dde965e6172e019ac82c2639ffe494dd2e7dd16347c34762a05732b492e110f2e4e2e1b5ef2d85c848ccfb671ee20a47c8d1376276708dc30a90ff1121b647ba3b7259a6bc383b2034938ef0e275b58b920375ac605076178123693c6c4f1331661a62eba28c249386855637780e3ff5f23a6d854700eaa6803ef48907513b92</NServiceBusKey>
1515
<NServiceBusTestsKey>00240000048000009400000006020000002400005253413100040000010001007f16e21368ff041183fab592d9e8ed37e7be355e93323147a1d29983d6e591b04282e4da0c9e18bd901e112c0033925eb7d7872c2f1706655891c5c9d57297994f707d16ee9a8f40d978f064ee1ffc73c0db3f4712691b23bf596f75130f4ec978cf78757ec034625a5f27e6bb50c618931ea49f6f628fd74271c32959efb1c5</NServiceBusTestsKey>
1616
</PropertyGroup>

src/Directory.Build.targets

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<Project>
22

3-
<PropertyGroup>
4-
<NuGetAuditMode Condition="'$(PackAsTool)' == 'true'">all</NuGetAuditMode>
5-
</PropertyGroup>
3+
<Import Project="msbuild\AutomaticVersionRanges.targets" Condition="Exists('msbuild\AutomaticVersionRanges.targets')" />
64

75
</Project>

src/Directory.Packages.props

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<PackageVersion Include="Microsoft.Extensions.Hosting.Abstractions" Version="8.0.1" />
2525
<PackageVersion Include="Microsoft.Extensions.Hosting.WindowsServices" Version="8.0.1" />
2626
<PackageVersion Include="Microsoft.Extensions.TimeProvider.Testing" Version="8.10.0" />
27-
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
27+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
2828
<PackageVersion Include="Microsoft-WindowsAPICodePack-Shell" Version="1.1.5" />
2929
<PackageVersion Include="Mindscape.Raygun4Net.NetCore" Version="11.1.2" />
3030
<PackageVersion Include="NLog.Extensions.Logging" Version="5.3.14" />
@@ -51,7 +51,7 @@
5151
<PackageVersion Include="NUnit.Analyzers" Version="4.4.0" />
5252
<PackageVersion Include="NUnit3TestAdapter" Version="4.6.0" />
5353
<PackageVersion Include="Particular.Approvals" Version="2.0.0" />
54-
<PackageVersion Include="Particular.Licensing.Sources" Version="5.1.0" />
54+
<PackageVersion Include="Particular.Licensing.Sources" Version="6.0.0" />
5555
<PackageVersion Include="Particular.LicensingComponent.Report" Version="1.0.0" />
5656
<PackageVersion Include="Polly.Core" Version="8.5.0" />
5757
<PackageVersion Include="PropertyChanged.Fody" Version="4.1.0" />
@@ -75,19 +75,16 @@
7575
<ItemGroup Label="Versions to pin transitive references">
7676
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
7777
<PackageVersion Include="Microsoft.Extensions.Diagnostics" Version="8.0.1" />
78-
<PackageVersion Include="System.Drawing.Common" Version="8.0.10" />
7978
<PackageVersion Include="System.IO.Hashing" Version="8.0.0" />
8079
<PackageVersion Include="System.Net.Http" Version="4.3.4" />
8180
<PackageVersion Include="System.Private.Uri" Version="4.3.2" />
82-
<PackageVersion Include="System.Runtime.Caching" Version="8.0.1" />
83-
<PackageVersion Include="System.Security.Cryptography.Pkcs" Version="8.0.1" />
8481
<PackageVersion Include="System.Security.Cryptography.ProtectedData" Version="8.0.0" />
85-
<PackageVersion Include="System.Text.Json" Version="8.0.5" />
82+
<PackageVersion Include="System.Security.Cryptography.Xml" Version="8.0.2" />
8683
<PackageVersion Include="System.Text.RegularExpressions" Version="4.3.1" />
8784
</ItemGroup>
8885
<ItemGroup>
8986
<GlobalPackageReference Include="Microsoft.Build.Artifacts" Version="6.1.48" />
90-
<GlobalPackageReference Include="Microsoft.Build.CopyOnWrite" Version="1.0.330" />
87+
<GlobalPackageReference Include="Microsoft.Build.CopyOnWrite" Version="1.0.334" />
9188
<GlobalPackageReference Include="Particular.Packaging" Version="4.2.0" />
9289
</ItemGroup>
9390
</Project>

src/ServiceControl.LicenseManagement/LicenseManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public static bool TryImportLicense(string licenseFile, out string errorMessage)
3939
{
4040
var licenseText = NonBlockingReader.ReadAllTextWithoutLocking(licenseFile);
4141
var machineLevelLicenseLocation = LicenseFileLocationResolver.GetPathFor(Environment.SpecialFolder.CommonApplicationData);
42-
new FilePathLicenseStore().StoreLicense(machineLevelLicenseLocation, licenseText);
42+
FilePathLicenseStore.StoreLicense(machineLevelLicenseLocation, licenseText);
4343
}
4444
catch (Exception)
4545
{
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<Project>
2+
3+
<PropertyGroup>
4+
<AutomaticVersionRangesEnabled Condition="'$(AutomaticVersionRangesEnabled)' == '' And '$(Configuration)' == 'Debug'">false</AutomaticVersionRangesEnabled>
5+
<AutomaticVersionRangesEnabled Condition="'$(AutomaticVersionRangesEnabled)' == '' And '$(IsPackable)' == 'false'">false</AutomaticVersionRangesEnabled>
6+
<AutomaticVersionRangesEnabled Condition="'$(AutomaticVersionRangesEnabled)' == '' And '$(ManagePackageVersionsCentrally)' == 'true'">false</AutomaticVersionRangesEnabled>
7+
<AutomaticVersionRangesEnabled Condition="'$(AutomaticVersionRangesEnabled)' == ''">true</AutomaticVersionRangesEnabled>
8+
</PropertyGroup>
9+
10+
<UsingTask TaskName="ConvertToVersionRange" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
11+
<Task>
12+
<Code Source="$(MSBuildThisFileDirectory)ConvertToVersionRange.cs" />
13+
</Task>
14+
</UsingTask>
15+
16+
<Target Name="ConvertProjectReferenceVersionsToVersionRanges" AfterTargets="_GetProjectReferenceVersions" Condition="'$(AutomaticVersionRangesEnabled)' == 'true'">
17+
<PropertyGroup>
18+
<NumberOfProjectReferences>@(_ProjectReferencesWithVersions->Count())</NumberOfProjectReferences>
19+
</PropertyGroup>
20+
<ConvertToVersionRange Condition="$(NumberOfProjectReferences) &gt; 0" References="@(_ProjectReferencesWithVersions)" VersionProperty="ProjectVersion">
21+
<Output TaskParameter="ReferencesWithVersionRanges" ItemName="_ProjectReferencesWithVersionRanges" />
22+
</ConvertToVersionRange>
23+
<ItemGroup Condition="$(NumberOfProjectReferences) &gt; 0">
24+
<_ProjectReferencesWithVersions Remove="@(_ProjectReferencesWithVersions)" />
25+
<_ProjectReferencesWithVersions Include="@(_ProjectReferencesWithVersionRanges)" />
26+
</ItemGroup>
27+
</Target>
28+
29+
<Target Name="ConvertPackageReferenceVersionsToVersionRanges" BeforeTargets="CollectPackageReferences" Condition="'$(AutomaticVersionRangesEnabled)' == 'true'">
30+
<PropertyGroup>
31+
<NumberOfPackageReferences>@(PackageReference->Count())</NumberOfPackageReferences>
32+
</PropertyGroup>
33+
<ConvertToVersionRange Condition="$(NumberOfPackageReferences) &gt; 0" References="@(PackageReference)" VersionProperty="Version">
34+
<Output TaskParameter="ReferencesWithVersionRanges" ItemName="_PackageReferencesWithVersionRanges" />
35+
</ConvertToVersionRange>
36+
<ItemGroup Condition="$(NumberOfPackageReferences) &gt; 0">
37+
<PackageReference Remove="@(PackageReference)" />
38+
<PackageReference Include="@(_PackageReferencesWithVersionRanges)" />
39+
</ItemGroup>
40+
</Target>
41+
42+
</Project>
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
using System;
2+
using System.Text.RegularExpressions;
3+
using Microsoft.Build.Framework;
4+
using Microsoft.Build.Utilities;
5+
6+
public class ConvertToVersionRange : Task
7+
{
8+
[Required]
9+
public ITaskItem[] References { get; set; } = [];
10+
11+
[Required]
12+
public string VersionProperty { get; set; } = string.Empty;
13+
14+
[Output]
15+
public ITaskItem[] ReferencesWithVersionRanges { get; private set; } = [];
16+
17+
public override bool Execute()
18+
{
19+
var success = true;
20+
21+
foreach (var reference in References)
22+
{
23+
var automaticVersionRange = reference.GetMetadata("AutomaticVersionRange");
24+
25+
if (automaticVersionRange.Equals("false", StringComparison.OrdinalIgnoreCase))
26+
{
27+
continue;
28+
}
29+
30+
var privateAssets = reference.GetMetadata("PrivateAssets");
31+
32+
if (privateAssets.Equals("All", StringComparison.OrdinalIgnoreCase))
33+
{
34+
continue;
35+
}
36+
37+
var version = reference.GetMetadata(VersionProperty);
38+
var match = Regex.Match(version, @"^\d+");
39+
40+
if (match.Value.Equals(string.Empty, StringComparison.Ordinal))
41+
{
42+
Log.LogError("Reference '{0}' with version '{1}' is not valid for automatic version range conversion. Fix the version or exclude the reference from conversion by setting 'AutomaticVersionRange=\"false\"' on the reference.", reference.ItemSpec, version);
43+
success = false;
44+
continue;
45+
}
46+
47+
var nextMajor = Convert.ToInt32(match.Value) + 1;
48+
49+
var versionRange = $"[{version}, {nextMajor}.0.0)";
50+
reference.SetMetadata(VersionProperty, versionRange);
51+
}
52+
53+
ReferencesWithVersionRanges = References;
54+
55+
return success;
56+
}
57+
}

0 commit comments

Comments
 (0)