- Add Microsoft.VisualStudioEng.MicroBuild.Core Nuget package

- Include FilesToSign ItemGroups
- Add the MicroBuild Signing Plugin task
- Add NuGet signing
This commit is contained in:
Vincent Baaij 2024-03-23 00:15:50 +01:00
Родитель f28243ac9b
Коммит d181699500
11 изменённых файлов: 109 добавлений и 13 удалений

Просмотреть файл

@ -24,6 +24,12 @@ parameters:
variables:
- template: common/versioning.yml@self # Versions
- name: SignType
value: 'test'
- name: TeamName
value: 'FluentUI-Blazor'
# The `resources` specify the location and version of the 1ES PT.
resources:
repositories:
@ -214,6 +220,14 @@ extends:
command: 'restore'
projects: ${{ parameters.Projects }}
# Sign the packages
- task: MicroBuildSigningPlugin@4
inputs:
signType: '$(SignType)'
feedSource: 'https://devdiv.pkgs.visualstudio.com/DefaultCollection/_packaging/MicroBuildToolset/nuget/v3/index.json'
env:
TeamName: '$(TeamName)'
# Build the projects
- task: DotNetCoreCLI@2
displayName: 'Build $(Build.BuildNumber)'
@ -263,7 +277,12 @@ extends:
OverWrite: true
flattenFolders: true
# ESRP Code Signing SC
# Sign
- task: MSBuild@1
displayName: 'Sign NuGet Packages'
inputs:
solution: 'Microsoft.FluentUI.signproj'
msbuildArguments: '/p:OutDir=$(Build.ArtifactStagingDirectory) /p:IntermediateOutputPath=$(Build.ArtifactStagingDirectory)'
# Publish the projects
- task: DotNetCoreCLI@2

Просмотреть файл

@ -7,7 +7,7 @@
</PropertyGroup>
<ItemGroup>
<!-- For Sample Apps -->
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components" Version="4.3.1" />
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components" Version="4.5.0" />
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components.Emoji" Version="4.5.0" />
<PackageVersion Include="Microsoft.FluentUI.AspNetCore.Components.Icons" version="4.5.0" />
<!-- Build dependencies -->
@ -27,6 +27,7 @@
<PackageVersion Include="Microsoft.Extensions.Http" Version="$(RuntimeVersion)" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="$(RuntimeVersion)" />
<PackageVersion Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.9.28" />
<PackageVersion Include="Microsoft.VisualStudioEng.MicroBuild.Core" Version="1.0.0" />
<PackageVersion Include="System.Text.Encodings.Web" Version="$(RuntimeVersion)" />
<PackageVersion Include="System.Text.Json" Version="8.0.3" />
<!-- Test dependencies -->

28
nuget-package.signproj Normal file
Просмотреть файл

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" Sdk="Microsoft.Build.NoTargets/3.7.56">
<PropertyGroup>
<SolutionDir Condition="'$(SolutionDir)'==''">..\..\</SolutionDir>
<SolutionDir Condition="!HasTrailingSlash('$(SolutionDir)')">$(SolutionDir)\</SolutionDir>
<OutDir Condition="'$(OutDir)'==''">$(SolutionDir)bin\$(Configuration)\</OutDir>
<OutDir Condition="!HasTrailingSlash('$(OutDir)')">$(OutDir)\</OutDir>
<IntermediateOutputPath Condition="'$(IntermediateOutputPath)'==''">$(SolutionDir)obj\$(Configuration)\</IntermediateOutputPath>
<IntermediateOutputPath Condition="!HasTrailingSlash('$(IntermediateOutputPath)')">$(IntermediateOutputPath)\</IntermediateOutputPath>
<TargetFramework>net48</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudioEng.MicroBuild.Core" version="1.0.0" />
</ItemGroup>
<Target Name="Sign" DependsOnTargets="$(SignDependsOn)" AfterTargets="AfterBuild">
<PropertyGroup>
<OutDir Condition="!HasTrailingSlash('$(OutDir)')">$(OutDir)\</OutDir>
<IntermediateOutputPath Condition="!HasTrailingSlash('$(IntermediateOutputPath)')">$(IntermediateOutputPath)\</IntermediateOutputPath>
</PropertyGroup>
<ItemGroup>
<FilesToSign Include="$(OutDir)**\*.nupkg">
<Authenticode>NuGet</Authenticode>
</FilesToSign>
</ItemGroup>
</Target>
</Project>

Просмотреть файл

@ -33,6 +33,17 @@
<ItemGroup>
<PackageReference Include="Microsoft.FluentUI.AspNetCore.Components" />
<PackageReference Include="Microsoft.VisualStudioEng.MicroBuild.Core">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<FilesToSign Include="$(OutDir)\Microsoft.FluentUI.AspNetCore.Components.Emoji.dll">
<Authenticode>Microsoft400</Authenticode>
<StrongName>MicrosoftFluentUIAspNetCoreComponentsEmoji</StrongName>
</FilesToSign>
</ItemGroup>
</Project>

Просмотреть файл

