From d181699500e71775f6be21a300a6ce7bf836ab31 Mon Sep 17 00:00:00 2001 From: Vincent Baaij Date: Sat, 23 Mar 2024 00:15:50 +0100 Subject: [PATCH] - Add Microsoft.VisualStudioEng.MicroBuild.Core Nuget package - Include FilesToSign ItemGroups - Add the MicroBuild Signing Plugin task - Add NuGet signing --- .azure-devops/build-core-lib.yml | 21 +++++++++++++- Directory.Packages.props | 3 +- nuget-package.signproj | 28 +++++++++++++++++++ ...luentUI.AspNetCore.Components.Emoji.csproj | 11 ++++++++ ...luentUI.AspNetCore.Components.Icons.csproj | 11 ++++++++ src/Assets/Generator/Configuration.cs | 4 +-- src/Assets/Generator/Model/Icon.cs | 4 +-- src/Assets/Generator/Program.cs | 11 +++----- ...soft.FluentUI.AspNetCore.Components.csproj | 11 ++++++++ ...nts.DataGrid.EntityFrameworkAdapter.csproj | 11 ++++++++ ...osoft.FluentUI.AspNetCore.Templates.csproj | 7 +++++ 11 files changed, 109 insertions(+), 13 deletions(-) create mode 100644 nuget-package.signproj diff --git a/.azure-devops/build-core-lib.yml b/.azure-devops/build-core-lib.yml index caeead35d..0abd41dc6 100644 --- a/.azure-devops/build-core-lib.yml +++ b/.azure-devops/build-core-lib.yml @@ -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 diff --git a/Directory.Packages.props b/Directory.Packages.props index d1c70da89..2ddf68e72 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,7 +7,7 @@ - + @@ -27,6 +27,7 @@ + diff --git a/nuget-package.signproj b/nuget-package.signproj new file mode 100644 index 000000000..5a81e4051 --- /dev/null +++ b/nuget-package.signproj @@ -0,0 +1,28 @@ + + + + ..\..\ + $(SolutionDir)\ + $(SolutionDir)bin\$(Configuration)\ + $(OutDir)\ + $(SolutionDir)obj\$(Configuration)\ + $(IntermediateOutputPath)\ + net48 + + + + + + + + + $(OutDir)\ + $(IntermediateOutputPath)\ + + + + NuGet + + + + diff --git a/src/Assets/FluentUI.Emojis/Microsoft.FluentUI.AspNetCore.Components.Emoji.csproj b/src/Assets/FluentUI.Emojis/Microsoft.FluentUI.AspNetCore.Components.Emoji.csproj index 50d6952ca..988fc4835 100644 --- a/src/Assets/FluentUI.Emojis/Microsoft.FluentUI.AspNetCore.Components.Emoji.csproj +++ b/src/Assets/FluentUI.Emojis/Microsoft.FluentUI.AspNetCore.Components.Emoji.csproj @@ -33,6 +33,17 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + Microsoft400 + MicrosoftFluentUIAspNetCoreComponentsEmoji + + + diff --git a/src/Assets/FluentUI.Icons/Microsoft.FluentUI.AspNetCore.Components.Icons.csproj b/src/Assets/FluentUI.Icons/Microsoft.FluentUI.AspNetCore.Components.Icons.csproj index dd47b5f1b..aa134ab93 100644 --- a/src/Assets/FluentUI.Icons/Microsoft.FluentUI.AspNetCore.Components.Icons.csproj +++ b/src/Assets/FluentUI.Icons/Microsoft.FluentUI.AspNetCore.Components.Icons.csproj @@ -37,6 +37,17 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + Microsoft400 + MicrosoftFluentUIAspNetCoreComponentsIcons + + + diff --git a/src/Assets/Generator/Configuration.cs b/src/Assets/Generator/Configuration.cs index 2f2aaf212..a079eddea 100644 --- a/src/Assets/Generator/Configuration.cs +++ b/src/Assets/Generator/Configuration.cs @@ -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 /// /// /// - static string GetThisFilePath([CallerFilePath] string? path = null) + private static string GetThisFilePath([CallerFilePath] string? path = null) { if (Debugger.IsAttached) { diff --git a/src/Assets/Generator/Model/Icon.cs b/src/Assets/Generator/Model/Icon.cs index 6d0ecc5d7..0099e50de 100644 --- a/src/Assets/Generator/Model/Icon.cs +++ b/src/Assets/Generator/Model/Icon.cs @@ -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" }; /// /// Convert the file to an icon diff --git a/src/Assets/Generator/Program.cs b/src/Assets/Generator/Program.cs index dc9278208..bac05e220 100644 --- a/src/Assets/Generator/Program.cs +++ b/src/Assets/Generator/Program.cs @@ -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; } -} \ No newline at end of file +} diff --git a/src/Core/Microsoft.FluentUI.AspNetCore.Components.csproj b/src/Core/Microsoft.FluentUI.AspNetCore.Components.csproj index 02126d311..eece2c88d 100644 --- a/src/Core/Microsoft.FluentUI.AspNetCore.Components.csproj +++ b/src/Core/Microsoft.FluentUI.AspNetCore.Components.csproj @@ -70,6 +70,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + @@ -109,4 +113,11 @@ %(ParentFile).Designer.cs + + + + Microsoft400 + MicrosoftFluentUIAspNetCoreComponents + + diff --git a/src/Extensions/DataGrid.EntityFrameworkAdapter/Microsoft.FluentUI.AspNetCore.Components.DataGrid.EntityFrameworkAdapter.csproj b/src/Extensions/DataGrid.EntityFrameworkAdapter/Microsoft.FluentUI.AspNetCore.Components.DataGrid.EntityFrameworkAdapter.csproj index 7c63fae78..5a7dc3667 100644 --- a/src/Extensions/DataGrid.EntityFrameworkAdapter/Microsoft.FluentUI.AspNetCore.Components.DataGrid.EntityFrameworkAdapter.csproj +++ b/src/Extensions/DataGrid.EntityFrameworkAdapter/Microsoft.FluentUI.AspNetCore.Components.DataGrid.EntityFrameworkAdapter.csproj @@ -42,6 +42,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + @@ -56,4 +60,11 @@ true + + + + Microsoft400 + MicrosoftFluentUIAspNetCoreComponentsDataGridEntityFrameworkAdapter + + diff --git a/src/Templates/Microsoft.FluentUI.AspNetCore.Templates.csproj b/src/Templates/Microsoft.FluentUI.AspNetCore.Templates.csproj index d2ad91761..691ca1dd3 100644 --- a/src/Templates/Microsoft.FluentUI.AspNetCore.Templates.csproj +++ b/src/Templates/Microsoft.FluentUI.AspNetCore.Templates.csproj @@ -36,4 +36,11 @@ + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + +