-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* GitHubSync update - master * Consolidate NServiceBus to 8.2.4 * Bump Microsoft.NET.Test.Sdk to 17.12.0 * Bump NUnit.Analyzers to 4.4.0 * Bump Particular.Approvals to 1.1.1 * Bump Particular.Packaging to 4.2.0 * Bump NUnit to 4.2.2 * Remove the range for NServiceBus.Newtonsoft.Json * Consolidates NServiceBus.Transport.AzureServiceBus to 3.2.3 * Tweaks * Update workflow files * Update Microsoft.NET.Sdk.Functions * Fix permissions on Linux tool --------- Co-authored-by: internalautomation[bot] <85681268+internalautomation[bot]@users.noreply.github.com> Co-authored-by: Tamara Rivera <[email protected]> Co-authored-by: Brandon Ording <[email protected]>
- Loading branch information
1 parent
7af2d50
commit b956f5e
Showing
16 changed files
with
158 additions
and
64 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
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 |
---|---|---|
|
@@ -35,19 +35,21 @@ jobs: | |
- name: Setup .NET SDK | ||
uses: actions/[email protected] | ||
with: | ||
dotnet-version: | | ||
6.0.x | ||
- name: Setup Azure Core tools - Windows | ||
dotnet-version: 8.0.x | ||
- name: Setup Azure Functions Core Tools - Windows | ||
if: runner.os == 'Windows' | ||
run: | | ||
choco install azure-functions-core-tools | ||
echo "PathToFuncExe=C:\ProgramData\chocolatey\lib\azure-functions-core-tools\tools\func.exe" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append | ||
- name: Setup Azure Core tools - Linux | ||
- name: Setup Azure Functions Core Tools - Linux | ||
if: runner.os == 'Linux' | ||
run: | | ||
sudo apt-get install azure-functions-core-tools -y | ||
echo "PathToFuncExe=func" >> $GITHUB_ENV | ||
shell: bash | ||
- name: Fix Azure Functions Core Tools permissions - Linux | ||
if: runner.os == 'Linux' | ||
run: sudo chmod +x /usr/lib/azure-functions-core-tools/in-proc6/func | ||
- name: Build | ||
run: dotnet build src --configuration Release | ||
- name: Upload packages | ||
|
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 |
---|---|---|
|
@@ -20,7 +20,7 @@ jobs: | |
- name: Setup .NET SDK | ||
uses: actions/[email protected] | ||
with: | ||
dotnet-version: 7.0.x | ||
dotnet-version: 8.0.x | ||
- name: Build | ||
run: dotnet build src --configuration Release | ||
- name: Sign NuGet packages | ||
|
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 |
---|---|---|
@@ -1,7 +1,5 @@ | ||
<Project> | ||
|
||
<PropertyGroup> | ||
<NuGetAuditMode Condition="'$(PackAsTool)' == 'true'">all</NuGetAuditMode> | ||
</PropertyGroup> | ||
<Import Project="msbuild\AutomaticVersionRanges.targets" Condition="Exists('msbuild\AutomaticVersionRanges.targets')" /> | ||
|
||
</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
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
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
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
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
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 @@ | ||
<Project> | ||
|
||
<PropertyGroup> | ||
<AutomaticVersionRangesEnabled Condition="'$(AutomaticVersionRangesEnabled)' == '' And '$(Configuration)' == 'Debug'">false</AutomaticVersionRangesEnabled> | ||
<AutomaticVersionRangesEnabled Condition="'$(AutomaticVersionRangesEnabled)' == '' And '$(IsPackable)' == 'false'">false</AutomaticVersionRangesEnabled> | ||
<AutomaticVersionRangesEnabled Condition="'$(AutomaticVersionRangesEnabled)' == '' And '$(ManagePackageVersionsCentrally)' == 'true'">false</AutomaticVersionRangesEnabled> | ||
<AutomaticVersionRangesEnabled Condition="'$(AutomaticVersionRangesEnabled)' == ''">true</AutomaticVersionRangesEnabled> | ||
</PropertyGroup> | ||
|
||
<UsingTask TaskName="ConvertToVersionRange" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll"> | ||
<Task> | ||
<Code Source="$(MSBuildThisFileDirectory)ConvertToVersionRange.cs" /> | ||
</Task> | ||
</UsingTask> | ||
|
||
<Target Name="ConvertProjectReferenceVersionsToVersionRanges" AfterTargets="_GetProjectReferenceVersions" Condition="'$(AutomaticVersionRangesEnabled)' == 'true'"> | ||
<PropertyGroup> | ||
<NumberOfProjectReferences>@(_ProjectReferencesWithVersions->Count())</NumberOfProjectReferences> | ||
</PropertyGroup> | ||
<ConvertToVersionRange Condition="$(NumberOfProjectReferences) > 0" References="@(_ProjectReferencesWithVersions)" VersionProperty="ProjectVersion"> | ||
<Output TaskParameter="ReferencesWithVersionRanges" ItemName="_ProjectReferencesWithVersionRanges" /> | ||
</ConvertToVersionRange> | ||
<ItemGroup Condition="$(NumberOfProjectReferences) > 0"> | ||
<_ProjectReferencesWithVersions Remove="@(_ProjectReferencesWithVersions)" /> | ||
<_ProjectReferencesWithVersions Include="@(_ProjectReferencesWithVersionRanges)" /> | ||
</ItemGroup> | ||
</Target> | ||
|
||
<Target Name="ConvertPackageReferenceVersionsToVersionRanges" BeforeTargets="CollectPackageReferences" Condition="'$(AutomaticVersionRangesEnabled)' == 'true'"> | ||
<PropertyGroup> | ||
<NumberOfPackageReferences>@(PackageReference->Count())</NumberOfPackageReferences> | ||
</PropertyGroup> | ||
<ConvertToVersionRange Condition="$(NumberOfPackageReferences) > 0" References="@(PackageReference)" VersionProperty="Version"> | ||
<Output TaskParameter="ReferencesWithVersionRanges" ItemName="_PackageReferencesWithVersionRanges" /> | ||
</ConvertToVersionRange> | ||
<ItemGroup Condition="$(NumberOfPackageReferences) > 0"> | ||
<PackageReference Remove="@(PackageReference)" /> | ||
<PackageReference Include="@(_PackageReferencesWithVersionRanges)" /> | ||
</ItemGroup> | ||
</Target> | ||
|
||
</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,57 @@ | ||
using System; | ||
using System.Text.RegularExpressions; | ||
using Microsoft.Build.Framework; | ||
using Microsoft.Build.Utilities; | ||
|
||
public class ConvertToVersionRange : Task | ||
{ | ||
[Required] | ||
public ITaskItem[] References { get; set; } = []; | ||
|
||
[Required] | ||
public string VersionProperty { get; set; } = string.Empty; | ||
|
||
[Output] | ||
public ITaskItem[] ReferencesWithVersionRanges { get; private set; } = []; | ||
|
||
public override bool Execute() | ||
{ | ||
var success = true; | ||
|
||
foreach (var reference in References) | ||
{ | ||
var automaticVersionRange = reference.GetMetadata("AutomaticVersionRange"); | ||
|
||
if (automaticVersionRange.Equals("false", StringComparison.OrdinalIgnoreCase)) | ||
{ | ||
continue; | ||
} | ||
|
||
var privateAssets = reference.GetMetadata("PrivateAssets"); | ||
|
||
if (privateAssets.Equals("All", StringComparison.OrdinalIgnoreCase)) | ||
{ | ||
continue; | ||
} | ||
|
||
var version = reference.GetMetadata(VersionProperty); | ||
var match = Regex.Match(version, @"^\d+"); | ||
|
||
if (match.Value.Equals(string.Empty, StringComparison.Ordinal)) | ||
{ | ||
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); | ||
success = false; | ||
continue; | ||
} | ||
|
||
var nextMajor = Convert.ToInt32(match.Value) + 1; | ||
|
||
var versionRange = $"[{version}, {nextMajor}.0.0)"; | ||
reference.SetMetadata(VersionProperty, versionRange); | ||
} | ||
|
||
ReferencesWithVersionRanges = References; | ||
|
||
return success; | ||
} | ||
} |