@ -37,6 +37,17 @@
<ItemGroup>
<PackageReference Include="Microsoft.FluentUI.AspNetCore.Components" />
<PackageReference Include="Microsoft.VisualStudioEng.MicroBuild.Core">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<FilesToSign Include="$(OutDir)\Microsoft.FluentUI.AspNetCore.Components.Icons.dll">
<Authenticode>Microsoft400</Authenticode>
<StrongName>MicrosoftFluentUIAspNetCoreComponentsIcons</StrongName>
</FilesToSign>
</ItemGroup>
</Project>

Просмотреть файл

@ -1,4 +1,4 @@
using System.Diagnostics;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using Microsoft.Extensions.Configuration;
@ -152,7 +152,7 @@ internal class Configuration
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
static string GetThisFilePath([CallerFilePath] string? path = null)
private static string GetThisFilePath([CallerFilePath] string? path = null)
{
if (Debugger.IsAttached)
{

Просмотреть файл

@ -1,4 +1,4 @@
using System.Diagnostics;
using System.Diagnostics;
using System.Text.RegularExpressions;
namespace Microsoft.FluentUI.AspNetCore.Components.AssetsGenerator.Model;
@ -9,7 +9,7 @@ namespace Microsoft.FluentUI.AspNetCore.Components.AssetsGenerator.Model;
[DebuggerDisplay("{Name} {Variant} {Size}")]
internal class Icon
{
private string[] LangageSubFolders = new[] { "bg", "ca", "da", "de", "en", "es", "et", "fr", "gl", "hu", "it", "kk", "ko", "lt", "lv", "ms", "no", "pt", "ru", "sl", "sr-cyrl", "sr-latn", "sv" };
private readonly string[] LangageSubFolders = new[] { "bg", "ca", "da", "de", "en", "es", "et", "fr", "gl", "hu", "it", "kk", "ko", "lt", "lv", "ms", "no", "pt", "ru", "sl", "sr-cyrl", "sr-latn", "sv" };
/// <summary>
/// Convert the file to an icon

Просмотреть файл

@ -1,11 +1,8 @@
using System.Linq;
using Microsoft.FluentUI.AspNetCore.Components.AssetsGenerator.Model;
namespace Microsoft.FluentUI.AspNetCore.Components.AssetsGenerator;
internal class Program
{
static void Main(string[] args)
public static void Main(string[] args)
{
var configuration = new Configuration(args);
@ -43,7 +40,7 @@ internal class Program
var assets = factoryIcons.ReadAllAssets()
// All names (if not specified) or Only specified names
.Where(i => configuration.Names.Any() == false ||
configuration.Names.Any(name => String.Compare(name.Replace("_", string.Empty), i.Key.Replace("_", string.Empty), StringComparison.InvariantCultureIgnoreCase) == 0))
configuration.Names.Any(name => string.Compare(name.Replace("_", string.Empty), i.Key.Replace("_", string.Empty), StringComparison.InvariantCultureIgnoreCase) == 0))
// All sizes (if not specified) or Only specified sizes
.Where(i => configuration.Sizes.Any() == false ||
configuration.Sizes.Contains(i.Size));
@ -73,7 +70,7 @@ internal class Program
var emojis = factoryEmojis.ReadAllAssets()
// All names (if not specified) or Only specified names
.Where(i => configuration.Names.Any() == false ||
configuration.Names.Any(name => String.Compare(name + ".svg", i.File.Name, StringComparison.InvariantCultureIgnoreCase) == 0));
configuration.Names.Any(name => string.Compare(name + ".svg", i.File.Name, StringComparison.InvariantCultureIgnoreCase) == 0));
// Remove the duplicates
var duplicateBoy = emojis.FirstOrDefault(i => i.File.Name == "boy_high_contrast_default.svg");
@ -92,4 +89,4 @@ internal class Program
// Sample
// var x = Icons.Regular.Size24.Accessibility;
}
}
}

Просмотреть файл

@ -70,6 +70,10 @@
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" />
<PackageReference Include="Microsoft.Extensions.Http" />
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" />
<PackageReference Include="Microsoft.VisualStudioEng.MicroBuild.Core">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
@ -109,4 +113,11 @@
<LastGenOutput>%(ParentFile).Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<FilesToSign Include="$(OutDir)\Microsoft.FluentUI.AspNetCore.Components.dll">
<Authenticode>Microsoft400</Authenticode>
<StrongName>MicrosoftFluentUIAspNetCoreComponents</StrongName>
</FilesToSign>
</ItemGroup>
</Project>

Просмотреть файл

@ -42,6 +42,10 @@
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" />
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" />
<PackageReference Include="Microsoft.VisualStudioEng.MicroBuild.Core">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
@ -56,4 +60,11 @@
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true' Or '$(TF_BUILD)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>
<ItemGroup>
<FilesToSign Include="$(OutDir)\Microsoft.FluentUI.AspNetCore.Components.DataGrid.EntityFrameworkAdapter.dll">
<Authenticode>Microsoft400</Authenticode>
<StrongName>MicrosoftFluentUIAspNetCoreComponentsDataGridEntityFrameworkAdapter</StrongName>
</FilesToSign>
</ItemGroup>
</Project>

Просмотреть файл

@ -36,4 +36,11 @@
<None Include="..\..\icon.png" Pack="true" PackagePath="\" />
<Compile Remove="**\*" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudioEng.MicroBuild.Core">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
</Project>