From 1cac80851fc16396a1ce54e96f5a6c7995353ccd Mon Sep 17 00:00:00 2001 From: "Fire Zhang (Centific Technologies Inc)" Date: Mon, 23 Dec 2024 13:41:07 +0800 Subject: [PATCH 1/3] Remove redundant SourceBuildTrimNetFrameworkTargets property --- eng/targets/Helix.Common.props | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eng/targets/Helix.Common.props b/eng/targets/Helix.Common.props index 95872c860cc3..5ea1d1c6818d 100644 --- a/eng/targets/Helix.Common.props +++ b/eng/targets/Helix.Common.props @@ -4,7 +4,7 @@ (AlmaLinux.8.Amd64.Open)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:almalinux-8-helix-amd64 (Alpine.318.Amd64.Open)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:alpine-3.18-helix-amd64 (Debian.12.Amd64.Open)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-12-helix-amd64 - (Fedora.38.Amd64.Open)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-38-helix + (Fedora.40.Amd64.Open)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-40-helix (Mariner)Ubuntu.2204.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:cbl-mariner-2.0-helix-amd64 (Debian.12.Arm64.Open)ubuntu.2204.armarch.open@mcr.microsoft.com/dotnet-buildtools/prereqs:debian-12-helix-arm64v8 @@ -43,7 +43,7 @@ - + From 1733ba0318b92dc4a183c721b1bcc0c959922d4a Mon Sep 17 00:00:00 2001 From: "Fire Zhang (Centific Technologies Inc)" Date: Tue, 7 Jan 2025 09:04:48 +0800 Subject: [PATCH 2/3] Remove redundant SourceBuildTrimNetFrameworkTargets property --- eng/targets/Helix.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/targets/Helix.targets b/eng/targets/Helix.targets index 43bf0cb7f7f1..70e01877befa 100644 --- a/eng/targets/Helix.targets +++ b/eng/targets/Helix.targets @@ -19,7 +19,7 @@ $(HelixQueueAlmaLinux8); $(HelixQueueAlpine318); $(HelixQueueDebian12); - $(HelixQueueFedora38); + $(HelixQueueFedora40); $(HelixQueueMariner); Ubuntu.2004.Amd64.Open; From 6eb8877e3224e1261522d2ae642de8381a125043 Mon Sep 17 00:00:00 2001 From: "Fire Zhang (Centific Technologies Inc)" Date: Tue, 7 Jan 2025 09:10:31 +0800 Subject: [PATCH 3/3] Remove redundant SourceBuildTrimNetFrameworkTargets property --- .github/workflows/update-sdk.yml | 2 +- Directory.Build.props | 6 +- eng/Dependencies.props | 4 +- eng/SourceBuildPrebuiltBaseline.xml | 1 + eng/Version.Details.xml | 396 +++++++++--------- eng/Versions.props | 200 ++++----- .../core-templates/post-build/post-build.yml | 6 + .../steps/install-microbuild.yml | 44 +- eng/common/cross/build-android-rootfs.sh | 49 ++- eng/common/cross/build-rootfs.sh | 114 ++++- eng/common/cross/install-debs.py | 334 +++++++++++++++ eng/common/native/install-dependencies.sh | 2 +- eng/common/post-build/publish-using-darc.ps1 | 7 +- eng/common/tools.ps1 | 2 +- eng/common/tools.sh | 2 +- eng/test-configuration.json | 1 + eng/tools/RepoTasks/RepoTasks.csproj | 4 +- global.json | 10 +- ...Microsoft.AspNetCore.Analyzers.Test.csproj | 2 +- .../test/StartupCSharpAnalyzerTest.cs | 4 +- src/Components/Components/src/RouteView.cs | 3 - .../EditContextDataAnnotationsExtensions.cs | 2 + ...agedAuthenticatedEncryptorConfiguration.cs | 30 -- .../Microsoft.AspNetCore.App.Runtime.sfxproj | 4 +- ...osoft.AspNetCore.App.Analyzers.Test.csproj | 4 +- .../test/Verifiers/CSharpAnalyzerVerifier.cs | 9 +- .../test/Verifiers/CSharpCodeFixVerifier.cs | 11 +- .../CSharpSourceGeneratorVerifier.cs | 1 - .../src/Routing/RouteValueDictionary.cs | 26 +- .../gen/RequestDelegateGeneratorSuppressor.cs | 17 +- src/Http/Http.Extensions/src/UriHelper.cs | 20 +- .../WebUtilities/src/MultipartBoundary.cs | 10 +- src/Http/WebUtilities/src/MultipartReader.cs | 11 +- .../WebUtilities/src/MultipartReaderStream.cs | 14 +- .../WebUtilities/test/MultipartReaderTests.cs | 37 ++ src/Http/startvscode.cmd | 3 + src/Http/startvscode.sh | 5 + ...ouldNotBeAppliedToPageModelAnalyzerTest.cs | 7 +- .../test/AvoidHtmlPartialAnalyzerTest.cs | 7 +- .../test/Mvc.Analyzers.Test.csproj | 2 +- .../TagHelpersInCodeBlocksAnalyzerTest.cs | 35 +- .../test/TopLevelParameterNameAnalyzerTest.cs | 3 +- .../Services/Schemas/OpenApiSchemaService.cs | 8 +- .../Transformers/SchemaTransformerTests.cs | 9 +- .../TestInfrastructure/PrepareForTest.targets | 2 +- .../localize/templatestrings.en.json | 4 +- .../Infrastructure/TransportManager.cs | 3 +- src/Servers/Kestrel/startvscode.cmd | 3 + src/Servers/Kestrel/startvscode.sh | 5 + src/Testing/src/xunit/SkipOnHelixAttribute.cs | 5 +- .../src/Commands/ClearCommand.cs | 25 +- .../src/Commands/CreateCommand.cs | 31 +- .../src/Commands/RemoveCommand.cs | 27 +- .../src/Helpers/DevJwtCliHelpers.cs | 24 ++ src/Tools/dotnet-user-jwts/src/Resources.resx | 18 + .../test/UserJwtsTestFixture.cs | 4 + .../dotnet-user-jwts/test/UserJwtsTests.cs | 107 +++++ src/submodules/googletest | 2 +- 58 files changed, 1219 insertions(+), 509 deletions(-) create mode 100644 eng/common/cross/install-debs.py create mode 100644 src/Http/startvscode.cmd create mode 100644 src/Http/startvscode.sh create mode 100644 src/Servers/Kestrel/startvscode.cmd create mode 100644 src/Servers/Kestrel/startvscode.sh diff --git a/.github/workflows/update-sdk.yml b/.github/workflows/update-sdk.yml index c96f6b550c5c..b56cc522439a 100644 --- a/.github/workflows/update-sdk.yml +++ b/.github/workflows/update-sdk.yml @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: martincostello/update-dotnet-sdk@67d6e2b14939c06978a7f80444157296c3defe14 # v3.2.3 + - uses: martincostello/update-dotnet-sdk@76e2c0df2303d4f6a404228105ebb7d60ace0556 # v3.4.0 with: quality: 'daily' repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/Directory.Build.props b/Directory.Build.props index 72d99feb7d60..0321c8b1935a 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -234,10 +234,10 @@ - https://dotnetcli.azureedge.net/dotnet/ + https://dotnetcli.blob.core.windows.net/dotnet/ - https://dotnetbuilds.azureedge.net/public/ - https://dotnetbuilds.azureedge.net/internal/ + https://dotnetbuilds.blob.core.windows.net/public/ + https://dotnetbuilds.blob.core.windows.net/internal/ $(ArtifactsShippingPackagesDir) diff --git a/eng/Dependencies.props b/eng/Dependencies.props index fc85bb7c248c..26dc86e0e31c 100644 --- a/eng/Dependencies.props +++ b/eng/Dependencies.props @@ -66,8 +66,8 @@ and are generated based on the last package release. - - + + diff --git a/eng/SourceBuildPrebuiltBaseline.xml b/eng/SourceBuildPrebuiltBaseline.xml index 7dc26323656a..f30cfe800061 100644 --- a/eng/SourceBuildPrebuiltBaseline.xml +++ b/eng/SourceBuildPrebuiltBaseline.xml @@ -18,6 +18,7 @@ + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 4b6b77cfbc5d..ceccd29faf61 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -9,325 +9,329 @@ --> - + https://github.com/dotnet/efcore - b8ddc5b1f9e8a0287d0b15b933c991b61806c2b4 + 1f43fd3cd1be94ba8ce01a8eed2ecbb5127a39c3 - + https://github.com/dotnet/efcore - b8ddc5b1f9e8a0287d0b15b933c991b61806c2b4 + 1f43fd3cd1be94ba8ce01a8eed2ecbb5127a39c3 - + https://github.com/dotnet/efcore - b8ddc5b1f9e8a0287d0b15b933c991b61806c2b4 + 1f43fd3cd1be94ba8ce01a8eed2ecbb5127a39c3 - + https://github.com/dotnet/efcore - b8ddc5b1f9e8a0287d0b15b933c991b61806c2b4 + 1f43fd3cd1be94ba8ce01a8eed2ecbb5127a39c3 - + https://github.com/dotnet/efcore - b8ddc5b1f9e8a0287d0b15b933c991b61806c2b4 + 1f43fd3cd1be94ba8ce01a8eed2ecbb5127a39c3 - + https://github.com/dotnet/efcore - b8ddc5b1f9e8a0287d0b15b933c991b61806c2b4 + 1f43fd3cd1be94ba8ce01a8eed2ecbb5127a39c3 - + https://github.com/dotnet/efcore - b8ddc5b1f9e8a0287d0b15b933c991b61806c2b4 + 1f43fd3cd1be94ba8ce01a8eed2ecbb5127a39c3 - + https://github.com/dotnet/efcore - b8ddc5b1f9e8a0287d0b15b933c991b61806c2b4 + 1f43fd3cd1be94ba8ce01a8eed2ecbb5127a39c3 - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b + + + https://github.com/dotnet/runtime + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b https://github.com/dotnet/xdt @@ -339,9 +343,9 @@ 63ae81154c50a1cf9287cc47d8351d55b4289e6d - + https://github.com/dotnet/source-build-reference-packages - b24c3aa9f120f83befa255d5d5f465b961f387fb + 67bfe60ba059348bfaec48537acd36157cd2be6e @@ -367,64 +371,64 @@ afdd413cee50c16318620252e4e64dc326e2d300 - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/source-build-externals - 8b6c934b975aed0bd3cdc863ad6a86b19c51c52c + 523fb6eeffb1c912c6c975fc6b1d07265460676a - + https://github.com/dotnet/runtime - 040cbe276907174316e2cc07b35814b3069874a6 + efdd29953304f1fc494bb45c5785d37961c4a14b - + https://github.com/dotnet/arcade - 255d5e0c89958af276883a988108c2d616438805 + e58820063a8754d418518bce69ca2df0e3b4ac25 - + https://github.com/dotnet/arcade - 255d5e0c89958af276883a988108c2d616438805 + e58820063a8754d418518bce69ca2df0e3b4ac25 - + https://github.com/dotnet/arcade - 255d5e0c89958af276883a988108c2d616438805 + e58820063a8754d418518bce69ca2df0e3b4ac25 - + https://github.com/dotnet/arcade - 255d5e0c89958af276883a988108c2d616438805 + e58820063a8754d418518bce69ca2df0e3b4ac25 - + https://github.com/dotnet/arcade - 255d5e0c89958af276883a988108c2d616438805 + e58820063a8754d418518bce69ca2df0e3b4ac25 - + https://github.com/dotnet/arcade - 255d5e0c89958af276883a988108c2d616438805 + e58820063a8754d418518bce69ca2df0e3b4ac25 - + https://github.com/dotnet/arcade - 255d5e0c89958af276883a988108c2d616438805 + e58820063a8754d418518bce69ca2df0e3b4ac25 - + https://github.com/dotnet/arcade - 255d5e0c89958af276883a988108c2d616438805 + e58820063a8754d418518bce69ca2df0e3b4ac25 - + https://github.com/dotnet/extensions - 7d9d58969e56b84beb35b05ce29d22b26f8c97ce + dbb12c368fab1914e847c6b07f020c1c116dc429 - + https://github.com/dotnet/extensions - 7d9d58969e56b84beb35b05ce29d22b26f8c97ce + dbb12c368fab1914e847c6b07f020c1c116dc429 https://github.com/nuget/nuget.client @@ -438,30 +442,30 @@ https://github.com/nuget/nuget.client 8fef55f5a55a3b4f2c96cd1a9b5ddc51d4b927f8 - + https://dev.azure.com/dnceng/internal/_git/dotnet-optimization - 9d7532585ce71e30ab55f0364d3cecccaf0775d1 + 3065c617f820ffd66d3993b6f0cfaa20282c3c8a - + https://dev.azure.com/dnceng/internal/_git/dotnet-optimization - 9d7532585ce71e30ab55f0364d3cecccaf0775d1 + 3065c617f820ffd66d3993b6f0cfaa20282c3c8a - + https://dev.azure.com/dnceng/internal/_git/dotnet-optimization - 9d7532585ce71e30ab55f0364d3cecccaf0775d1 + 3065c617f820ffd66d3993b6f0cfaa20282c3c8a - + https://dev.azure.com/dnceng/internal/_git/dotnet-optimization - 9d7532585ce71e30ab55f0364d3cecccaf0775d1 + 3065c617f820ffd66d3993b6f0cfaa20282c3c8a - + https://dev.azure.com/dnceng/internal/_git/dotnet-optimization - 9d7532585ce71e30ab55f0364d3cecccaf0775d1 + 3065c617f820ffd66d3993b6f0cfaa20282c3c8a - + https://github.com/dotnet/symreader - 878352351804a2339d595c1f74f9e6b32c6c6e6b + ff1852196a042a124267a6e599d12da20d7ff65a diff --git a/eng/Versions.props b/eng/Versions.props index 8445afebc84c..adf5d29f8964 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -67,92 +67,93 @@ --> - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 - 10.0.0-alpha.1.24617.3 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 + 10.0.0-alpha.1.25052.4 - 9.1.0-preview.1.24611.2 - 9.1.0-preview.1.24611.2 + 9.1.0-preview.1.25056.1 + 9.1.0-preview.1.25056.1 - 10.0.0-alpha.1.24616.3 - 10.0.0-alpha.1.24616.3 - 10.0.0-alpha.1.24616.3 - 10.0.0-alpha.1.24616.3 - 10.0.0-alpha.1.24616.3 - 10.0.0-alpha.1.24616.3 - 10.0.0-alpha.1.24616.3 - 10.0.0-alpha.1.24616.3 + 10.0.0-alpha.1.25053.5 + 10.0.0-alpha.1.25053.5 + 10.0.0-alpha.1.25053.5 + 10.0.0-alpha.1.25053.5 + 10.0.0-alpha.1.25053.5 + 10.0.0-alpha.1.25053.5 + 10.0.0-alpha.1.25053.5 + 10.0.0-alpha.1.25053.5 4.13.0-3.24613.7 4.13.0-3.24613.7 @@ -165,26 +166,26 @@ 6.2.4 6.2.4 - 10.0.0-beta.24613.2 - 10.0.0-beta.24613.2 - 10.0.0-beta.24613.2 - 10.0.0-beta.24613.2 - 10.0.0-beta.24613.2 + 10.0.0-beta.25056.1 + 10.0.0-beta.25056.1 + 10.0.0-beta.25056.1 + 10.0.0-beta.25056.1 + 10.0.0-beta.25056.1 - 10.0.560902 + 10.0.605601 - 10.0.561602 + 10.0.605601 - 2.2.0-beta.24574.1 + 2.2.0-beta.24622.1 10.0.0-preview.24609.2 10.0.0-preview.24609.2 - 1.0.0-prerelease.24462.2 - 1.0.0-prerelease.24462.2 - 1.0.0-prerelease.24462.2 - 1.0.0-prerelease.24462.2 - 1.0.0-prerelease.24462.2 + 1.0.0-prerelease.24627.6 + 1.0.0-prerelease.24627.6 + 1.0.0-prerelease.24627.6 + 1.0.0-prerelease.24627.6 + 1.0.0-prerelease.24627.6 15.9.3032 - 8.0.0 4.7.0 5.0.0 @@ -256,7 +256,7 @@ --> 3.3.1 3.3.1 - 4.13.0-3.24613.7 4.13.0-3.24613.7 @@ -264,9 +264,9 @@ 4.13.0-3.24613.7 4.13.0-3.24613.7 3.3.3 - 1.1.2-beta1.24121.1 - 1.1.2-beta1.24121.1 - 1.1.2-beta1.24121.1 + 1.1.2 + 1.1.2 + 1.1.2 1.0.0-20230414.1 $(IdentityModelVersion) $(IdentityModelVersion) diff --git a/eng/common/core-templates/post-build/post-build.yml b/eng/common/core-templates/post-build/post-build.yml index 454fd75c7aff..a8c0bd3b9214 100644 --- a/eng/common/core-templates/post-build/post-build.yml +++ b/eng/common/core-templates/post-build/post-build.yml @@ -44,6 +44,11 @@ parameters: displayName: Publish installers and checksums type: boolean default: true + + - name: requireDefaultChannels + displayName: Fail the build if there are no default channel(s) registrations for the current build + type: boolean + default: false - name: SDLValidationParameters type: object @@ -312,5 +317,6 @@ stages: -PublishingInfraVersion ${{ parameters.publishingInfraVersion }} -AzdoToken '$(System.AccessToken)' -WaitPublishingFinish true + -RequireDefaultChannels ${{ parameters.requireDefaultChannels }} -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' diff --git a/eng/common/core-templates/steps/install-microbuild.yml b/eng/common/core-templates/steps/install-microbuild.yml index 9abe726e54bf..2a6a529482b5 100644 --- a/eng/common/core-templates/steps/install-microbuild.yml +++ b/eng/common/core-templates/steps/install-microbuild.yml @@ -1,19 +1,49 @@ parameters: - # Enable cleanup tasks for MicroBuild + # Enable install tasks for MicroBuild enableMicrobuild: false - # Enable cleanup tasks for MicroBuild on Mac and Linux + # Enable install tasks for MicroBuild on Mac and Linux # Will be ignored if 'enableMicrobuild' is false or 'Agent.Os' is 'Windows_NT' enableMicrobuildForMacAndLinux: false + # Location of the MicroBuild output folder + microBuildOutputFolder: '$(Agent.TempDirectory)' continueOnError: false steps: - ${{ if eq(parameters.enableMicrobuild, 'true') }}: - # Remove Python downgrade with https://github.com/dotnet/arcade/issues/15151 - - ${{ if and(eq(parameters.enableMicrobuildForMacAndLinux, 'true'), ne(variables['Agent.Os'], 'Windows_NT')) }}: + - ${{ if eq(parameters.enableMicrobuildForMacAndLinux, 'true') }}: + # Install Python 3.12.x on when Python > 3.12.x is installed - https://github.com/dotnet/source-build/issues/4802 + - script: | + version=$(python3 --version | awk '{print $2}') + major=$(echo $version | cut -d. -f1) + minor=$(echo $version | cut -d. -f2) + + installPython=false + if [ "$major" -gt 3 ] || { [ "$major" -eq 3 ] && [ "$minor" -gt 12 ]; }; then + installPython=true + fi + + echo "Python version: $version." + echo "Install Python 3.12.x: $installPython." + echo "##vso[task.setvariable variable=installPython;isOutput=true]$installPython" + name: InstallPython + displayName: 'Determine Python installation' + condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT')) + - task: UsePythonVersion@0 - displayName: 'Use Python 3.11.x' inputs: - versionSpec: '3.11.x' + versionSpec: '3.12.x' + displayName: 'Use Python 3.12.x' + condition: and(succeeded(), eq(variables['InstallPython.installPython'], 'true'), ne(variables['Agent.Os'], 'Windows_NT')) + + # Needed to download the MicroBuild plugin nupkgs on Mac and Linux when nuget.exe is unavailable + - task: UseDotNet@2 + displayName: Install .NET 8.0 SDK for MicroBuild Plugin + inputs: + packageType: sdk + version: 8.0.x + installationPath: ${{ parameters.microBuildOutputFolder }}/dotnet + workingDirectory: ${{ parameters.microBuildOutputFolder }} + condition: and(succeeded(), ne(variables['Agent.Os'], 'Windows_NT')) - task: MicroBuildSigningPlugin@4 displayName: Install MicroBuild plugin @@ -25,7 +55,7 @@ steps: azureSubscription: 'MicroBuild Signing Task (DevDiv)' env: TeamName: $(_TeamName) - MicroBuildOutputFolderOverride: '$(Agent.TempDirectory)' + MicroBuildOutputFolderOverride: ${{ parameters.microBuildOutputFolder }} SYSTEM_ACCESSTOKEN: $(System.AccessToken) continueOnError: ${{ parameters.continueOnError }} condition: and( diff --git a/eng/common/cross/build-android-rootfs.sh b/eng/common/cross/build-android-rootfs.sh index 7e9ba2b75ed3..fbd8d80848a6 100755 --- a/eng/common/cross/build-android-rootfs.sh +++ b/eng/common/cross/build-android-rootfs.sh @@ -6,10 +6,11 @@ usage() { echo "Creates a toolchain and sysroot used for cross-compiling for Android." echo - echo "Usage: $0 [BuildArch] [ApiLevel]" + echo "Usage: $0 [BuildArch] [ApiLevel] [--ndk NDKVersion]" echo echo "BuildArch is the target architecture of Android. Currently only arm64 is supported." echo "ApiLevel is the target Android API level. API levels usually match to Android releases. See https://source.android.com/source/build-numbers.html" + echo "NDKVersion is the version of Android NDK. The default is r21. See https://developer.android.com/ndk/downloads/revision_history" echo echo "By default, the toolchain and sysroot will be generated in cross/android-rootfs/toolchain/[BuildArch]. You can change this behavior" echo "by setting the TOOLCHAIN_DIR environment variable" @@ -25,10 +26,15 @@ __BuildArch=arm64 __AndroidArch=aarch64 __AndroidToolchain=aarch64-linux-android -for i in "$@" - do - lowerI="$(echo $i | tr "[:upper:]" "[:lower:]")" - case $lowerI in +while :; do + if [[ "$#" -le 0 ]]; then + break + fi + + i=$1 + + lowerI="$(echo $i | tr "[:upper:]" "[:lower:]")" + case $lowerI in -?|-h|--help) usage exit 1 @@ -43,6 +49,10 @@ for i in "$@" __AndroidArch=arm __AndroidToolchain=arm-linux-androideabi ;; + --ndk) + shift + __NDK_Version=$1 + ;; *[0-9]) __ApiLevel=$i ;; @@ -50,8 +60,17 @@ for i in "$@" __UnprocessedBuildArgs="$__UnprocessedBuildArgs $i" ;; esac + shift done +if [[ "$__NDK_Version" == "r21" ]] || [[ "$__NDK_Version" == "r22" ]]; then + __NDK_File_Arch_Spec=-x86_64 + __SysRoot=sysroot +else + __NDK_File_Arch_Spec= + __SysRoot=toolchains/llvm/prebuilt/linux-x86_64/sysroot +fi + # Obtain the location of the bash script to figure out where the root of the repo is. __ScriptBaseDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" @@ -78,6 +97,7 @@ fi echo "Target API level: $__ApiLevel" echo "Target architecture: $__BuildArch" +echo "NDK version: $__NDK_Version" echo "NDK location: $__NDK_Dir" echo "Target Toolchain location: $__ToolchainDir" @@ -85,8 +105,8 @@ echo "Target Toolchain location: $__ToolchainDir" if [ ! -d $__NDK_Dir ]; then echo Downloading the NDK into $__NDK_Dir mkdir -p $__NDK_Dir - wget -q --progress=bar:force:noscroll --show-progress https://dl.google.com/android/repository/android-ndk-$__NDK_Version-linux-x86_64.zip -O $__CrossDir/android-ndk-$__NDK_Version-linux-x86_64.zip - unzip -q $__CrossDir/android-ndk-$__NDK_Version-linux-x86_64.zip -d $__CrossDir + wget -q --progress=bar:force:noscroll --show-progress https://dl.google.com/android/repository/android-ndk-$__NDK_Version-linux$__NDK_File_Arch_Spec.zip -O $__CrossDir/android-ndk-$__NDK_Version-linux.zip + unzip -q $__CrossDir/android-ndk-$__NDK_Version-linux.zip -d $__CrossDir fi if [ ! -d $__lldb_Dir ]; then @@ -116,16 +136,11 @@ for path in $(wget -qO- https://packages.termux.dev/termux-main-21/dists/stable/ fi done -cp -R "$__TmpDir/data/data/com.termux/files/usr/"* "$__ToolchainDir/sysroot/usr/" +cp -R "$__TmpDir/data/data/com.termux/files/usr/"* "$__ToolchainDir/$__SysRoot/usr/" # Generate platform file for build.sh script to assign to __DistroRid echo "Generating platform file..." -echo "RID=android.${__ApiLevel}-${__BuildArch}" > $__ToolchainDir/sysroot/android_platform - -echo "Now to build coreclr, libraries and installers; run:" -echo ROOTFS_DIR=\$\(realpath $__ToolchainDir/sysroot\) ./build.sh --cross --arch $__BuildArch \ - --subsetCategory coreclr -echo ROOTFS_DIR=\$\(realpath $__ToolchainDir/sysroot\) ./build.sh --cross --arch $__BuildArch \ - --subsetCategory libraries -echo ROOTFS_DIR=\$\(realpath $__ToolchainDir/sysroot\) ./build.sh --cross --arch $__BuildArch \ - --subsetCategory installer +echo "RID=android.${__ApiLevel}-${__BuildArch}" > $__ToolchainDir/$__SysRoot/android_platform + +echo "Now to build coreclr, libraries and host; run:" +echo ROOTFS_DIR=$(realpath $__ToolchainDir/$__SysRoot) ./build.sh clr+libs+host --cross --arch $__BuildArch diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index de9807297909..6f49d748285f 100755 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -5,7 +5,7 @@ set -e usage() { echo "Usage: $0 [BuildArch] [CodeName] [lldbx.y] [llvmx[.y]] [--skipunmount] --rootfsdir ]" - echo "BuildArch can be: arm(default), arm64, armel, armv6, ppc64le, riscv64, s390x, x64, x86" + echo "BuildArch can be: arm(default), arm64, armel, armv6, loongarch64, ppc64le, riscv64, s390x, x64, x86" echo "CodeName - optional, Code name for Linux, can be: xenial(default), zesty, bionic, alpine" echo " for alpine can be specified with version: alpineX.YY or alpineedge" echo " for FreeBSD can be: freebsd13, freebsd14" @@ -15,6 +15,7 @@ usage() echo "llvmx[.y] - optional, LLVM version for LLVM related packages." echo "--skipunmount - optional, will skip the unmount of rootfs folder." echo "--skipsigcheck - optional, will skip package signature checks (allowing untrusted packages)." + echo "--skipemulation - optional, will skip qemu and debootstrap requirement when building environment for debian based systems." echo "--use-mirror - optional, use mirror URL to fetch resources, when available." echo "--jobs N - optional, restrict to N jobs." exit 1 @@ -32,6 +33,7 @@ __QEMUArch=arm __UbuntuArch=armhf __UbuntuRepo= __UbuntuSuites="updates security backports" +__DebianSuites= __LLDB_Package="liblldb-3.9-dev" __SkipUnmount=0 @@ -127,10 +129,12 @@ __AlpineKeys=' 616adfeb:MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAq0BFD1D4lIxQcsqEpQzU\npNCYM3aP1V/fxxVdT4DWvSI53JHTwHQamKdMWtEXetWVbP5zSROniYKFXd/xrD9X\n0jiGHey3lEtylXRIPxe5s+wXoCmNLcJVnvTcDtwx/ne2NLHxp76lyc25At+6RgE6\nADjLVuoD7M4IFDkAsd8UQ8zM0Dww9SylIk/wgV3ZkifecvgUQRagrNUdUjR56EBZ\nraQrev4hhzOgwelT0kXCu3snbUuNY/lU53CoTzfBJ5UfEJ5pMw1ij6X0r5S9IVsy\nKLWH1hiO0NzU2c8ViUYCly4Fe9xMTFc6u2dy/dxf6FwERfGzETQxqZvSfrRX+GLj\n/QZAXiPg5178hT/m0Y3z5IGenIC/80Z9NCi+byF1WuJlzKjDcF/TU72zk0+PNM/H\nKuppf3JT4DyjiVzNC5YoWJT2QRMS9KLP5iKCSThwVceEEg5HfhQBRT9M6KIcFLSs\nmFjx9kNEEmc1E8hl5IR3+3Ry8G5/bTIIruz14jgeY9u5jhL8Vyyvo41jgt9sLHR1\n/J1TxKfkgksYev7PoX6/ZzJ1ksWKZY5NFoDXTNYUgzFUTOoEaOg3BAQKadb3Qbbq\nXIrxmPBdgrn9QI7NCgfnAY3Tb4EEjs3ON/BNyEhUENcXOH6I1NbcuBQ7g9P73kE4\nVORdoc8MdJ5eoKBpO8Ww8HECAwEAAQ== 616ae350:MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAyduVzi1mWm+lYo2Tqt/0\nXkCIWrDNP1QBMVPrE0/ZlU2bCGSoo2Z9FHQKz/mTyMRlhNqTfhJ5qU3U9XlyGOPJ\npiM+b91g26pnpXJ2Q2kOypSgOMOPA4cQ42PkHBEqhuzssfj9t7x47ppS94bboh46\nxLSDRff/NAbtwTpvhStV3URYkxFG++cKGGa5MPXBrxIp+iZf9GnuxVdST5PGiVGP\nODL/b69sPJQNbJHVquqUTOh5Ry8uuD2WZuXfKf7/C0jC/ie9m2+0CttNu9tMciGM\nEyKG1/Xhk5iIWO43m4SrrT2WkFlcZ1z2JSf9Pjm4C2+HovYpihwwdM/OdP8Xmsnr\nDzVB4YvQiW+IHBjStHVuyiZWc+JsgEPJzisNY0Wyc/kNyNtqVKpX6dRhMLanLmy+\nf53cCSI05KPQAcGj6tdL+D60uKDkt+FsDa0BTAobZ31OsFVid0vCXtsbplNhW1IF\nHwsGXBTVcfXg44RLyL8Lk/2dQxDHNHzAUslJXzPxaHBLmt++2COa2EI1iWlvtznk\nOk9WP8SOAIj+xdqoiHcC4j72BOVVgiITIJNHrbppZCq6qPR+fgXmXa+sDcGh30m6\n9Wpbr28kLMSHiENCWTdsFij+NQTd5S47H7XTROHnalYDuF1RpS+DpQidT5tUimaT\nJZDr++FjKrnnijbyNF8b98UCAwEAAQ== 616db30d:MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnpUpyWDWjlUk3smlWeA0\nlIMW+oJ38t92CRLHH3IqRhyECBRW0d0aRGtq7TY8PmxjjvBZrxTNDpJT6KUk4LRm\na6A6IuAI7QnNK8SJqM0DLzlpygd7GJf8ZL9SoHSH+gFsYF67Cpooz/YDqWrlN7Vw\ntO00s0B+eXy+PCXYU7VSfuWFGK8TGEv6HfGMALLjhqMManyvfp8hz3ubN1rK3c8C\nUS/ilRh1qckdbtPvoDPhSbTDmfU1g/EfRSIEXBrIMLg9ka/XB9PvWRrekrppnQzP\nhP9YE3x/wbFc5QqQWiRCYyQl/rgIMOXvIxhkfe8H5n1Et4VAorkpEAXdsfN8KSVv\nLSMazVlLp9GYq5SUpqYX3KnxdWBgN7BJoZ4sltsTpHQ/34SXWfu3UmyUveWj7wp0\nx9hwsPirVI00EEea9AbP7NM2rAyu6ukcm4m6ATd2DZJIViq2es6m60AE6SMCmrQF\nwmk4H/kdQgeAELVfGOm2VyJ3z69fQuywz7xu27S6zTKi05Qlnohxol4wVb6OB7qG\nLPRtK9ObgzRo/OPumyXqlzAi/Yvyd1ZQk8labZps3e16bQp8+pVPiumWioMFJDWV\nGZjCmyMSU8V6MB6njbgLHoyg2LCukCAeSjbPGGGYhnKLm1AKSoJh3IpZuqcKCk5C\n8CM1S15HxV78s9dFntEqIokCAwEAAQ== +66ba20fe:MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtfB12w4ZgqsXWZDfUAV/\n6Y4aHUKIu3q4SXrNZ7CXF9nXoAVYrS7NAxJdAodsY3vPCN0g5O8DFXR+390LdOuQ\n+HsGKCc1k5tX5ZXld37EZNTNSbR0k+NKhd9h6X3u6wqPOx7SIKxwAQR8qeeFq4pP\nrt9GAGlxtuYgzIIcKJPwE0dZlcBCg+GnptCUZXp/38BP1eYC+xTXSL6Muq1etYfg\nodXdb7Yl+2h1IHuOwo5rjgY5kpY7GcAs8AjGk3lDD/av60OTYccknH0NCVSmPoXK\nvrxDBOn0LQRNBLcAfnTKgHrzy0Q5h4TNkkyTgxkoQw5ObDk9nnabTxql732yy9BY\ns+hM9+dSFO1HKeVXreYSA2n1ndF18YAvAumzgyqzB7I4pMHXq1kC/8bONMJxwSkS\nYm6CoXKyavp7RqGMyeVpRC7tV+blkrrUml0BwNkxE+XnwDRB3xDV6hqgWe0XrifD\nYTfvd9ScZQP83ip0r4IKlq4GMv/R5shcCRJSkSZ6QSGshH40JYSoiwJf5FHbj9ND\n7do0UAqebWo4yNx63j/wb2ULorW3AClv0BCFSdPsIrCStiGdpgJDBR2P2NZOCob3\nG9uMj+wJD6JJg2nWqNJxkANXX37Qf8plgzssrhrgOvB0fjjS7GYhfkfmZTJ0wPOw\nA8+KzFseBh4UFGgue78KwgkCAwEAAQ== ' __Keyring= __KeyringFile="/usr/share/keyrings/ubuntu-archive-keyring.gpg" __SkipSigCheck=0 +__SkipEmulation=0 __UseMirror=0 __UnprocessedBuildArgs= @@ -179,6 +183,19 @@ while :; do __Keyring="--keyring $__KeyringFile" fi ;; + loongarch64) + __BuildArch=loongarch64 + __AlpineArch=loongarch64 + __QEMUArch=loongarch64 + __UbuntuArch=loong64 + __UbuntuSuites= + __DebianSuites=unreleased + __LLDB_Package="liblldb-19-dev" + + if [[ "$__CodeName" == "sid" ]]; then + __UbuntuRepo="http://ftp.ports.debian.org/debian-ports/" + fi + ;; riscv64) __BuildArch=riscv64 __AlpineArch=riscv64 @@ -339,10 +356,28 @@ while :; do ;; sid) # Debian sid __CodeName=sid - __KeyringFile="/usr/share/keyrings/debian-archive-keyring.gpg" + __UbuntuSuites= - if [[ -z "$__UbuntuRepo" ]]; then - __UbuntuRepo="http://ftp.debian.org/debian/" + # Debian-Ports architectures need different values + case "$__UbuntuArch" in + amd64|arm64|armel|armhf|i386|mips64el|ppc64el|riscv64|s390x) + __KeyringFile="/usr/share/keyrings/debian-archive-keyring.gpg" + + if [[ -z "$__UbuntuRepo" ]]; then + __UbuntuRepo="http://ftp.debian.org/debian/" + fi + ;; + *) + __KeyringFile="/usr/share/keyrings/debian-ports-archive-keyring.gpg" + + if [[ -z "$__UbuntuRepo" ]]; then + __UbuntuRepo="http://ftp.ports.debian.org/debian-ports/" + fi + ;; + esac + + if [[ -e "$__KeyringFile" ]]; then + __Keyring="--keyring $__KeyringFile" fi ;; tizen) @@ -387,6 +422,9 @@ while :; do --skipsigcheck) __SkipSigCheck=1 ;; + --skipemulation) + __SkipEmulation=1 + ;; --rootfsdir|-rootfsdir) shift __RootfsDir="$1" @@ -419,10 +457,10 @@ case "$__AlpineVersion" in elif [[ "$__AlpineArch" == "x86" ]]; then __AlpineVersion=3.17 # minimum version that supports lldb-dev __AlpinePackages+=" llvm15-libs" - elif [[ "$__AlpineArch" == "riscv64" ]]; then - __AlpineLlvmLibsLookup=1 - __AlpineVersion=edge # minimum version with APKINDEX.tar.gz (packages archive) - elif [[ -n "$__AlpineVersion" ]]; then + elif [[ "$__AlpineArch" == "riscv64" || "$__AlpineArch" == "loongarch64" ]]; then + __AlpineVersion=3.21 # minimum version that supports lldb-dev + __AlpinePackages+=" llvm19-libs" + elif [[ -n "$__AlpineMajorVersion" ]]; then # use whichever alpine version is provided and select the latest toolchain libs __AlpineLlvmLibsLookup=1 else @@ -505,11 +543,6 @@ if [[ "$__CodeName" == "alpine" ]]; then echo "$__ApkToolsSHA512SUM $__ApkToolsDir/apk.static" | sha512sum -c chmod +x "$__ApkToolsDir/apk.static" - if [[ -f "/usr/bin/qemu-$__QEMUArch-static" ]]; then - mkdir -p "$__RootfsDir"/usr/bin - cp -v "/usr/bin/qemu-$__QEMUArch-static" "$__RootfsDir/usr/bin" - fi - if [[ "$__AlpineVersion" == "edge" ]]; then version=edge else @@ -529,6 +562,10 @@ if [[ "$__CodeName" == "alpine" ]]; then __ApkSignatureArg="--keys-dir $__ApkKeysDir" fi + if [[ "$__SkipEmulation" == "1" ]]; then + __NoEmulationArg="--no-scripts" + fi + # initialize DB # shellcheck disable=SC2086 "$__ApkToolsDir/apk.static" \ @@ -550,7 +587,7 @@ if [[ "$__CodeName" == "alpine" ]]; then "$__ApkToolsDir/apk.static" \ -X "http://dl-cdn.alpinelinux.org/alpine/$version/main" \ -X "http://dl-cdn.alpinelinux.org/alpine/$version/community" \ - -U $__ApkSignatureArg --root "$__RootfsDir" --arch "$__AlpineArch" \ + -U $__ApkSignatureArg --root "$__RootfsDir" --arch "$__AlpineArch" $__NoEmulationArg \ add $__AlpinePackages rm -r "$__ApkToolsDir" @@ -745,25 +782,68 @@ elif [[ "$__CodeName" == "haiku" ]]; then popd rm -rf "$__RootfsDir/tmp" elif [[ -n "$__CodeName" ]]; then + if [[ "$__SkipEmulation" == "1" ]]; then + if [[ -z "$AR" ]]; then + if command -v ar &>/dev/null; then + AR="$(command -v ar)" + elif command -v llvm-ar &>/dev/null; then + AR="$(command -v llvm-ar)" + else + echo "Unable to find ar or llvm-ar on PATH, add them to PATH or set AR environment variable pointing to the available AR tool" + exit 1 + fi + fi + + # shellcheck disable=SC2086 + suites="$__CodeName $__DebianSuites $(echo $__UbuntuSuites | xargs -n 1 | xargs -I {} echo -n "$__CodeName-{} ")" + + PYTHON=${PYTHON_EXECUTABLE:-python3} + + # shellcheck disable=SC2086,SC2046 + echo running "$PYTHON" "$__CrossDir/install-debs.py" --arch "$__UbuntuArch" --mirror "$__UbuntuRepo" --rootfsdir "$__RootfsDir" --artool "$AR" \ + $(echo $suites | xargs -n 1 | xargs -I {} echo -n "--suite {} ") \ + $__UbuntuPackages + + # shellcheck disable=SC2086,SC2046 + "$PYTHON" "$__CrossDir/install-debs.py" --arch "$__UbuntuArch" --mirror "$__UbuntuRepo" --rootfsdir "$__RootfsDir" --artool "$AR" \ + $(echo $suites | xargs -n 1 | xargs -I {} echo -n "--suite {} ") \ + $__UbuntuPackages + + exit 0 + fi + __UpdateOptions= if [[ "$__SkipSigCheck" == "0" ]]; then __Keyring="$__Keyring --force-check-gpg" + else + __Keyring= + __UpdateOptions="--allow-unauthenticated --allow-insecure-repositories" fi # shellcheck disable=SC2086 echo running debootstrap "--variant=minbase" $__Keyring --arch "$__UbuntuArch" "$__CodeName" "$__RootfsDir" "$__UbuntuRepo" - debootstrap "--variant=minbase" $__Keyring --arch "$__UbuntuArch" "$__CodeName" "$__RootfsDir" "$__UbuntuRepo" + # shellcheck disable=SC2086 + if ! debootstrap "--variant=minbase" $__Keyring --arch "$__UbuntuArch" "$__CodeName" "$__RootfsDir" "$__UbuntuRepo"; then + echo "debootstrap failed! dumping debootstrap.log" + cat "$__RootfsDir/debootstrap/debootstrap.log" + exit 1 + fi + + rm -rf "$__RootfsDir"/etc/apt/*.{sources,list} "$__RootfsDir"/etc/apt/sources.list.d mkdir -p "$__RootfsDir/etc/apt/sources.list.d/" + + # shellcheck disable=SC2086 cat > "$__RootfsDir/etc/apt/sources.list.d/$__CodeName.sources" < token2) - (token1 < token2) + else: + return -1 if isinstance(token1, str) else 1 + + return len(tokens1) - len(tokens2) + +def compare_debian_versions(version1, version2): + """Compare two Debian package versions.""" + epoch1, upstream1, revision1 = parse_debian_version(version1) + epoch2, upstream2, revision2 = parse_debian_version(version2) + + if epoch1 != epoch2: + return epoch1 - epoch2 + + result = compare_upstream_version(upstream1, upstream2) + if result != 0: + return result + + return compare_upstream_version(revision1, revision2) + +def resolve_dependencies(packages, aliases, desired_packages): + """Recursively resolves dependencies for the desired packages.""" + resolved = [] + to_process = deque(desired_packages) + + while to_process: + current = to_process.popleft() + resolved_package = current if current in packages else aliases.get(current, [None])[0] + + if not resolved_package: + print(f"Error: Package '{current}' was not found in the available packages.") + sys.exit(1) + + if resolved_package not in resolved: + resolved.append(resolved_package) + + deps = packages.get(resolved_package, {}).get("Depends", "") + if deps: + deps = [dep.split(' ')[0] for dep in deps.split(', ') if dep] + for dep in deps: + if dep not in resolved and dep not in to_process and dep in packages: + to_process.append(dep) + + return resolved + +def parse_package_index(content): + """Parses the Packages.gz file and returns package information.""" + packages = {} + aliases = {} + entries = re.split(r'\n\n+', content) + + for entry in entries: + fields = dict(re.findall(r'^(\S+): (.+)$', entry, re.MULTILINE)) + if "Package" in fields: + package_name = fields["Package"] + version = fields.get("Version") + filename = fields.get("Filename") + depends = fields.get("Depends") + provides = fields.get("Provides", None) + + # Only update if package_name is not in packages or if the new version is higher + if package_name not in packages or compare_debian_versions(version, packages[package_name]["Version"]) > 0: + packages[package_name] = { + "Version": version, + "Filename": filename, + "Depends": depends + } + + # Update aliases if package provides any alternatives + if provides: + provides_list = [x.strip() for x in provides.split(",")] + for alias in provides_list: + # Strip version specifiers + alias_name = re.sub(r'\s*\(=.*\)', '', alias) + if alias_name not in aliases: + aliases[alias_name] = [] + if package_name not in aliases[alias_name]: + aliases[alias_name].append(package_name) + + return packages, aliases + +def install_packages(mirror, packages_info, aliases, tmp_dir, extract_dir, ar_tool, desired_packages): + """Downloads .deb files and extracts them.""" + resolved_packages = resolve_dependencies(packages_info, aliases, desired_packages) + print(f"Resolved packages (including dependencies): {resolved_packages}") + + packages_to_download = {} + + for pkg in resolved_packages: + if pkg in packages_info: + packages_to_download[pkg] = packages_info[pkg] + + if pkg in aliases: + for alias in aliases[pkg]: + if alias in packages_info: + packages_to_download[alias] = packages_info[alias] + + asyncio.run(download_deb_files_parallel(mirror, packages_to_download, tmp_dir)) + + package_to_deb_file_map = {} + for pkg in resolved_packages: + pkg_info = packages_info.get(pkg) + if pkg_info: + deb_filename = pkg_info.get("Filename") + if deb_filename: + deb_file_path = os.path.join(tmp_dir, os.path.basename(deb_filename)) + package_to_deb_file_map[pkg] = deb_file_path + + for pkg in reversed(resolved_packages): + deb_file = package_to_deb_file_map.get(pkg) + if deb_file and os.path.exists(deb_file): + extract_deb_file(deb_file, tmp_dir, extract_dir, ar_tool) + + print("All done!") + +def extract_deb_file(deb_file, tmp_dir, extract_dir, ar_tool): + """Extract .deb file contents""" + + os.makedirs(extract_dir, exist_ok=True) + + with tempfile.TemporaryDirectory(dir=tmp_dir) as tmp_subdir: + result = subprocess.run(f"{ar_tool} t {os.path.abspath(deb_file)}", cwd=tmp_subdir, check=True, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + tar_filename = None + for line in result.stdout.decode().splitlines(): + if line.startswith("data.tar"): + tar_filename = line.strip() + break + + if not tar_filename: + raise FileNotFoundError(f"Could not find 'data.tar.*' in {deb_file}.") + + tar_file_path = os.path.join(tmp_subdir, tar_filename) + print(f"Extracting {tar_filename} from {deb_file}..") + + subprocess.run(f"{ar_tool} p {os.path.abspath(deb_file)} {tar_filename} > {tar_file_path}", check=True, shell=True) + + file_extension = os.path.splitext(tar_file_path)[1].lower() + + if file_extension == ".xz": + mode = "r:xz" + elif file_extension == ".gz": + mode = "r:gz" + elif file_extension == ".zst": + # zstd is not supported by standard library yet + decompressed_tar_path = tar_file_path.replace(".zst", "") + with open(tar_file_path, "rb") as zst_file, open(decompressed_tar_path, "wb") as decompressed_file: + dctx = zstandard.ZstdDecompressor() + dctx.copy_stream(zst_file, decompressed_file) + + tar_file_path = decompressed_tar_path + mode = "r" + else: + raise ValueError(f"Unsupported compression format: {file_extension}") + + with tarfile.open(tar_file_path, mode) as tar: + tar.extractall(path=extract_dir, filter='fully_trusted') + +def finalize_setup(rootfsdir): + lib_dir = os.path.join(rootfsdir, 'lib') + usr_lib_dir = os.path.join(rootfsdir, 'usr', 'lib') + + if os.path.exists(lib_dir): + if os.path.islink(lib_dir): + os.remove(lib_dir) + else: + os.makedirs(usr_lib_dir, exist_ok=True) + + for item in os.listdir(lib_dir): + src = os.path.join(lib_dir, item) + dest = os.path.join(usr_lib_dir, item) + + if os.path.isdir(src): + shutil.copytree(src, dest, dirs_exist_ok=True) + else: + shutil.copy2(src, dest) + + shutil.rmtree(lib_dir) + + os.symlink(usr_lib_dir, lib_dir) + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="Generate rootfs for .NET runtime on Debian-like OS") + parser.add_argument("--distro", required=False, help="Distro name (e.g., debian, ubuntu, etc.)") + parser.add_argument("--arch", required=True, help="Architecture (e.g., amd64, loong64, etc.)") + parser.add_argument("--rootfsdir", required=True, help="Destination directory.") + parser.add_argument('--suite', required=True, action='append', help='Specify one or more repository suites to collect index data.') + parser.add_argument("--mirror", required=False, help="Mirror (e.g., http://ftp.debian.org/debian-ports etc.)") + parser.add_argument("--artool", required=False, default="ar", help="ar tool to extract debs (e.g., ar, llvm-ar etc.)") + parser.add_argument("packages", nargs="+", help="List of package names to be installed.") + + args = parser.parse_args() + + if args.mirror is None: + if args.distro == "ubuntu": + args.mirror = "http://archive.ubuntu.com/ubuntu" if args.arch in ["amd64", "i386"] else "http://ports.ubuntu.com/ubuntu-ports" + elif args.distro == "debian": + args.mirror = "http://ftp.debian.org/debian-ports" + else: + raise Exception("Unsupported distro") + + DESIRED_PACKAGES = args.packages + [ # base packages + "dpkg", + "busybox", + "libc-bin", + "base-files", + "base-passwd", + "debianutils" + ] + + print(f"Creating rootfs. rootfsdir: {args.rootfsdir}, distro: {args.distro}, arch: {args.arch}, suites: {args.suite}, mirror: {args.mirror}") + + package_index_content = asyncio.run(download_package_index_parallel(args.mirror, args.arch, args.suite)) + + packages_info, aliases = parse_package_index(package_index_content) + + with tempfile.TemporaryDirectory() as tmp_dir: + install_packages(args.mirror, packages_info, aliases, tmp_dir, args.rootfsdir, args.artool, DESIRED_PACKAGES) + + finalize_setup(args.rootfsdir) diff --git a/eng/common/native/install-dependencies.sh b/eng/common/native/install-dependencies.sh index 3eef7409f729..71bde0e4573b 100644 --- a/eng/common/native/install-dependencies.sh +++ b/eng/common/native/install-dependencies.sh @@ -27,7 +27,7 @@ case "$os" in libssl-dev libkrb5-dev zlib1g-dev pigz cpio localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 - elif [ "$ID" = "fedora" ]; then + elif [ "$ID" = "fedora" ] || [ "$ID" = "rhel" ]; then dnf install -y cmake llvm lld lldb clang python curl libicu-devel openssl-devel krb5-devel zlib-devel lttng-ust-devel pigz cpio elif [ "$ID" = "alpine" ]; then apk add build-base cmake bash curl clang llvm-dev lld lldb krb5-dev lttng-ust-dev icu-dev zlib-dev openssl-dev pigz cpio diff --git a/eng/common/post-build/publish-using-darc.ps1 b/eng/common/post-build/publish-using-darc.ps1 index 90b58e32a87b..a261517ef906 100644 --- a/eng/common/post-build/publish-using-darc.ps1 +++ b/eng/common/post-build/publish-using-darc.ps1 @@ -5,7 +5,8 @@ param( [Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro.dot.net', [Parameter(Mandatory=$true)][string] $WaitPublishingFinish, [Parameter(Mandatory=$false)][string] $ArtifactsPublishingAdditionalParameters, - [Parameter(Mandatory=$false)][string] $SymbolPublishingAdditionalParameters + [Parameter(Mandatory=$false)][string] $SymbolPublishingAdditionalParameters, + [Parameter(Mandatory=$false)][string] $RequireDefaultChannels ) try { @@ -33,6 +34,10 @@ try { if ("false" -eq $WaitPublishingFinish) { $optionalParams.Add("--no-wait") | Out-Null } + + if ("true" -eq $RequireDefaultChannels) { + $optionalParams.Add("--default-channels-required") | Out-Null + } & $darc add-build-to-channel ` --id $buildId ` diff --git a/eng/common/tools.ps1 b/eng/common/tools.ps1 index bd80ccccb516..04b02f4fd3cc 100644 --- a/eng/common/tools.ps1 +++ b/eng/common/tools.ps1 @@ -320,7 +320,7 @@ function InstallDotNet([string] $dotnetRoot, $variations += @($installParameters) $dotnetBuilds = $installParameters.Clone() - $dotnetbuilds.AzureFeed = "https://dotnetbuilds.azureedge.net/public" + $dotnetbuilds.AzureFeed = "https://ci.dot.net/public" $variations += @($dotnetBuilds) if ($runtimeSourceFeed) { diff --git a/eng/common/tools.sh b/eng/common/tools.sh index 79b4a28e1707..40485a0f59de 100755 --- a/eng/common/tools.sh +++ b/eng/common/tools.sh @@ -232,7 +232,7 @@ function InstallDotNet { local public_location=("${installParameters[@]}") variations+=(public_location) - local dotnetbuilds=("${installParameters[@]}" --azure-feed "https://dotnetbuilds.azureedge.net/public") + local dotnetbuilds=("${installParameters[@]}" --azure-feed "https://ci.dot.net/public") variations+=(dotnetbuilds) if [[ -n "${6:-}" ]]; then diff --git a/eng/test-configuration.json b/eng/test-configuration.json index 77a24749032b..ae0eae533528 100644 --- a/eng/test-configuration.json +++ b/eng/test-configuration.json @@ -13,6 +13,7 @@ {"testName": {"contains": "ComponentLifecycleMethodThrowsExceptionTerminatesTheCircuit"}}, // Issue: https://github.com/dotnet/aspnetcore/issues/57551 {"testName": {"contains": "ComponentDisposeMethodThrowsExceptionTerminatesTheCircuit"}}, // Issue: https://github.com/dotnet/aspnetcore/issues/57551 {"testName": {"contains": "PhoneFactorFailsAfterSecurityStampChangeTest"}}, // Issue: https://github.com/dotnet/aspnetcore/issues/58231 + {"testName": {"contains": "AbortSendsFinalGOAWAY"}}, // Issue: https://github.com/dotnet/aspnetcore/issues/59358 {"testAssembly": {"contains": "IIS"}}, {"testAssembly": {"contains": "Template"}}, {"failureMessage": {"contains":"(Site is started but no worker process found)"}}, diff --git a/eng/tools/RepoTasks/RepoTasks.csproj b/eng/tools/RepoTasks/RepoTasks.csproj index c462a7517ae0..aa59934196bc 100644 --- a/eng/tools/RepoTasks/RepoTasks.csproj +++ b/eng/tools/RepoTasks/RepoTasks.csproj @@ -35,8 +35,8 @@ - - + + diff --git a/global.json b/global.json index 488ff0254864..c1270224e337 100644 --- a/global.json +++ b/global.json @@ -1,9 +1,9 @@ { "sdk": { - "version": "10.0.100-alpha.1.24616.1" + "version": "10.0.100-alpha.1.25056.1" }, "tools": { - "dotnet": "10.0.100-alpha.1.24616.1", + "dotnet": "10.0.100-alpha.1.25056.1", "runtimes": { "dotnet/x86": [ "$(MicrosoftInternalRuntimeAspNetCoreTransportVersion)" @@ -27,9 +27,9 @@ "jdk": "11.0.24" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.24613.2", - "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.24613.2", - "Microsoft.DotNet.SharedFramework.Sdk": "10.0.0-beta.24613.2", + "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25056.1", + "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.25056.1", + "Microsoft.DotNet.SharedFramework.Sdk": "10.0.0-beta.25056.1", "Microsoft.Build.NoTargets": "3.7.0", "Microsoft.Build.Traversal": "3.4.0" } diff --git a/src/Analyzers/Analyzers/test/Microsoft.AspNetCore.Analyzers.Test.csproj b/src/Analyzers/Analyzers/test/Microsoft.AspNetCore.Analyzers.Test.csproj index 5c89ff96a301..9290cc9741f5 100644 --- a/src/Analyzers/Analyzers/test/Microsoft.AspNetCore.Analyzers.Test.csproj +++ b/src/Analyzers/Analyzers/test/Microsoft.AspNetCore.Analyzers.Test.csproj @@ -8,7 +8,7 @@ - + diff --git a/src/Analyzers/Analyzers/test/StartupCSharpAnalyzerTest.cs b/src/Analyzers/Analyzers/test/StartupCSharpAnalyzerTest.cs index 42b9fbd86036..0e5e579977d9 100644 --- a/src/Analyzers/Analyzers/test/StartupCSharpAnalyzerTest.cs +++ b/src/Analyzers/Analyzers/test/StartupCSharpAnalyzerTest.cs @@ -5,11 +5,11 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Testing; using Microsoft.CodeAnalysis.Diagnostics; -using Microsoft.CodeAnalysis.Testing.Verifiers; +using Microsoft.CodeAnalysis.Testing; namespace Microsoft.AspNetCore.Analyzers; -internal sealed class StartupCSharpAnalyzerTest : CSharpAnalyzerTest +internal sealed class StartupCSharpAnalyzerTest : CSharpAnalyzerTest { public StartupCSharpAnalyzerTest(StartupAnalyzer analyzer, ImmutableArray metadataReferences) { diff --git a/src/Components/Components/src/RouteView.cs b/src/Components/Components/src/RouteView.cs index e5c0a5e2916c..46cda45a0fed 100644 --- a/src/Components/Components/src/RouteView.cs +++ b/src/Components/Components/src/RouteView.cs @@ -28,9 +28,6 @@ static RouteView() } } - [Inject] - private NavigationManager NavigationManager { get; set; } - /// /// Gets or sets the route data. This determines the page that will be /// displayed and the parameter values that will be supplied to the page. diff --git a/src/Components/Forms/src/EditContextDataAnnotationsExtensions.cs b/src/Components/Forms/src/EditContextDataAnnotationsExtensions.cs index 2fb2a68b6d0d..e15b90c0e42d 100644 --- a/src/Components/Forms/src/EditContextDataAnnotationsExtensions.cs +++ b/src/Components/Forms/src/EditContextDataAnnotationsExtensions.cs @@ -52,10 +52,12 @@ public static IDisposable EnableDataAnnotationsValidation(this EditContext editC private static event Action? OnClearCache; +#pragma warning disable IDE0051 // Remove unused private members private static void ClearCache(Type[]? _) { OnClearCache?.Invoke(); } +#pragma warning restore IDE0051 // Remove unused private members private sealed class DataAnnotationsEventSubscriptions : IDisposable { diff --git a/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ConfigurationModel/ManagedAuthenticatedEncryptorConfiguration.cs b/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ConfigurationModel/ManagedAuthenticatedEncryptorConfiguration.cs index 9ee20854dae7..844042cf14d9 100644 --- a/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ConfigurationModel/ManagedAuthenticatedEncryptorConfiguration.cs +++ b/src/DataProtection/DataProtection/src/AuthenticatedEncryption/ConfigurationModel/ManagedAuthenticatedEncryptorConfiguration.cs @@ -77,34 +77,4 @@ void IInternalAlgorithmConfiguration.Validate() using var encryptor = factory.CreateAuthenticatedEncryptorInstance(secret, this); encryptor.PerformSelfTest(); } - - // Any changes to this method should also be be reflected - // in ManagedAuthenticatedEncryptorDescriptorDeserializer.FriendlyNameToType. - private static string TypeToFriendlyName(Type type) - { - if (type == typeof(Aes)) - { - return nameof(Aes); - } - else if (type == typeof(HMACSHA1)) - { - return nameof(HMACSHA1); - } - else if (type == typeof(HMACSHA256)) - { - return nameof(HMACSHA256); - } - else if (type == typeof(HMACSHA384)) - { - return nameof(HMACSHA384); - } - else if (type == typeof(HMACSHA512)) - { - return nameof(HMACSHA512); - } - else - { - return type.AssemblyQualifiedName!; - } - } } diff --git a/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.sfxproj b/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.sfxproj index d3160de441ac..786f21900104 100644 --- a/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.sfxproj +++ b/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.sfxproj @@ -13,8 +13,8 @@ true LatestPatch - - false + + false false true diff --git a/src/Framework/AspNetCoreAnalyzers/test/Microsoft.AspNetCore.App.Analyzers.Test.csproj b/src/Framework/AspNetCoreAnalyzers/test/Microsoft.AspNetCore.App.Analyzers.Test.csproj index 5e75a5d1f451..7c95e4dab135 100644 --- a/src/Framework/AspNetCoreAnalyzers/test/Microsoft.AspNetCore.App.Analyzers.Test.csproj +++ b/src/Framework/AspNetCoreAnalyzers/test/Microsoft.AspNetCore.App.Analyzers.Test.csproj @@ -23,8 +23,8 @@ - - + + diff --git a/src/Framework/AspNetCoreAnalyzers/test/Verifiers/CSharpAnalyzerVerifier.cs b/src/Framework/AspNetCoreAnalyzers/test/Verifiers/CSharpAnalyzerVerifier.cs index aa3ee600db1e..cfbc023573b3 100644 --- a/src/Framework/AspNetCoreAnalyzers/test/Verifiers/CSharpAnalyzerVerifier.cs +++ b/src/Framework/AspNetCoreAnalyzers/test/Verifiers/CSharpAnalyzerVerifier.cs @@ -9,7 +9,6 @@ using Microsoft.CodeAnalysis.CSharp.Testing; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Testing; -using Microsoft.CodeAnalysis.Testing.Verifiers; using Microsoft.Extensions.DependencyInjection; using Microsoft.AspNetCore.Hosting; @@ -20,20 +19,20 @@ public static partial class CSharpAnalyzerVerifier { /// public static DiagnosticResult Diagnostic() - => CSharpAnalyzerVerifier.Diagnostic(); + => CSharpAnalyzerVerifier.Diagnostic(); /// public static DiagnosticResult Diagnostic(string diagnosticId) - => CSharpAnalyzerVerifier.Diagnostic(diagnosticId); + => CSharpAnalyzerVerifier.Diagnostic(diagnosticId); /// public static DiagnosticResult Diagnostic(DiagnosticDescriptor descriptor) - => CSharpAnalyzerVerifier.Diagnostic(descriptor); + => CSharpAnalyzerVerifier.Diagnostic(descriptor); /// public static async Task VerifyAnalyzerAsync(string source, params DiagnosticResult[] expected) { - var test = new CSharpAnalyzerTest + var test = new CSharpAnalyzerTest { TestCode = source.ReplaceLineEndings(), // We need to set the output type to an exe to properly diff --git a/src/Framework/AspNetCoreAnalyzers/test/Verifiers/CSharpCodeFixVerifier.cs b/src/Framework/AspNetCoreAnalyzers/test/Verifiers/CSharpCodeFixVerifier.cs index 83f30d841e49..c39a1a87e87b 100644 --- a/src/Framework/AspNetCoreAnalyzers/test/Verifiers/CSharpCodeFixVerifier.cs +++ b/src/Framework/AspNetCoreAnalyzers/test/Verifiers/CSharpCodeFixVerifier.cs @@ -6,7 +6,6 @@ using Microsoft.CodeAnalysis.CSharp.Testing; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Testing; -using Microsoft.CodeAnalysis.Testing.Verifiers; namespace Microsoft.AspNetCore.Analyzers.Verifiers; @@ -16,20 +15,20 @@ public static partial class CSharpCodeFixVerifier { /// public static DiagnosticResult Diagnostic() - => CSharpCodeFixVerifier.Diagnostic(); + => CSharpCodeFixVerifier.Diagnostic(); /// public static DiagnosticResult Diagnostic(string diagnosticId) - => CSharpCodeFixVerifier.Diagnostic(diagnosticId); + => CSharpCodeFixVerifier.Diagnostic(diagnosticId); /// public static DiagnosticResult Diagnostic(DiagnosticDescriptor descriptor) - => CSharpCodeFixVerifier.Diagnostic(descriptor); + => CSharpCodeFixVerifier.Diagnostic(descriptor); /// public static async Task VerifyAnalyzerAsync(string source, params DiagnosticResult[] expected) { - var test = new CSharpCodeFixTest + var test = new CSharpCodeFixTest { TestCode = source.ReplaceLineEndings(), // We need to set the output type to an exe to properly @@ -54,7 +53,7 @@ public static async Task VerifyCodeFixAsync(string source, DiagnosticResult expe /// public static async Task VerifyCodeFixAsync(string source, DiagnosticResult[] expected, string fixedSource, int? expectedIterations = null, string usageSource = null, string codeActionEquivalenceKey = null) { - var test = new CSharpCodeFixTest + var test = new CSharpCodeFixTest { // We need to set the output type to an exe to properly // support top-level programs in the tests. Otherwise, diff --git a/src/Framework/AspNetCoreAnalyzers/test/Verifiers/CSharpSourceGeneratorVerifier.cs b/src/Framework/AspNetCoreAnalyzers/test/Verifiers/CSharpSourceGeneratorVerifier.cs index 544adc924754..13286b98f26f 100644 --- a/src/Framework/AspNetCoreAnalyzers/test/Verifiers/CSharpSourceGeneratorVerifier.cs +++ b/src/Framework/AspNetCoreAnalyzers/test/Verifiers/CSharpSourceGeneratorVerifier.cs @@ -6,7 +6,6 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Testing; using Microsoft.CodeAnalysis.Testing; -using Microsoft.CodeAnalysis.Testing.Verifiers; using Microsoft.CodeAnalysis.Text; namespace Microsoft.AspNetCore.Analyzers.Verifiers; diff --git a/src/Http/Http.Abstractions/src/Routing/RouteValueDictionary.cs b/src/Http/Http.Abstractions/src/Routing/RouteValueDictionary.cs index 4d6948ff9e3c..3e2cccbb422c 100644 --- a/src/Http/Http.Abstractions/src/Routing/RouteValueDictionary.cs +++ b/src/Http/Http.Abstractions/src/Routing/RouteValueDictionary.cs @@ -208,7 +208,6 @@ public RouteValueDictionary(RouteValueDictionary? dictionary) _arrayStorage = Array.Empty>(); } } -#endif [MemberNotNull(nameof(_arrayStorage))] private void Initialize(IEnumerable> stringValueEnumerable) @@ -221,21 +220,9 @@ private void Initialize(IEnumerable> stringValueEn } } - [MemberNotNull(nameof(_arrayStorage))] - private void Initialize(IEnumerable> keyValueEnumerable) - { - _arrayStorage = Array.Empty>(); - - foreach (var kvp in keyValueEnumerable) - { - Add(kvp.Key, kvp.Value); - } - } - [MemberNotNull(nameof(_arrayStorage))] private void Initialize(RouteValueDictionary dictionary) { -#if !COMPONENTS if (dictionary._propertyStorage != null) { // PropertyStorage is immutable so we can just copy it. @@ -244,7 +231,6 @@ private void Initialize(RouteValueDictionary dictionary) _arrayStorage = Array.Empty>(); return; } -#endif var count = dictionary._count; if (count > 0) @@ -260,6 +246,18 @@ private void Initialize(RouteValueDictionary dictionary) _arrayStorage = Array.Empty>(); } } +#endif + + [MemberNotNull(nameof(_arrayStorage))] + private void Initialize(IEnumerable> keyValueEnumerable) + { + _arrayStorage = Array.Empty>(); + + foreach (var kvp in keyValueEnumerable) + { + Add(kvp.Key, kvp.Value); + } + } /// public object? this[string key] diff --git a/src/Http/Http.Extensions/gen/RequestDelegateGeneratorSuppressor.cs b/src/Http/Http.Extensions/gen/RequestDelegateGeneratorSuppressor.cs index cbde9e7e4373..6840634560e6 100644 --- a/src/Http/Http.Extensions/gen/RequestDelegateGeneratorSuppressor.cs +++ b/src/Http/Http.Extensions/gen/RequestDelegateGeneratorSuppressor.cs @@ -46,8 +46,21 @@ public override void ReportSuppressions(SuppressionAnalysisContext context) ? diagnostic.AdditionalLocations[0] : diagnostic.Location; - if (location.SourceTree is not { } sourceTree - || sourceTree.GetRoot().FindNode(location.SourceSpan) is not InvocationExpressionSyntax node + if (location.SourceTree is not { } sourceTree) + { + continue; + } + + // The trim analyzer changed from warning on the InvocationExpression to the MemberAccessExpression in https://github.com/dotnet/runtime/pull/110086. + // To account for this, we need to check if the location is an InvocationExpression or a child of an InvocationExpression. + var node = sourceTree.GetRoot().FindNode(location.SourceSpan) switch + { + InvocationExpressionSyntax s => s, + { Parent: InvocationExpressionSyntax s } => s, + _ => null, + }; + + if (node is null || !node.TryGetMapMethodName(out var method) || !InvocationOperationExtensions.KnownMethods.Contains(method)) { diff --git a/src/Http/Http.Extensions/src/UriHelper.cs b/src/Http/Http.Extensions/src/UriHelper.cs index 6c98c4d4890b..fc951704a85e 100644 --- a/src/Http/Http.Extensions/src/UriHelper.cs +++ b/src/Http/Http.Extensions/src/UriHelper.cs @@ -4,7 +4,6 @@ using System.Buffers; using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; -using System.Text; namespace Microsoft.AspNetCore.Http.Extensions; @@ -204,24 +203,7 @@ public static string GetEncodedPathAndQuery(this HttpRequest request) /// suitable only for display. public static string GetDisplayUrl(this HttpRequest request) { - var scheme = request.Scheme ?? string.Empty; - var host = request.Host.Value ?? string.Empty; - var pathBase = request.PathBase.Value ?? string.Empty; - var path = request.Path.Value ?? string.Empty; - var queryString = request.QueryString.Value ?? string.Empty; - - // PERF: Calculate string length to allocate correct buffer size for StringBuilder. - var length = scheme.Length + SchemeDelimiter.Length + host.Length - + pathBase.Length + path.Length + queryString.Length; - - return new StringBuilder(length) - .Append(scheme) - .Append(SchemeDelimiter) - .Append(host) - .Append(pathBase) - .Append(path) - .Append(queryString) - .ToString(); + return string.Concat([request.Scheme, SchemeDelimiter, request.Host.Value, request.PathBase.Value, request.Path.Value, request.QueryString.Value]); } /// diff --git a/src/Http/WebUtilities/src/MultipartBoundary.cs b/src/Http/WebUtilities/src/MultipartBoundary.cs index c14d8fca270f..8cac796402ee 100644 --- a/src/Http/WebUtilities/src/MultipartBoundary.cs +++ b/src/Http/WebUtilities/src/MultipartBoundary.cs @@ -10,11 +10,11 @@ internal sealed class MultipartBoundary private readonly byte[] _boundaryBytes; private bool _expectLeadingCrlf; - public MultipartBoundary(string boundary, bool expectLeadingCrlf = true) + public MultipartBoundary(string boundary) { ArgumentNullException.ThrowIfNull(boundary); - _expectLeadingCrlf = expectLeadingCrlf; + _expectLeadingCrlf = false; _boundaryBytes = Encoding.UTF8.GetBytes("\r\n--" + boundary); FinalBoundaryLength = BoundaryBytes.Length + 2; // Include the final '--' terminator. @@ -25,6 +25,12 @@ public void ExpectLeadingCrlf() _expectLeadingCrlf = true; } + // Lets us throw a more specific error from MultipartReaderStream when reading any preamble data. + public bool BeforeFirstBoundary() + { + return !_expectLeadingCrlf; + } + // Return either "--{boundary}" or "\r\n--{boundary}" depending on if we're looking for the end of a section public ReadOnlySpan BoundaryBytes => _boundaryBytes.AsSpan(_expectLeadingCrlf ? 0 : 2); diff --git a/src/Http/WebUtilities/src/MultipartReader.cs b/src/Http/WebUtilities/src/MultipartReader.cs index 7271f33a96d0..195d4184f69b 100644 --- a/src/Http/WebUtilities/src/MultipartReader.cs +++ b/src/Http/WebUtilities/src/MultipartReader.cs @@ -27,7 +27,7 @@ public class MultipartReader private readonly BufferedReadStream _stream; private readonly MultipartBoundary _boundary; - private MultipartReaderStream _currentStream; + private MultipartReaderStream? _currentStream; /// /// Initializes a new instance of . @@ -56,10 +56,7 @@ public MultipartReader(string boundary, Stream stream, int bufferSize) } _stream = new BufferedReadStream(stream, bufferSize); boundary = HeaderUtilities.RemoveQuotes(new StringSegment(boundary)).ToString(); - _boundary = new MultipartBoundary(boundary, false); - // This stream will drain any preamble data and remove the first boundary marker. - // TODO: HeadersLengthLimit can't be modified until after the constructor. - _currentStream = new MultipartReaderStream(_stream, _boundary) { LengthLimit = HeadersLengthLimit }; + _boundary = new MultipartBoundary(boundary); } /// @@ -86,6 +83,10 @@ public MultipartReader(string boundary, Stream stream, int bufferSize) /// public async Task ReadNextSectionAsync(CancellationToken cancellationToken = new CancellationToken()) { + // Only occurs on first call + // This stream will drain any preamble data and remove the first boundary marker. + _currentStream ??= new MultipartReaderStream(_stream, _boundary) { LengthLimit = HeadersLengthLimit }; + // Drain the prior section. await _currentStream.DrainAsync(cancellationToken); // If we're at the end return null diff --git a/src/Http/WebUtilities/src/MultipartReaderStream.cs b/src/Http/WebUtilities/src/MultipartReaderStream.cs index 9dd5ce6a76f8..42f24d8de530 100644 --- a/src/Http/WebUtilities/src/MultipartReaderStream.cs +++ b/src/Http/WebUtilities/src/MultipartReaderStream.cs @@ -145,9 +145,19 @@ private int UpdatePosition(int read) if (_observedLength < _position) { _observedLength = _position; - if (LengthLimit.HasValue && _observedLength > LengthLimit.GetValueOrDefault()) + if (LengthLimit.HasValue && + LengthLimit.GetValueOrDefault() is var lengthLimit && + _observedLength > lengthLimit) { - throw new InvalidDataException($"Multipart body length limit {LengthLimit.GetValueOrDefault()} exceeded."); + // If we hit the limit before the first boundary then we're using the header length limit, not the body length limit. + if (_boundary.BeforeFirstBoundary()) + { + throw new InvalidDataException($"Multipart header length limit {lengthLimit} exceeded. Too much data before the first boundary."); + } + else + { + throw new InvalidDataException($"Multipart body length limit {lengthLimit} exceeded."); + } } } return read; diff --git a/src/Http/WebUtilities/test/MultipartReaderTests.cs b/src/Http/WebUtilities/test/MultipartReaderTests.cs index bc442b567dc0..9055e14a10aa 100644 --- a/src/Http/WebUtilities/test/MultipartReaderTests.cs +++ b/src/Http/WebUtilities/test/MultipartReaderTests.cs @@ -147,6 +147,43 @@ public async Task MultipartReader_HeadersLengthExceeded_Throws() Assert.Equal("Line length limit 17 exceeded.", exception.Message); } + [Fact] + public async Task MultipartReader_HeadersLengthExceeded_LargePreamble() + { + var body = $"preamble {new string('a', 17000)}\r\n" + + "--9051914041544843365972754266\r\n" + +"\r\n" + +"text default\r\n" + +"--9051914041544843365972754266--\r\n"; + var stream = MakeStream(body); + var reader = new MultipartReader(Boundary, stream); + + var exception = await Assert.ThrowsAsync(() => reader.ReadNextSectionAsync()); + Assert.Equal("Multipart header length limit 16384 exceeded. Too much data before the first boundary.", exception.Message); + } + + [Fact] + public async Task MultipartReader_HeadersLengthLimitSettable_LargePreamblePasses() + { + var body = $"preamble {new string('a', 100_000)}\r\n" + + "--9051914041544843365972754266\r\n" + +"\r\n" + +"text default\r\n" + +"--9051914041544843365972754266--\r\n"; + var stream = MakeStream(body); + var reader = new MultipartReader(Boundary, stream) + { + HeadersLengthLimit = 200_000, + }; + + var section = await reader.ReadNextSectionAsync(); + Assert.NotNull(section); + + var buffer = new MemoryStream(); + await section.Body.CopyToAsync(buffer); + Assert.Equal("text default", Encoding.ASCII.GetString(buffer.ToArray())); + } + [Fact] public async Task MultipartReader_ReadSinglePartBodyWithTrailingWhitespace_Success() { diff --git a/src/Http/startvscode.cmd b/src/Http/startvscode.cmd new file mode 100644 index 000000000000..d403f3028231 --- /dev/null +++ b/src/Http/startvscode.cmd @@ -0,0 +1,3 @@ +@ECHO OFF + +%~dp0..\..\startvscode.cmd %~dp0 diff --git a/src/Http/startvscode.sh b/src/Http/startvscode.sh new file mode 100644 index 000000000000..346f74c01e76 --- /dev/null +++ b/src/Http/startvscode.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +repo_root="$DIR/../.." +"$repo_root/startvscode.sh" $DIR diff --git a/src/Mvc/Mvc.Analyzers/test/AttributesShouldNotBeAppliedToPageModelAnalyzerTest.cs b/src/Mvc/Mvc.Analyzers/test/AttributesShouldNotBeAppliedToPageModelAnalyzerTest.cs index fe7ff9461633..a1d483ef99f4 100644 --- a/src/Mvc/Mvc.Analyzers/test/AttributesShouldNotBeAppliedToPageModelAnalyzerTest.cs +++ b/src/Mvc/Mvc.Analyzers/test/AttributesShouldNotBeAppliedToPageModelAnalyzerTest.cs @@ -7,7 +7,6 @@ using Microsoft.CodeAnalysis.CSharp.Testing; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Testing; -using Microsoft.CodeAnalysis.Testing.Verifiers; namespace Microsoft.AspNetCore.Mvc.Analyzers; @@ -373,7 +372,7 @@ public void OnGet() private static Task VerifyAnalyzerAsync(string source, params DiagnosticResult[] expected) { - var test = new AttributesShouldNotBeAppliedToPageModelCSharpAnalzyerTest(TestReferences.MetadataReferences) + var test = new AttributesShouldNotBeAppliedToPageModelCSharpAnalyzerTest(TestReferences.MetadataReferences) { TestCode = source, ReferenceAssemblies = TestReferences.EmptyReferenceAssemblies, @@ -383,9 +382,9 @@ private static Task VerifyAnalyzerAsync(string source, params DiagnosticResult[] return test.RunAsync(); } - private sealed class AttributesShouldNotBeAppliedToPageModelCSharpAnalzyerTest : CSharpAnalyzerTest + private sealed class AttributesShouldNotBeAppliedToPageModelCSharpAnalyzerTest : CSharpAnalyzerTest { - public AttributesShouldNotBeAppliedToPageModelCSharpAnalzyerTest(ImmutableArray metadataReferences) + public AttributesShouldNotBeAppliedToPageModelCSharpAnalyzerTest(ImmutableArray metadataReferences) { TestState.AdditionalReferences.AddRange(metadataReferences); } diff --git a/src/Mvc/Mvc.Analyzers/test/AvoidHtmlPartialAnalyzerTest.cs b/src/Mvc/Mvc.Analyzers/test/AvoidHtmlPartialAnalyzerTest.cs index 142a2a01801c..af74e87a0f58 100644 --- a/src/Mvc/Mvc.Analyzers/test/AvoidHtmlPartialAnalyzerTest.cs +++ b/src/Mvc/Mvc.Analyzers/test/AvoidHtmlPartialAnalyzerTest.cs @@ -7,7 +7,6 @@ using Microsoft.CodeAnalysis.CSharp.Testing; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Testing; -using Microsoft.CodeAnalysis.Testing.Verifiers; namespace Microsoft.AspNetCore.Mvc.Analyzers; @@ -412,7 +411,7 @@ public class DiagnosticsAreReturned_ForUseOfHtmlRenderPartial_InSections : globa private static Task VerifyAnalyzerAsync(string source, params DiagnosticResult[] expected) { - var test = new AvoidHtmlPartialCSharpAnalzyerTest(TestReferences.MetadataReferences) + var test = new AvoidHtmlPartialCSharpAnalyzerTest(TestReferences.MetadataReferences) { TestCode = source, ReferenceAssemblies = TestReferences.EmptyReferenceAssemblies, @@ -422,9 +421,9 @@ private static Task VerifyAnalyzerAsync(string source, params DiagnosticResult[] return test.RunAsync(); } - internal sealed class AvoidHtmlPartialCSharpAnalzyerTest : CSharpAnalyzerTest + internal sealed class AvoidHtmlPartialCSharpAnalyzerTest : CSharpAnalyzerTest { - public AvoidHtmlPartialCSharpAnalzyerTest(ImmutableArray metadataReferences) + public AvoidHtmlPartialCSharpAnalyzerTest(ImmutableArray metadataReferences) { TestState.AdditionalReferences.AddRange(metadataReferences); } diff --git a/src/Mvc/Mvc.Analyzers/test/Mvc.Analyzers.Test.csproj b/src/Mvc/Mvc.Analyzers/test/Mvc.Analyzers.Test.csproj index 58253fa10667..eb6895f3e4db 100644 --- a/src/Mvc/Mvc.Analyzers/test/Mvc.Analyzers.Test.csproj +++ b/src/Mvc/Mvc.Analyzers/test/Mvc.Analyzers.Test.csproj @@ -16,7 +16,7 @@ - + diff --git a/src/Mvc/Mvc.Analyzers/test/TagHelpersInCodeBlocksAnalyzerTest.cs b/src/Mvc/Mvc.Analyzers/test/TagHelpersInCodeBlocksAnalyzerTest.cs index c47fadb7b721..fa291014b620 100644 --- a/src/Mvc/Mvc.Analyzers/test/TagHelpersInCodeBlocksAnalyzerTest.cs +++ b/src/Mvc/Mvc.Analyzers/test/TagHelpersInCodeBlocksAnalyzerTest.cs @@ -7,7 +7,6 @@ using Microsoft.CodeAnalysis.CSharp.Testing; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Testing; -using Microsoft.CodeAnalysis.Testing.Verifiers; namespace Microsoft.AspNetCore.Mvc.Analyzers; @@ -58,7 +57,7 @@ public class DiagnosticsAreReturned_ForUseOfTagHelpersInActions : global::Micros { WriteLiteral(""\r\n""); WriteLiteral(""\r\n""); - + Action sometMethod = {|#0:() => { @@ -151,7 +150,7 @@ public class DiagnosticsAreReturned_ForUseOfTagHelpersInNonAsyncFunc : global::M { WriteLiteral(""\r\n""); WriteLiteral(""\r\n""); - + Func sometMethod = {|#0:() => { @@ -243,13 +242,13 @@ public class DiagnosticsAreReturned_ForUseOfTagHelpersInVoidClassMethods : globa public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral(""\r\n""); - + SometMethod(); WriteLiteral(""\r\n""); } #pragma warning restore 1998 - + {|#0:void SometMethod() { @@ -336,7 +335,7 @@ public class DiagnosticsAreReturned_ForUseOfTagHelpersInVoidDelegates : global:: { WriteLiteral(""\r\n""); WriteLiteral(""\r\n""); - + TestDelegate sometMethod = {|#0:delegate () { @@ -368,7 +367,7 @@ public class DiagnosticsAreReturned_ForUseOfTagHelpersInVoidDelegates : global:: WriteLiteral(""\r\n""); } #pragma warning restore 1998 - + delegate void TestDelegate(); [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] @@ -430,7 +429,7 @@ public class DiagnosticsAreReturned_ForUseOfTagHelpersInVoidLocalFunctions : glo public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral(""\r\n""); - + {|#0:void SometMethod() { @@ -520,13 +519,13 @@ public class NoDiagnosticsAreReturned_ForUseOfTagHelpersInAsyncClassMethods_ : g public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral(""\r\n""); - + await SometMethod(); WriteLiteral(""\r\n""); } #pragma warning restore 1998 - + async Task SometMethod() { @@ -611,7 +610,7 @@ public class NoDiagnosticsAreReturned_ForUseOfTagHelpersInAsyncDelegates_ : glob { WriteLiteral(""\r\n""); WriteLiteral(""\r\n""); - + TestDelegate sometMethod = async delegate () { @@ -643,7 +642,7 @@ public class NoDiagnosticsAreReturned_ForUseOfTagHelpersInAsyncDelegates_ : glob WriteLiteral(""\r\n""); } #pragma warning restore 1998 - + delegate Task TestDelegate(); [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] @@ -707,7 +706,7 @@ public class NoDiagnosticsAreReturned_ForUseOfTagHelpersInAsyncLocalFunctions_ : public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral(""\r\n""); - + async Task SometMethod() { @@ -794,13 +793,13 @@ public class SingleDiagnosticIsReturned_ForMultipleTagHelpersInVoidMethod : glob public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral(""\r\n""); - + SometMethod(); WriteLiteral(""\r\n""); } #pragma warning restore 1998 - + {|#0:void SometMethod() { @@ -898,7 +897,7 @@ public class SingleDiagnosticIsReturned_ForMultipleTagHelpersInVoidMethod : glob private static Task VerifyAnalyzerAsync(string source, params DiagnosticResult[] expected) { - var test = new TagHelpersInCodeBlocksCSharpAnalzyerTest(TestReferences.MetadataReferences) + var test = new TagHelpersInCodeBlocksCSharpAnalyzerTest(TestReferences.MetadataReferences) { TestCode = source, ReferenceAssemblies = TestReferences.EmptyReferenceAssemblies, @@ -908,9 +907,9 @@ private static Task VerifyAnalyzerAsync(string source, params DiagnosticResult[] return test.RunAsync(); } - private sealed class TagHelpersInCodeBlocksCSharpAnalzyerTest : CSharpAnalyzerTest + private sealed class TagHelpersInCodeBlocksCSharpAnalyzerTest : CSharpAnalyzerTest { - public TagHelpersInCodeBlocksCSharpAnalzyerTest(ImmutableArray metadataReferences) + public TagHelpersInCodeBlocksCSharpAnalyzerTest(ImmutableArray metadataReferences) { TestState.AdditionalReferences.AddRange(metadataReferences); } diff --git a/src/Mvc/Mvc.Analyzers/test/TopLevelParameterNameAnalyzerTest.cs b/src/Mvc/Mvc.Analyzers/test/TopLevelParameterNameAnalyzerTest.cs index 50fb4048110b..5a176ccaf3f4 100644 --- a/src/Mvc/Mvc.Analyzers/test/TopLevelParameterNameAnalyzerTest.cs +++ b/src/Mvc/Mvc.Analyzers/test/TopLevelParameterNameAnalyzerTest.cs @@ -7,7 +7,6 @@ using Microsoft.CodeAnalysis.CSharp.Testing; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Testing; -using Microsoft.CodeAnalysis.Testing.Verifiers; namespace Microsoft.AspNetCore.Mvc.Analyzers; @@ -596,7 +595,7 @@ private static Task VerifyAnalyzerAsync(string source, params DiagnosticResult[] return test.RunAsync(); } - internal sealed class TopLevelParameterNameCSharpAnalyzerTest : CSharpAnalyzerTest + internal sealed class TopLevelParameterNameCSharpAnalyzerTest : CSharpAnalyzerTest { public TopLevelParameterNameCSharpAnalyzerTest(ImmutableArray metadataReferences) { diff --git a/src/OpenApi/src/Services/Schemas/OpenApiSchemaService.cs b/src/OpenApi/src/Services/Schemas/OpenApiSchemaService.cs index d7ea158b919a..90d818bc38d9 100644 --- a/src/OpenApi/src/Services/Schemas/OpenApiSchemaService.cs +++ b/src/OpenApi/src/Services/Schemas/OpenApiSchemaService.cs @@ -212,7 +212,13 @@ private async Task InnerApplySchemaTransformersAsync(OpenApiSchema schema, } } } - } + + if (schema is { AdditionalPropertiesAllowed: true, AdditionalProperties: not null } && jsonTypeInfo.ElementType is not null) + { + var elementTypeInfo = _jsonSerializerOptions.GetTypeInfo(jsonTypeInfo.ElementType); + await InnerApplySchemaTransformersAsync(schema.AdditionalProperties, elementTypeInfo, null, context, transformer, cancellationToken); + } + } private JsonNode CreateSchema(OpenApiSchemaKey key) => JsonSchemaExporter.GetJsonSchemaAsNode(_jsonSerializerOptions, key.Type, _configuration); diff --git a/src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Transformers/SchemaTransformerTests.cs b/src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Transformers/SchemaTransformerTests.cs index 5d20c810d6fa..565c3a2b48b1 100644 --- a/src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Transformers/SchemaTransformerTests.cs +++ b/src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Transformers/SchemaTransformerTests.cs @@ -444,6 +444,7 @@ public async Task SchemaTransformer_CanModifyItemTypesInADocument() builder.MapGet("/list", () => new List { 1, 2, 3, 4 }); builder.MapGet("/single", () => 1); + builder.MapGet("/dictionary", () => new Dictionary {{ "key", 1 }}); var options = new OpenApiOptions(); options.AddSchemaTransformer((schema, context, cancellationToken) => @@ -469,7 +470,13 @@ await VerifyOpenApiDocument(builder, options, document => getOperation = path.Operations[OperationType.Get]; responseSchema = getOperation.Responses["200"].Content["application/json"].Schema.GetEffective(document); Assert.Equal("modified-number-format", responseSchema.Format); - }); + + // Assert that the schema represent dictionary values has been modified + path = document.Paths["/dictionary"]; + getOperation = path.Operations[OperationType.Get]; + responseSchema = getOperation.Responses["200"].Content["application/json"].Schema.GetEffective(document); + Assert.Equal("modified-number-format", responseSchema.AdditionalProperties.Format); + }); } [Fact] diff --git a/src/ProjectTemplates/TestInfrastructure/PrepareForTest.targets b/src/ProjectTemplates/TestInfrastructure/PrepareForTest.targets index fd49e9376cc5..0a886b420c11 100644 --- a/src/ProjectTemplates/TestInfrastructure/PrepareForTest.targets +++ b/src/ProjectTemplates/TestInfrastructure/PrepareForTest.targets @@ -6,7 +6,7 @@ <_Parameter1>DotNetEfFullPath - <_Parameter2>$([MSBuild]::EnsureTrailingSlash('$(NuGetPackageRoot)'))dotnet-ef/$(DotnetEfVersion)/tools/net8.0/any/dotnet-ef.dll + <_Parameter2>$([MSBuild]::EnsureTrailingSlash('$(NuGetPackageRoot)'))dotnet-ef/$(DotnetEfVersion)/tools/net10.0/any/dotnet-ef.dll <_Parameter1>TestPackageRestorePath diff --git a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.en.json b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.en.json index 5ad4270f3018..7d96522590eb 100644 --- a/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.en.json +++ b/src/ProjectTemplates/Web.ProjectTemplates/content/BlazorWeb-CSharp/.template.config/localize/templatestrings.en.json @@ -21,13 +21,13 @@ "symbols/InteractivityPlatform/choices/WebAssembly/description": "Runs in the browser using WebAssembly", "symbols/InteractivityPlatform/choices/Auto/displayName": "Auto (Server and WebAssembly)", "symbols/InteractivityPlatform/choices/Auto/description": "Uses Server while downloading WebAssembly assets, then uses WebAssembly", - "symbols/InteractivityLocation/displayName": "_Interactivity location", + "symbols/InteractivityLocation/displayName": "Interactivity _location", "symbols/InteractivityLocation/description": "Chooses which components will have interactive rendering enabled", "symbols/InteractivityLocation/choices/InteractivePerPage/displayName": "Per page/component", "symbols/InteractivityLocation/choices/InteractivePerPage/description": "Interactivity is applied on a per-page or per-component basis", "symbols/InteractivityLocation/choices/InteractiveGlobal/displayName": "Global", "symbols/InteractivityLocation/choices/InteractiveGlobal/description": "Interactivity is applied at the root level", - "symbols/IncludeSampleContent/displayName": "_Include sample pages", + "symbols/IncludeSampleContent/displayName": "Include _sample pages", "symbols/IncludeSampleContent/description": "Configures whether to add sample pages and styling to demonstrate basic usage patterns.", "symbols/Empty/description": "Configures whether to omit sample pages and styling that demonstrate basic usage patterns.", "symbols/auth/choices/None/description": "No authentication", diff --git a/src/Servers/Kestrel/Core/src/Internal/Infrastructure/TransportManager.cs b/src/Servers/Kestrel/Core/src/Internal/Infrastructure/TransportManager.cs index c5651c50d2fa..8e2585e75d74 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Infrastructure/TransportManager.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Infrastructure/TransportManager.cs @@ -11,7 +11,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure; internal sealed class TransportManager { - private readonly List _transports = new List(); + private readonly List _transports = []; private readonly List _transportFactories; private readonly List _multiplexedTransportFactories; @@ -30,7 +30,6 @@ public TransportManager( _serviceContext = serviceContext; } - private ConnectionManager ConnectionManager => _serviceContext.ConnectionManager; private KestrelTrace Trace => _serviceContext.Log; public async Task BindAsync(EndPoint endPoint, ConnectionDelegate connectionDelegate, EndpointConfig? endpointConfig, CancellationToken cancellationToken) diff --git a/src/Servers/Kestrel/startvscode.cmd b/src/Servers/Kestrel/startvscode.cmd new file mode 100644 index 000000000000..1f6448bbdff9 --- /dev/null +++ b/src/Servers/Kestrel/startvscode.cmd @@ -0,0 +1,3 @@ +@ECHO OFF + +%~dp0..\..\..\startvscode.cmd %~dp0 diff --git a/src/Servers/Kestrel/startvscode.sh b/src/Servers/Kestrel/startvscode.sh new file mode 100644 index 000000000000..9e44ad5032a9 --- /dev/null +++ b/src/Servers/Kestrel/startvscode.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +repo_root="$DIR/../../.." +"$repo_root/startvscode.sh" $DIR diff --git a/src/Testing/src/xunit/SkipOnHelixAttribute.cs b/src/Testing/src/xunit/SkipOnHelixAttribute.cs index 38b376cb6808..2c7b66f75a67 100644 --- a/src/Testing/src/xunit/SkipOnHelixAttribute.cs +++ b/src/Testing/src/xunit/SkipOnHelixAttribute.cs @@ -66,7 +66,10 @@ private bool ShouldSkip() return true; } - return Queues.ToLowerInvariant().Split(';').Contains(targetQueue); + // We have "QueueName" and "QueueName.Open" queues for internal and public builds + // If we want to skip the test in the public queue, we want to skip it in the internal queue, and vice versa + return Queues.ToLowerInvariant().Split(';').Any(q => q.Equals(targetQueue, StringComparison.Ordinal) || q.StartsWith(targetQueue, StringComparison.Ordinal) || + targetQueue.StartsWith(q, StringComparison.Ordinal)); } public static bool OnHelix() => HelixHelper.OnHelix(); diff --git a/src/Tools/dotnet-user-jwts/src/Commands/ClearCommand.cs b/src/Tools/dotnet-user-jwts/src/Commands/ClearCommand.cs index 2b977e3f6313..531b45b6f11e 100644 --- a/src/Tools/dotnet-user-jwts/src/Commands/ClearCommand.cs +++ b/src/Tools/dotnet-user-jwts/src/Commands/ClearCommand.cs @@ -19,21 +19,32 @@ public static void Register(ProjectCommandLineApplication app) Resources.ClearCommand_ForceOption_Description, CommandOptionType.NoValue); + var appsettingsFileOption = cmd.Option( + "--appsettings-file", + Resources.CreateCommand_appsettingsFileOption_Description, + CommandOptionType.SingleValue); + cmd.HelpOption("-h|--help"); cmd.OnExecute(() => { - return Execute(cmd.Reporter, cmd.ProjectOption.Value(), forceOption.HasValue()); + if (!DevJwtCliHelpers.GetProjectAndSecretsId(cmd.ProjectOption.Value(), cmd.Reporter, out var project, out var userSecretsId)) + { + return 1; + } + + if (!DevJwtCliHelpers.GetAppSettingsFile(project, appsettingsFileOption.Value(), cmd.Reporter, out var appsettingsFile)) + { + return 1; + } + + return Execute(cmd.Reporter, project, userSecretsId, forceOption.HasValue(), appsettingsFile); }); }); } - private static int Execute(IReporter reporter, string projectPath, bool force) + private static int Execute(IReporter reporter, string project, string userSecretsId, bool force, string appsettingsFile) { - if (!DevJwtCliHelpers.GetProjectAndSecretsId(projectPath, reporter, out var project, out var userSecretsId)) - { - return 1; - } var jwtStore = new JwtStore(userSecretsId); var count = jwtStore.Jwts.Count; @@ -54,7 +65,7 @@ private static int Execute(IReporter reporter, string projectPath, bool force) } } - var appsettingsFilePath = Path.Combine(Path.GetDirectoryName(project), "appsettings.Development.json"); + var appsettingsFilePath = Path.Combine(Path.GetDirectoryName(project), appsettingsFile); foreach (var jwt in jwtStore.Jwts) { JwtAuthenticationSchemeSettings.RemoveScheme(appsettingsFilePath, jwt.Value.Scheme); diff --git a/src/Tools/dotnet-user-jwts/src/Commands/CreateCommand.cs b/src/Tools/dotnet-user-jwts/src/Commands/CreateCommand.cs index ef3a3b833655..58f3969bab76 100644 --- a/src/Tools/dotnet-user-jwts/src/Commands/CreateCommand.cs +++ b/src/Tools/dotnet-user-jwts/src/Commands/CreateCommand.cs @@ -77,24 +77,29 @@ public static void Register(ProjectCommandLineApplication app, Program program) Resources.CreateCommand_ValidForOption_Description, CommandOptionType.SingleValue); + var appsettingsFileOption = cmd.Option( + "--appsettings-file", + Resources.CreateCommand_appsettingsFileOption_Description, + CommandOptionType.SingleValue); + cmd.HelpOption("-h|--help"); cmd.OnExecute(() => { - var (options, isValid, optionsString) = ValidateArguments( - cmd.Reporter, cmd.ProjectOption, schemeNameOption, nameOption, audienceOption, issuerOption, notBeforeOption, expiresOnOption, validForOption, rolesOption, scopesOption, claimsOption); + var (options, isValid, optionsString, appsettingsFile) = ValidateArguments( + cmd.Reporter, cmd.ProjectOption, schemeNameOption, nameOption, audienceOption, issuerOption, notBeforeOption, expiresOnOption, validForOption, rolesOption, scopesOption, claimsOption, appsettingsFileOption); if (!isValid) { return 1; } - return Execute(cmd.Reporter, cmd.ProjectOption.Value(), options, optionsString, cmd.OutputOption.Value(), program); + return Execute(cmd.Reporter, cmd.ProjectOption.Value(), options, optionsString, cmd.OutputOption.Value(), appsettingsFile, program); }); }); } - private static (JwtCreatorOptions, bool, string) ValidateArguments( + private static (JwtCreatorOptions, bool, string, string) ValidateArguments( IReporter reporter, CommandOption projectOption, CommandOption schemeNameOption, @@ -106,7 +111,8 @@ private static (JwtCreatorOptions, bool, string) ValidateArguments( CommandOption validForOption, CommandOption rolesOption, CommandOption scopesOption, - CommandOption claimsOption) + CommandOption claimsOption, + CommandOption appsettingsFileOption) { var isValid = true; var finder = new MsBuildProjectFinder(Directory.GetCurrentDirectory()); @@ -121,6 +127,7 @@ private static (JwtCreatorOptions, bool, string) ValidateArguments( return ( null, isValid, + string.Empty, string.Empty ); } @@ -209,10 +216,19 @@ private static (JwtCreatorOptions, bool, string) ValidateArguments( optionsString += $"{Resources.JwtPrint_CustomClaims}: [{string.Join(", ", claims.Select(kvp => $"{kvp.Key}={kvp.Value}"))}]{Environment.NewLine}"; } + var appsettingsFile = DevJwtCliHelpers.DefaultAppSettingsFile; + if (appsettingsFileOption.HasValue()) + { + isValid = DevJwtCliHelpers.GetAppSettingsFile(project, appsettingsFileOption.Value(), reporter, out appsettingsFile); + + optionsString += appsettingsFileOption.HasValue() ? $"{Resources.JwtPrint_appsettingsFile}: {appsettingsFile}{Environment.NewLine}" : string.Empty; + } + return ( new JwtCreatorOptions(scheme, name, audience, issuer, notBefore, expiresOn, roles, scopes, claims), isValid, - optionsString); + optionsString, + appsettingsFile); static bool ParseDate(string datetime, out DateTime parsedDateTime) => DateTime.TryParseExact(datetime, _dateTimeFormats, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal, out parsedDateTime); @@ -224,6 +240,7 @@ private static int Execute( JwtCreatorOptions options, string optionsString, string outputFormat, + string appsettingsFile, Program program) { if (!DevJwtCliHelpers.GetProjectAndSecretsId(projectPath, reporter, out var project, out var userSecretsId)) @@ -244,7 +261,7 @@ private static int Execute( jwtStore.Jwts.Add(jwtToken.Id, jwt); jwtStore.Save(); - var appsettingsFilePath = Path.Combine(Path.GetDirectoryName(project), "appsettings.Development.json"); + var appsettingsFilePath = Path.Combine(Path.GetDirectoryName(project), appsettingsFile); var settingsToWrite = new JwtAuthenticationSchemeSettings(options.Scheme, options.Audiences, options.Issuer); settingsToWrite.Save(appsettingsFilePath); diff --git a/src/Tools/dotnet-user-jwts/src/Commands/RemoveCommand.cs b/src/Tools/dotnet-user-jwts/src/Commands/RemoveCommand.cs index 0c3a69eaf40e..9260a70b1219 100644 --- a/src/Tools/dotnet-user-jwts/src/Commands/RemoveCommand.cs +++ b/src/Tools/dotnet-user-jwts/src/Commands/RemoveCommand.cs @@ -15,6 +15,12 @@ public static void Register(ProjectCommandLineApplication app) cmd.Description = Resources.RemoveCommand_Description; var idArgument = cmd.Argument("[id]", Resources.RemoveCommand_IdArgument_Description); + + var appsettingsFileOption = cmd.Option( + "--appsettings-file", + Resources.CreateCommand_appsettingsFileOption_Description, + CommandOptionType.SingleValue); + cmd.HelpOption("-h|--help"); cmd.OnExecute(() => @@ -24,17 +30,24 @@ public static void Register(ProjectCommandLineApplication app) cmd.ShowHelp(); return 0; } - return Execute(cmd.Reporter, cmd.ProjectOption.Value(), idArgument.Value); + + if (!DevJwtCliHelpers.GetProjectAndSecretsId(cmd.ProjectOption.Value(), cmd.Reporter, out var project, out var userSecretsId)) + { + return 1; + } + + if (!DevJwtCliHelpers.GetAppSettingsFile(project, appsettingsFileOption.Value(), cmd.Reporter, out var appsettingsFile)) + { + return 1; + } + + return Execute(cmd.Reporter, project, userSecretsId, idArgument.Value, appsettingsFile); }); }); } - private static int Execute(IReporter reporter, string projectPath, string id) + private static int Execute(IReporter reporter, string project, string userSecretsId, string id, string appsettingsFile) { - if (!DevJwtCliHelpers.GetProjectAndSecretsId(projectPath, reporter, out var project, out var userSecretsId)) - { - return 1; - } var jwtStore = new JwtStore(userSecretsId); if (!jwtStore.Jwts.TryGetValue(id, out var jwt)) @@ -43,7 +56,7 @@ private static int Execute(IReporter reporter, string projectPath, string id) return 1; } - var appsettingsFilePath = Path.Combine(Path.GetDirectoryName(project), "appsettings.Development.json"); + var appsettingsFilePath = Path.Combine(Path.GetDirectoryName(project), appsettingsFile); JwtAuthenticationSchemeSettings.RemoveScheme(appsettingsFilePath, jwt.Scheme); jwtStore.Jwts.Remove(id); jwtStore.Save(); diff --git a/src/Tools/dotnet-user-jwts/src/Helpers/DevJwtCliHelpers.cs b/src/Tools/dotnet-user-jwts/src/Helpers/DevJwtCliHelpers.cs index 2d12b67f55a4..38735fb5231f 100644 --- a/src/Tools/dotnet-user-jwts/src/Helpers/DevJwtCliHelpers.cs +++ b/src/Tools/dotnet-user-jwts/src/Helpers/DevJwtCliHelpers.cs @@ -11,6 +11,8 @@ namespace Microsoft.AspNetCore.Authentication.JwtBearer.Tools; internal static class DevJwtCliHelpers { + public const string DefaultAppSettingsFile = "appsettings.Development.json"; + public static string GetOrSetUserSecretsId(string projectFilePath) { var resolver = new ProjectIdResolver(NullReporter.Singleton, projectFilePath); @@ -42,6 +44,27 @@ public static bool GetProjectAndSecretsId(string projectPath, IReporter reporter return true; } + public static bool GetAppSettingsFile(string projectPath, string appsettingsFileOption, IReporter reporter, out string appsettingsFile) + { + appsettingsFile = DevJwtCliHelpers.DefaultAppSettingsFile; + if (appsettingsFileOption is not null) + { + appsettingsFile = appsettingsFileOption; + if (!appsettingsFile.EndsWith(".json", StringComparison.OrdinalIgnoreCase)) + { + reporter.Error(Resources.RemoveCommand_InvalidAppsettingsFile_Error); + return false; + } + else if (!File.Exists(Path.Combine(Path.GetDirectoryName(projectPath), appsettingsFile))) + { + reporter.Error(Resources.FormatRemoveCommand_AppsettingsFileNotFound_Error(Path.Combine(Path.GetDirectoryName(projectPath), appsettingsFile))); + return false; + } + } + + return true; + } + public static List GetAudienceCandidatesFromLaunchSettings(string project) { if (string.IsNullOrEmpty(project)) @@ -213,4 +236,5 @@ public static bool IsNullOrEmpty(this IEnumerable enumerable) { return enumerable == null || !enumerable.Any(); } + } diff --git a/src/Tools/dotnet-user-jwts/src/Resources.resx b/src/Tools/dotnet-user-jwts/src/Resources.resx index 094a066418d9..9f4ff3c041ac 100644 --- a/src/Tools/dotnet-user-jwts/src/Resources.resx +++ b/src/Tools/dotnet-user-jwts/src/Resources.resx @@ -150,6 +150,12 @@ The UTC date & time the JWT should expire in the format 'yyyy-MM-dd [[[[HH:mm]]:ss]]'. Defaults to 3 months after the --not-before date. Do not use this option in conjunction with the --valid-for option. + + Invalid Appsettings file extension. Ensure file extension is .json. + + + Could not find Appsettings file in '{0}'. Check the filename and that the file exists. + Malformed claims supplied. Ensure each claim is in the format "name=value". @@ -189,6 +195,9 @@ The period the JWT should expire after. Specify using a number followed by a duration type like 'd' for days, 'h' for hours, 'm' for minutes, and 's' for seconds, e.g. '365d'. Do not use this option in conjunction with the --expires-on option. + + The appSettings configuration file to add the test scheme to. + Audience(s) @@ -225,6 +234,9 @@ Scopes + + Appsettings File + Token @@ -312,6 +324,12 @@ No JWT with ID '{0}' found. + + The specified appsettings file is invalid. Please provide a valid JSON file. + + + Could not find Appsettings file '{0}'. Check the filename and that the file exists. + The issuer associated with the signing key to be reset or displayed. Defaults to 'dotnet-user-jwts'. diff --git a/src/Tools/dotnet-user-jwts/test/UserJwtsTestFixture.cs b/src/Tools/dotnet-user-jwts/test/UserJwtsTestFixture.cs index 946530df7c6a..b812a017255c 100644 --- a/src/Tools/dotnet-user-jwts/test/UserJwtsTestFixture.cs +++ b/src/Tools/dotnet-user-jwts/test/UserJwtsTestFixture.cs @@ -81,6 +81,10 @@ public string CreateProject(bool hasSecret = true) Path.Combine(projectPath.FullName, "appsettings.Development.json"), "{}"); + File.WriteAllText( + Path.Combine(projectPath.FullName, "appsettings.Local.json"), + "{}"); + if (hasSecret) { _disposables.Push(() => diff --git a/src/Tools/dotnet-user-jwts/test/UserJwtsTests.cs b/src/Tools/dotnet-user-jwts/test/UserJwtsTests.cs index 801e414fe95e..f98549ba8212 100644 --- a/src/Tools/dotnet-user-jwts/test/UserJwtsTests.cs +++ b/src/Tools/dotnet-user-jwts/test/UserJwtsTests.cs @@ -116,6 +116,23 @@ public void Create_CanModifyExistingScheme() Assert.Equal("new-issuer", appSettings["Authentication"]["Schemes"]["Bearer"]["ValidIssuer"].GetValue()); } + [Fact] + public void Create_CanModifyExistingSchemeInGivenAppSettings() + { + var project = Path.Combine(fixture.CreateProject(), "TestProject.csproj"); + var appsettings = Path.Combine(Path.GetDirectoryName(project), "appsettings.Local.json"); + var app = new Program(_console); + + app.Run(new[] { "create", "--project", project, "--appsettings-file", "appsettings.Local.json" }); + Assert.Contains("New JWT saved", _console.GetOutput()); + + var appSettings = JsonSerializer.Deserialize(File.ReadAllText(appsettings)); + Assert.Equal("dotnet-user-jwts", appSettings["Authentication"]["Schemes"]["Bearer"]["ValidIssuer"].GetValue()); + app.Run(["create", "--project", project, "--issuer", "new-issuer", "--appsettings-file", "appsettings.Local.json"]); + appSettings = JsonSerializer.Deserialize(File.ReadAllText(appsettings)); + Assert.Equal("new-issuer", appSettings["Authentication"]["Schemes"]["Bearer"]["ValidIssuer"].GetValue()); + } + [Fact] public void Print_ReturnsNothingForMissingToken() { @@ -191,6 +208,24 @@ public void Remove_RemovesGeneratedToken() Assert.Contains("Scheme2", appsettingsContent); } + [Fact] + public void Remove_RemovesGeneratedTokenInGivenAppsettings() + { + var project = Path.Combine(fixture.CreateProject(), "TestProject.csproj"); + var appsettings = Path.Combine(Path.GetDirectoryName(project), "appsettings.Local.json"); + var app = new Program(_console); + + app.Run(new[] { "create", "--project", project, "--appsettings-file", "appsettings.Local.json" }); + var matches = Regex.Matches(_console.GetOutput(), "New JWT saved with ID '(.*?)'"); + var id = matches.SingleOrDefault().Groups[1].Value; + app.Run(new[] { "create", "--project", project, "--appsettings-file", "appsettings.Local.json", "--scheme", "Scheme2" }); + + app.Run(new[] { "remove", id, "--project", project, "--appsettings-file", "appsettings.Local.json" }); + var appsettingsContent = File.ReadAllText(appsettings); + Assert.DoesNotContain(DevJwtsDefaults.Scheme, appsettingsContent); + Assert.Contains("Scheme2", appsettingsContent); + } + [Fact] public void Clear_RemovesGeneratedTokens() { @@ -209,6 +244,24 @@ public void Clear_RemovesGeneratedTokens() Assert.DoesNotContain("Scheme2", appsettingsContent); } + [Fact] + public void Clear_RemovesGeneratedTokensInGivenAppsettings() + { + var project = Path.Combine(fixture.CreateProject(), "TestProject.csproj"); + var appsettings = Path.Combine(Path.GetDirectoryName(project), "appsettings.Local.json"); + var app = new Program(_console); + + app.Run(new[] { "create", "--project", project, "--appsettings-file", "appsettings.Local.json" }); + app.Run(new[] { "create", "--project", project, "--appsettings-file", "appsettings.Local.json", "--scheme", "Scheme2" }); + + Assert.Contains("New JWT saved", _console.GetOutput()); + + app.Run(new[] { "clear", "--project", project, "--appsettings-file", "appsettings.Local.json", "--force" }); + var appsettingsContent = File.ReadAllText(appsettings); + Assert.DoesNotContain(DevJwtsDefaults.Scheme, appsettingsContent); + Assert.DoesNotContain("Scheme2", appsettingsContent); + } + [Fact] public void Key_CanResetSigningKey() { @@ -662,6 +715,19 @@ public void Create_CanHandleNoProjectOptionProvided_WithNoProjects() Assert.DoesNotContain(Resources.CreateCommand_NoAudience_Error, _console.GetOutput()); } + [Fact] + public void Create_CanHandleAppsettingsOption_WithNoFile() + { + var projectPath = fixture.CreateProject(); + Directory.SetCurrentDirectory(projectPath); + var expectedAppsettingsPath = Path.Combine(Directory.GetCurrentDirectory(), "appsettings.DoesNotExist.json"); + + var app = new Program(_console); + app.Run(["create", "--appsettings-file", "appsettings.DoesNotExist.json"]); + + Assert.Contains($"Could not find Appsettings file '{expectedAppsettingsPath}'. Check the filename and that the file exists.", _console.GetOutput()); + } + [Fact] public void Delete_CanHandleNoProjectOptionProvided_WithNoProjects() { @@ -674,6 +740,19 @@ public void Delete_CanHandleNoProjectOptionProvided_WithNoProjects() Assert.Contains($"Could not find a MSBuild project file in '{Directory.GetCurrentDirectory()}'. Specify which project to use with the --project option.", _console.GetOutput()); } + [Fact] + public void Delete_CanHandleAppsettingsOption_WithNoFile() + { + var projectPath = fixture.CreateProject(); + Directory.SetCurrentDirectory(projectPath); + var expectedAppsettingsPath = Path.Combine(Directory.GetCurrentDirectory(), "appsettings.DoesNotExist.json"); + + var app = new Program(_console); + app.Run(["remove", "some-id", "--appsettings-file", "appsettings.DoesNotExist.json"]); + + Assert.Contains($"Could not find Appsettings file '{expectedAppsettingsPath}'. Check the filename and that the file exists.", _console.GetOutput()); + } + [Fact] public void Clear_CanHandleNoProjectOptionProvided_WithNoProjects() { @@ -686,6 +765,19 @@ public void Clear_CanHandleNoProjectOptionProvided_WithNoProjects() Assert.Contains($"Could not find a MSBuild project file in '{Directory.GetCurrentDirectory()}'. Specify which project to use with the --project option.", _console.GetOutput()); } + [Fact] + public void Clear_CanHandleAppsettingsOption_WithNoFile() + { + var projectPath = fixture.CreateProject(); + Directory.SetCurrentDirectory(projectPath); + var expectedAppsettingsPath = Path.Combine(Directory.GetCurrentDirectory(), "appsettings.DoesNotExist.json"); + + var app = new Program(_console); + app.Run(["clear", "--appsettings-file", "appsettings.DoesNotExist.json"]); + + Assert.Contains($"Could not find Appsettings file '{expectedAppsettingsPath}'. Check the filename and that the file exists.", _console.GetOutput()); + } + [Fact] public void List_CanHandleNoProjectOptionProvided_WithNoProjects() { @@ -741,6 +833,21 @@ public void Create_CanHandleRelativePathAsOption() Assert.Contains("New JWT saved", _console.GetOutput()); } + [Fact] + public void Create_CanHandleRelativePathAsOptionForAppsettingsOption() + { + var projectPath = fixture.CreateProject(); + var tempPath = Path.GetTempPath(); + var targetPath = Path.GetRelativePath(tempPath, projectPath); + Directory.SetCurrentDirectory(tempPath); + + var app = new Program(_console); + app.Run(new[] { "create", "--project", targetPath, "--appsettings-file", "appsettings.Local.json" }); + + Assert.DoesNotContain($"Could not find Appsettings file '{projectPath}'. Check the filename and that the file exists.", _console.GetOutput()); + Assert.Contains("New JWT saved", _console.GetOutput()); + } + [ConditionalFact] [OSSkipCondition(OperatingSystems.Windows, SkipReason = "UnixFileMode is not supported on Windows.")] public void Create_CreatesFileWithUserOnlyUnixFileMode() diff --git a/src/submodules/googletest b/src/submodules/googletest index 79219e26e0e3..7d76a231b0e2 160000 --- a/src/submodules/googletest +++ b/src/submodules/googletest @@ -1 +1 @@ -Subproject commit 79219e26e0e36b415a5804b6b017ad6c6cd99ad8 +Subproject commit 7d76a231b0e29caf86e68d1df858308cd53b2a66