diff --git a/.devcontainer/README.md b/.devcontainer/README.md index 7f0a5cd2646..0b57c52abed 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -12,12 +12,10 @@ This Codespace allows you to debug or make changes to the .NET SDK product. The 45 up to 75 minutes (depending on the machine and OS) and, after completion, produces an archived .NET SDK located in `/workspaces/dotnet/artifacts/assets/Release`. -In case you selected the prebuilt-sdk Codespace configuration (which is only useful when building -from source), the built-from-source SDK will already be there. - ## Build the SDK To build the repository, run one of the following: + ```bash # Microsoft based build ./build.sh @@ -32,30 +30,4 @@ or > Please note that, at this time, the build modifies some of the checked-in sources so it might be preferential to rebuild the Codespace between attempts (or reset the working tree changes). -For more details, see the instructions at https://github.com/dotnet/dotnet. - -## Synchronize your changes in locally - -When debugging the build, you have two options how to test your changes in this environment. - -### Making changes to the VMR directly - -You can make the changes directly to the local checkout of the VMR at `/workspaces/dotnet`. You -can then try to build the VMR and see if the change works for you. - -### Pull changes into the Codespace from your fork - -You can also make a fix in the individual source repository (e.g. `dotnet/runtime`) and push the -fix into a branch; can be in your fork too. Once you have the commit pushed, you can pull this -version of the repository into the Codespace by running: - -``` -/workspaces/synchronize-vmr.sh \ - --repository : \ - --remote : -``` - -You can now proceed building the VMR in the Codespace using instructions above. You can repeat -this process and sync a new commit from your fork. Only note that, at this time, Source-Build -modifies some of the checked-in sources so you'll need to revert the working tree changes -between attempts. +For more details, see the instructions at https://github.com/dotnet/dotnet#building. diff --git a/.devcontainer/init.sh b/.devcontainer/init.sh index c7315cf3e74..e329e79c358 100755 --- a/.devcontainer/init.sh +++ b/.devcontainer/init.sh @@ -11,6 +11,4 @@ vmr_dir=$(realpath "$workspace_dir/dotnet") $vmr_dir/.devcontainer/init-toolset.sh $vmr_dir -cp "$vmr_dir/.devcontainer/synchronize-vmr.sh" "$workspace_dir" - mkdir -p "$tmp_dir" diff --git a/.devcontainer/prebuilt-sdk/devcontainer.json b/.devcontainer/prebuilt-sdk/devcontainer.json deleted file mode 100644 index c30ad3f24f0..00000000000 --- a/.devcontainer/prebuilt-sdk/devcontainer.json +++ /dev/null @@ -1,22 +0,0 @@ -// Container contains a pre-built SDK -{ - "name": "Pre-built .NET SDK", - "image": "mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream9", - "hostRequirements": { - // A completely source built .NET is >64 GB with all the repos/artifacts - "storage": "128gb" - }, - "customizations": { - "vscode": { - "extensions": [ - "ms-dotnettools.csharp" - ] - }, - "codespaces": { - "openFiles": [ - ".devcontainer/README.md" - ] - } - }, - "onCreateCommand": ".devcontainer/prebuilt-sdk/init.sh" -} diff --git a/.devcontainer/prebuilt-sdk/init.sh b/.devcontainer/prebuilt-sdk/init.sh deleted file mode 100644 index 517ed62296b..00000000000 --- a/.devcontainer/prebuilt-sdk/init.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -source="${BASH_SOURCE[0]}" -script_root="$( cd -P "$( dirname "$source" )" && pwd )" - -"$script_root"/../../prep-source-build.sh - -cp "$script_root/../synchronize-vmr.sh" "/workspaces/" -"$script_root"/../../build.sh --online --clean-while-building || exit 0 diff --git a/.devcontainer/synchronize-vmr.sh b/.devcontainer/synchronize-vmr.sh deleted file mode 100755 index ce3a2a74291..00000000000 --- a/.devcontainer/synchronize-vmr.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -(cd /workspaces/dotnet/src/sdk \ - && ./eng/vmr-sync.sh --vmr /workspaces/dotnet --tmp /workspaces/tmp $*) diff --git a/.github/workflows/protected-files-validation.yml b/.github/workflows/protected-files-validation.yml new file mode 100644 index 00000000000..6fac13eb5fa --- /dev/null +++ b/.github/workflows/protected-files-validation.yml @@ -0,0 +1,22 @@ +name: 'Check Protected Files for Changes' + +on: + pull_request: + # Update the error message when changing these paths + paths: + - eng/common/**/* + - eng/Version.Details.xml + - eng/Versions.props + +permissions: + pull-requests: read + +jobs: + check-protect-files: + runs-on: ubuntu-22.04 + if: ${{ github.event.pull_request.user.login != 'dotnet-sb-bot' && github.event.pull_request.user.login != 'dotnet-maestro' }} + steps: + - name: Protected File has Changes + run: | + echo "Cannot make changes to 'eng/Version.Details.xml', 'eng/Versions.props', and 'eng/common/' outside of a rebootstrap or .NET Source-Build release PR." + exit 1 diff --git a/CODEOWNERS b/CODEOWNERS index c109a7e4fd0..b89b872462c 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -7,6 +7,9 @@ # requested for review when someone opens a pull request. * @dotnet/product-construction @dotnet/source-build +# We must guard against these files being created temporarily (https://github.com/dotnet/source-build/issues/4491) +/prereqs/git-info/ @premun + # Exclude the src folder which is team specific /src/ diff --git a/Directory.Packages.props b/Directory.Packages.props index 28b7331b6d7..d54bcf6c82d 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -9,7 +9,7 @@ - + diff --git a/README.md b/README.md index 82d5a7a26d1..bf36936c82a 100644 --- a/README.md +++ b/README.md @@ -15,12 +15,11 @@ In the VMR, you can find: - *[in future]* E2E tests for the whole .NET product. Just like the development repositories, the VMR will have a release branch for every feature band (e.g. `release/10.0.1xx`). -Similarly, VMR's `main` branch will follow default branches of product repositories (see [Synchronization Based on Declared Dependencies](src/arcade/Documentation/UnifiedBuild/VMR-Design-And-Operation.md#synchronization-based-on-declared-dependencies)). +Similarly, VMR's `main` branch will follow default branches of product repositories (see [Synchronization Based on Declared Dependencies](docs/VMR-Design-And-Operation.md#synchronization-based-on-declared-dependencies)). -More in-depth documentation about the VMR can be found in [VMR Design And Operation](src/arcade/Documentation/UnifiedBuild/VMR-Design-And-Operation.md#layout). +More in-depth documentation about the VMR can be found in [VMR Design And Operation](docs/VMR-Design-And-Operation.md#layout). See also [dotnet/source-build](https://github.com/dotnet/source-build) for more information about our whole-product source-build. - ## Installing the SDK You can download the .NET SDK either as an installer (MSI, PKG) or as an archive (zip, tar.gz). The .NET SDK contains both the .NET runtimes and CLI tools. @@ -32,7 +31,7 @@ You can download the .NET SDK either as an installer (MSI, PKG) or as an archive - The main purpose of the [dotnet/dotnet](https://github.com/dotnet/dotnet) repository is to have all source code necessary to build the .NET product available in one repository and identified by a single commit. - The VMR also aims to become the place from which we release and service future versions of .NET to reduce the complexity of the product construction process. This should allow our partners and and 3rd parties to easily build, test and modify .NET using their custom infrastructure as well as make the process available to the community. - Lastly, we hope to solve other problems that the current multi-repo setup brings: - - Enable the standard [down-/up-stream open-source model](src/arcade/Documentation/UnifiedBuild/VMR-Upstream-Downstream.md). + - Enable the standard [down-/up-stream open-source model](docs/VMR-Upstream-Downstream.md). - Fulfill requirements of .NET distro builders such as RedHat or Canonical to natively include .NET in their distribution repositories. - Simplify scenarios such as client-run testing of bug fixes and improvements. The build should work in an offline environment too for certain platforms. - Enable developers to make and test changes spanning multiple repositories. @@ -199,20 +198,21 @@ Alternatively, you can also provide a manifest file where this information can b Sometimes you want to make a change in a repository and test that change in the VMR. You could of course make the change in the VMR directly, but in case it's already available in your repository, you can synchronize it locally into your clone of the VMR, commit, and then open a PR. -To do this, you can either start a [dotnet/dotnet](https://github.com/dotnet/dotnet) Codespace - you will see instructions right after it starts. Alternatively, you can clone the repository locally and use the [vmr-sync.sh](src/sdk/eng/vmr-sync.sh) or [vmr-sync.ps1](src/sdk/eng/vmr-sync.ps1) script to pull your changes in. Please refer to the documentation in the script for more details. +To do this, you need to use the [`darc vmr forwardflow` command](https://github.com/dotnet/arcade-services/blob/main/docs/Darc.md#forwardflow) which can move your changes from your repository's dev branch into a local VMR one. Please refer to command's documentation (`--help`) for more details. ## Filing Issues -This repo does not currently accept issues. Please file issues to the appropriate development repos. -For issues with the VMR itself, please use the [source-build repository](https://github.com/dotnet/source-build). +This repo should contain issues that are tied to the VMR infrastructure and documentation. + +For other issues, please open them in the appropriate product repos. We have links to many of them on [our new issue page](https://github.com/dotnet/dotnet/issues/new/choose). ## Useful Links - Design documentation for the VMR - a set of documents describing the high-level design and the why's and how's - - [Design and Operation](src/arcade/Documentation/UnifiedBuild/VMR-Design-And-Operation.md) - - [Upstream/Downstream Relationships](src/arcade/Documentation/UnifiedBuild/VMR-Upstream-Downstream.md) - - [Code and Build Workflow](src/arcade/Documentation/UnifiedBuild/VMR-Code-And-Build-Workflow.md) - - [Strategy for Managing External Source Dependencies](src/arcade/Documentation/UnifiedBuild/VMR-Strategy-For-External-Source.md) + - [Design and Operation](docs/VMR-Design-And-Operation.md) + - [Upstream/Downstream Relationships](docs/VMR-Upstream-Downstream.md) + - [Code and Build Workflow](docs/VMR-Code-And-Build-Workflow.md) + - [Strategy for Managing External Source Dependencies](docs/VMR-Strategy-For-External-Source.md) - [.NET Source-Build](https://github.com/dotnet/source-build) - [What is .NET](https://dotnet.microsoft.com) diff --git a/eng/Publishing.props b/eng/Publishing.props index 58b060691cf..7419cf7f96c 100644 --- a/eng/Publishing.props +++ b/eng/Publishing.props @@ -74,6 +74,8 @@ Blob + true + false %(ProducedAsset.Identity) DotNetReleaseShipping=%(ProducedAsset.DotNetReleaseShipping) diff --git a/eng/SignCheckExclusionsFile.txt b/eng/SignCheckExclusionsFile.txt index c6c7f14c7d5..5d4a5146c6c 100644 --- a/eng/SignCheckExclusionsFile.txt +++ b/eng/SignCheckExclusionsFile.txt @@ -24,6 +24,7 @@ ILCompiler.Build.Tasks.dll;; IGNORE-STRONG-NAME, https://github.com/dotnet/sourc ;; ## MACH-O ## *.dwarf;; Debugging symbols, https://github.com/dotnet/source-build/issues/4994#issuecomment-2768803544 +libbootstrapper*.o;; Not executables, https://github.com/dotnet/runtime/issues/114701#issuecomment-2807546040 ;; ## ESRP Signing Issues ## *.exe;*.whl;The .whl files are not supported by ESRP, https://github.com/dotnet/emsdk/commit/3ac196ac425223d11490e759c2641256ce746f21 diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9d0d6868bda..881016eb1c7 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -6,7 +6,7 @@ https://github.com/dotnet/dotnet b6887ba7da1721be2dcd30d68126d4a725be47f0 - + https://github.com/dotnet/dotnet b6887ba7da1721be2dcd30d68126d4a725be47f0 diff --git a/eng/Versions.props b/eng/Versions.props index cb970997247..1bac51cf735 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -26,7 +26,7 @@ 10.0.100-preview.6.25272.112 10.0.100-preview.6.25272.112 - 10.0.0-beta.25272.112 + 10.0.0-beta.25272.112 2.0.0-beta5.25208.1 diff --git a/eng/tools/BuildComparer/AssetComparer.cs b/eng/tools/BuildComparer/AssetComparer.cs index 692678d6f99..482da248639 100644 --- a/eng/tools/BuildComparer/AssetComparer.cs +++ b/eng/tools/BuildComparer/AssetComparer.cs @@ -1,8 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using Microsoft.DotNet.VersionTools.Automation; -using Microsoft.DotNet.VersionTools.BuildManifest; +using Microsoft.DotNet.Build.Manifest; using NuGet.Packaging; using System.Collections.Concurrent; using System.Collections.Immutable; diff --git a/eng/tools/BuildComparer/BuildComparer.cs b/eng/tools/BuildComparer/BuildComparer.cs index a07a24622ca..080fbf95a32 100644 --- a/eng/tools/BuildComparer/BuildComparer.cs +++ b/eng/tools/BuildComparer/BuildComparer.cs @@ -1,8 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using Microsoft.DotNet.VersionTools.Automation; -using Microsoft.DotNet.VersionTools.BuildManifest; +using Microsoft.Arcade.Common; +using Microsoft.DotNet.Build.Manifest; using NuGet.Packaging; using System.Collections.Concurrent; using System.Collections.Immutable; diff --git a/eng/tools/BuildComparer/BuildComparer.csproj b/eng/tools/BuildComparer/BuildComparer.csproj index 1cfd60e535e..0dbe36eb7ee 100644 --- a/eng/tools/BuildComparer/BuildComparer.csproj +++ b/eng/tools/BuildComparer/BuildComparer.csproj @@ -7,7 +7,7 @@ - + diff --git a/eng/tools/BuildComparer/Program.cs b/eng/tools/BuildComparer/Program.cs index 9da39dda436..fed7c52a641 100644 --- a/eng/tools/BuildComparer/Program.cs +++ b/eng/tools/BuildComparer/Program.cs @@ -1,8 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using Microsoft.DotNet.VersionTools.Automation; -using Microsoft.DotNet.VersionTools.BuildManifest; +using Microsoft.DotNet.Build.Manifest; using NuGet.Packaging; using System.Collections.Concurrent; using System.Collections.Immutable; diff --git a/eng/tools/BuildComparer/Utils.cs b/eng/tools/BuildComparer/Utils.cs index d3f7362634c..9002464f2e8 100644 --- a/eng/tools/BuildComparer/Utils.cs +++ b/eng/tools/BuildComparer/Utils.cs @@ -1,8 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using Microsoft.DotNet.VersionTools.Automation; -using Microsoft.DotNet.VersionTools.BuildManifest; +using Microsoft.DotNet.Build.Manifest; using NuGet.Packaging; using System.Collections.Concurrent; using System.Collections.Immutable; diff --git a/eng/tools/tasks/Microsoft.DotNet.SourceBuild.Tasks.LeakDetection/CheckForPoison.cs b/eng/tools/tasks/Microsoft.DotNet.SourceBuild.Tasks.LeakDetection/CheckForPoison.cs index 470fafac704..61e21fec912 100644 --- a/eng/tools/tasks/Microsoft.DotNet.SourceBuild.Tasks.LeakDetection/CheckForPoison.cs +++ b/eng/tools/tasks/Microsoft.DotNet.SourceBuild.Tasks.LeakDetection/CheckForPoison.cs @@ -171,7 +171,7 @@ public override bool Execute() } else if (poisons.Count() > 0) { - Log.LogWarning($"{poisons.Count()} marked files leaked to output. See complete report '{PoisonReportOutputFilePath}' for details."); + Log.LogMessage($"{poisons.Count()} marked files leaked to output. See complete report '{PoisonReportOutputFilePath}' for details."); } return !Log.HasLoggedErrors; diff --git a/eng/vmr-msft-comparison-baseline.json b/eng/vmr-msft-comparison-baseline.json index 118ffe65509..bb6c4d38b98 100644 --- a/eng/vmr-msft-comparison-baseline.json +++ b/eng/vmr-msft-comparison-baseline.json @@ -328,6 +328,11 @@ "idMatch": ".*Microsoft.AspNetCore.Watch.BrowserRefresh.Tests.*", "justification": "sdk non-shipping test packages are not published" }, + { + "issueType": "MissingNonShipping", + "idMatch": ".*Microsoft.DotNet.ApiDiff.Tests.*", + "justification": "sdk non-shipping test packages are not published" + }, { "issueType": "MissingNonShipping", "idMatch": ".*Microsoft.DotNet.Cli.Utils.Tests.*", @@ -518,5 +523,10 @@ "idMatch": ".*/dotnet-sdk-pgo-.*.tar.gz", "descriptionMatch": ".* is Excluded in the VMR but should be Signed", "justification": "The VMR build purposely excludes signing the PGO builds." + }, + { + "issueType": "MissingShipping", + "idMatch": ".*dotnet-suggest.*", + "justification": "command-line-api is not built from the VMR" } ] diff --git a/src/aspnetcore/.github/policies/resourceManagement.yml b/src/aspnetcore/.github/policies/resourceManagement.yml index e37a6470a61..ae1b1ebe3b4 100644 --- a/src/aspnetcore/.github/policies/resourceManagement.yml +++ b/src/aspnetcore/.github/policies/resourceManagement.yml @@ -239,8 +239,6 @@ configuration: - titleContains: pattern: Source code updates isRegex: False - - targetsBranch: - branch: main then: - addLabel: label: area-infrastructure diff --git a/src/aspnetcore/.github/workflows/backport.yml b/src/aspnetcore/.github/workflows/backport.yml index 8e29f20ada5..63c83a2658f 100644 --- a/src/aspnetcore/.github/workflows/backport.yml +++ b/src/aspnetcore/.github/workflows/backport.yml @@ -14,7 +14,7 @@ permissions: jobs: backport: - uses: dotnet/arcade/.github/workflows/backport-base.yml@9bbce22e13f399ad3cb8b4b7e53960b621f92ea1 # 2025-01-13 + uses: dotnet/arcade/.github/workflows/backport-base.yml@080e393ba794356ef2b743cc89481774c4a26656 # 2025-01-13 with: pr_description_template: | Backport of #%source_pr_number% to %target_branch% diff --git a/src/aspnetcore/.github/workflows/inter-branch-merge-flow.yml b/src/aspnetcore/.github/workflows/inter-branch-merge-flow.yml index 86a0cdb328f..2ae738d7d2a 100644 --- a/src/aspnetcore/.github/workflows/inter-branch-merge-flow.yml +++ b/src/aspnetcore/.github/workflows/inter-branch-merge-flow.yml @@ -10,4 +10,4 @@ permissions: jobs: Merge: - uses: dotnet/arcade/.github/workflows/backport-base.yml@9bbce22e13f399ad3cb8b4b7e53960b621f92ea1 # 2024-06-24 + uses: dotnet/arcade/.github/workflows/backport-base.yml@080e393ba794356ef2b743cc89481774c4a26656 # 2024-06-24 diff --git a/src/aspnetcore/eng/Version.Details.xml b/src/aspnetcore/eng/Version.Details.xml index 3362eb701e3..51539f8ffa0 100644 --- a/src/aspnetcore/eng/Version.Details.xml +++ b/src/aspnetcore/eng/Version.Details.xml @@ -8,337 +8,337 @@ See https://github.com/dotnet/arcade/blob/master/Documentation/Darc.md for instructions on using darc. --> - + - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d @@ -357,52 +357,52 @@ https://github.com/dotnet/roslyn afdd413cee50c16318620252e4e64dc326e2d300 - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - a4d6fdc935d5da12efb00a0b3b693ff1439e0b41 + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d https://github.com/dotnet/extensions diff --git a/src/aspnetcore/eng/Versions.props b/src/aspnetcore/eng/Versions.props index 715a5afa37d..c33dd843af3 100644 --- a/src/aspnetcore/eng/Versions.props +++ b/src/aspnetcore/eng/Versions.props @@ -67,97 +67,97 @@ --> - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 - 10.0.0-preview.5.25270.108 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 9.6.0-preview.1.25271.2 9.6.0-preview.1.25271.2 - 10.0.0-preview.4.25270.108 - 10.0.0-preview.4.25270.108 - 10.0.0-preview.4.25270.108 - 10.0.0-preview.4.25270.108 - 10.0.0-preview.4.25270.108 - 10.0.0-preview.4.25270.108 - 10.0.0-preview.4.25270.108 - 10.0.0-preview.4.25270.108 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 + 10.0.0-preview.6.25277.102 - 10.0.100-preview.5.25270.108 - 10.0.100-preview.5.25270.108 + 10.0.100-preview.6.25277.102 + 10.0.100-preview.6.25277.102 4.13.0-3.24613.7 @@ -170,12 +170,12 @@ 6.2.4 6.2.4 - 10.0.0-beta.25270.108 - 10.0.0-beta.25270.108 - 10.0.0-beta.25270.108 - 10.0.0-beta.25270.108 + 10.0.0-beta.25277.102 + 10.0.0-beta.25277.102 + 10.0.0-beta.25277.102 + 10.0.0-beta.25277.102 - 10.0.0-preview.25270.108 + 10.0.0-preview.25277.102 1.0.0-prerelease.25217.3 1.0.0-prerelease.25217.3 diff --git a/src/aspnetcore/eng/build.sh b/src/aspnetcore/eng/build.sh index a3c193488e8..91e398561b8 100755 --- a/src/aspnetcore/eng/build.sh +++ b/src/aspnetcore/eng/build.sh @@ -37,6 +37,7 @@ runtime_source_feed='' runtime_source_feed_key='' source_build='' product_build='' +from_vmr='' warn_as_error=true from_vmr='' diff --git a/src/aspnetcore/eng/common/build.ps1 b/src/aspnetcore/eng/common/build.ps1 index ae2309e312d..8cfee107e7a 100644 --- a/src/aspnetcore/eng/common/build.ps1 +++ b/src/aspnetcore/eng/common/build.ps1 @@ -21,6 +21,7 @@ Param( [switch] $publish, [switch] $clean, [switch][Alias('pb')]$productBuild, + [switch]$fromVMR, [switch][Alias('bl')]$binaryLog, [switch][Alias('nobl')]$excludeCIBinarylog, [switch] $ci, @@ -74,6 +75,7 @@ function Print-Usage() { Write-Host " -nativeToolsOnMachine Sets the native tools on machine environment variable (indicating that the script should use native tools on machine)" Write-Host " -nodeReuse Sets nodereuse msbuild parameter ('true' or 'false')" Write-Host " -buildCheck Sets /check msbuild parameter" + Write-Host " -fromVMR Set when building from within the VMR" Write-Host "" Write-Host "Command line arguments not listed above are passed thru to msbuild." @@ -128,6 +130,7 @@ function Build { /p:Test=$test ` /p:Pack=$pack ` /p:DotNetBuild=$productBuild ` + /p:DotNetBuildFromVMR=$fromVMR ` /p:IntegrationTest=$integrationTest ` /p:PerformanceTest=$performanceTest ` /p:Sign=$sign ` diff --git a/src/aspnetcore/eng/common/build.sh b/src/aspnetcore/eng/common/build.sh index da906da2026..9767bb411a4 100755 --- a/src/aspnetcore/eng/common/build.sh +++ b/src/aspnetcore/eng/common/build.sh @@ -43,6 +43,7 @@ usage() echo " --nodeReuse Sets nodereuse msbuild parameter ('true' or 'false')" echo " --warnAsError Sets warnaserror msbuild parameter ('true' or 'false')" echo " --buildCheck Sets /check msbuild parameter" + echo " --fromVMR Set when building from within the VMR" echo "" echo "Command line arguments not listed above are passed thru to msbuild." echo "Arguments can also be passed in with a single hyphen." @@ -64,6 +65,7 @@ restore=false build=false source_build=false product_build=false +from_vmr=false rebuild=false test=false integration_test=false @@ -89,7 +91,7 @@ verbosity='minimal' runtime_source_feed='' runtime_source_feed_key='' -properties='' +properties=() while [[ $# > 0 ]]; do opt="$(echo "${1/#--/-}" | tr "[:upper:]" "[:lower:]")" case "$opt" in @@ -142,6 +144,9 @@ while [[ $# > 0 ]]; do restore=true pack=true ;; + -fromvmr|-from-vmr) + from_vmr=true + ;; -test|-t) test=true ;; @@ -187,7 +192,7 @@ while [[ $# > 0 ]]; do shift ;; *) - properties="$properties $1" + properties+=("$1") ;; esac @@ -221,7 +226,7 @@ function Build { InitializeCustomToolset if [[ ! -z "$projects" ]]; then - properties="$properties /p:Projects=$projects" + properties+=("/p:Projects=$projects") fi local bl="" @@ -243,6 +248,7 @@ function Build { /p:Build=$build \ /p:DotNetBuild=$product_build \ /p:DotNetBuildSourceOnly=$source_build \ + /p:DotNetBuildFromVMR=$from_vmr \ /p:Rebuild=$rebuild \ /p:Test=$test \ /p:Pack=$pack \ @@ -251,7 +257,7 @@ function Build { /p:Sign=$sign \ /p:Publish=$publish \ /p:RestoreStaticGraphEnableBinaryLogger=$binary_log \ - $properties + ${properties[@]+"${properties[@]}"} ExitWithExitCode 0 } diff --git a/src/aspnetcore/eng/common/core-templates/post-build/post-build.yml b/src/aspnetcore/eng/common/core-templates/post-build/post-build.yml index 5757915edb3..a151fd811e3 100644 --- a/src/aspnetcore/eng/common/core-templates/post-build/post-build.yml +++ b/src/aspnetcore/eng/common/core-templates/post-build/post-build.yml @@ -193,9 +193,6 @@ stages: buildId: $(AzDOBuildId) artifactName: PackageArtifacts checkDownloadedFiles: true - itemPattern: | - ** - !**/Microsoft.SourceBuild.Intermediate.*.nupkg # This is necessary whenever we want to publish/restore to an AzDO private feed # Since sdk-task.ps1 tries to restore packages we need to do this authentication here diff --git a/src/aspnetcore/eng/common/core-templates/steps/install-microbuild.yml b/src/aspnetcore/eng/common/core-templates/steps/install-microbuild.yml index 2bcf974ee15..a3540ba00c7 100644 --- a/src/aspnetcore/eng/common/core-templates/steps/install-microbuild.yml +++ b/src/aspnetcore/eng/common/core-templates/steps/install-microbuild.yml @@ -48,38 +48,3 @@ steps: eq(variables['_SignType'], 'real') ) )) - - # Workaround for ESRP CLI on Linux - https://github.com/dotnet/source-build/issues/4964 - - ${{ if eq(parameters.enableMicrobuildForMacAndLinux, 'true') }}: - - task: UseDotNet@2 - displayName: Install .NET 9.0 SDK for ESRP CLI Workaround - inputs: - packageType: sdk - version: 9.0.x - installationPath: ${{ parameters.microBuildOutputFolder }}/.dotnet - workingDirectory: ${{ parameters.microBuildOutputFolder }} - condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux')) - - - task: PowerShell@2 - displayName: Workaround for ESRP CLI on Linux - inputs: - targetType: 'inline' - script: | - Write-Host "Copying Linux Path" - $MBSIGN_APPFOLDER = '$(MBSIGN_APPFOLDER)' - $MBSIGN_APPFOLDER = ($MBSIGN_APPFOLDER -replace '/build', '') - - $versionRegex = '\d+\.\d+\.\d+' - $package = Get-ChildItem -Path $MBSIGN_APPFOLDER -Directory | - Where-Object { $_.Name -match $versionRegex } - - if ($package.Count -ne 1) { - Write-Host "There should be exactly one matching subfolder, but found $($package.Count)." - exit 1 - } - - $MBSIGN_APPFOLDER = $package[0].FullName + '/build' - $MBSIGN_APPFOLDER | Write-Host - $SignConfigPath = $MBSIGN_APPFOLDER + '/signconfig.xml' - Copy-Item -Path "$(MBSIGN_APPFOLDER)/signconfig.xml" -Destination $SignConfigPath -Force - condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux')) diff --git a/src/aspnetcore/eng/common/tools.ps1 b/src/aspnetcore/eng/common/tools.ps1 index 5f40a3f8238..c9e39595b58 100644 --- a/src/aspnetcore/eng/common/tools.ps1 +++ b/src/aspnetcore/eng/common/tools.ps1 @@ -65,8 +65,8 @@ $ErrorActionPreference = 'Stop' # Base-64 encoded SAS token that has permission to storage container described by $runtimeSourceFeed [string]$runtimeSourceFeedKey = if (Test-Path variable:runtimeSourceFeedKey) { $runtimeSourceFeedKey } else { $null } -# True if the build is a product build -[bool]$productBuild = if (Test-Path variable:productBuild) { $productBuild } else { $false } +# True when the build is running within the VMR. +[bool]$fromVMR = if (Test-Path variable:fromVMR) { $fromVMR } else { $false } function Create-Directory ([string[]] $path) { New-Item -Path $path -Force -ItemType 'Directory' | Out-Null @@ -644,7 +644,6 @@ function GetNuGetPackageCachePath() { $env:NUGET_PACKAGES = Join-Path $env:UserProfile '.nuget\packages\' } else { $env:NUGET_PACKAGES = Join-Path $RepoRoot '.packages\' - $env:RESTORENOHTTPCACHE = $true } } @@ -850,8 +849,8 @@ function MSBuild-Core() { } # When running on Azure Pipelines, override the returned exit code to avoid double logging. - # Skip this when the build is a child of the VMR orchestrator build. - if ($ci -and $env:SYSTEM_TEAMPROJECT -ne $null -and !$productBuild) { + # Skip this when the build is a child of the VMR build. + if ($ci -and $env:SYSTEM_TEAMPROJECT -ne $null -and !$fromVMR) { Write-PipelineSetResult -Result "Failed" -Message "msbuild execution failed." # Exiting with an exit code causes the azure pipelines task to log yet another "noise" error # The above Write-PipelineSetResult will cause the task to be marked as failure without adding yet another error diff --git a/src/aspnetcore/eng/common/tools.sh b/src/aspnetcore/eng/common/tools.sh index 25f5932eee9..28944dfcb3f 100755 --- a/src/aspnetcore/eng/common/tools.sh +++ b/src/aspnetcore/eng/common/tools.sh @@ -72,8 +72,8 @@ fi runtime_source_feed=${runtime_source_feed:-''} runtime_source_feed_key=${runtime_source_feed_key:-''} -# True if the build is a product build -product_build=${product_build:-false} +# True when the build is running within the VMR. +from_vmr=${from_vmr:-false} # Resolve any symlinks in the given path. function ResolvePath { @@ -345,14 +345,12 @@ function InitializeBuildTool { _InitializeBuildToolCommand="msbuild" } -# Set RestoreNoHttpCache as a workaround for https://github.com/NuGet/Home/issues/3116 function GetNuGetPackageCachePath { if [[ -z ${NUGET_PACKAGES:-} ]]; then if [[ "$use_global_nuget_cache" == true ]]; then export NUGET_PACKAGES="$HOME/.nuget/packages/" else export NUGET_PACKAGES="$repo_root/.packages/" - export RESTORENOHTTPCACHE=true fi fi @@ -506,8 +504,8 @@ function MSBuild-Core { echo "Build failed with exit code $exit_code. Check errors above." # When running on Azure Pipelines, override the returned exit code to avoid double logging. - # Skip this when the build is a child of the VMR orchestrator build. - if [[ "$ci" == true && -n ${SYSTEM_TEAMPROJECT:-} && "$product_build" != true ]]; then + # Skip this when the build is a child of the VMR build. + if [[ "$ci" == true && -n ${SYSTEM_TEAMPROJECT:-} && "$from_vmr" != true ]]; then Write-PipelineSetResult -result "Failed" -message "msbuild execution failed." # Exiting with an exit code causes the azure pipelines task to log yet another "noise" error # The above Write-PipelineSetResult will cause the task to be marked as failure without adding yet another error diff --git a/src/aspnetcore/global.json b/src/aspnetcore/global.json index cc3c7376c7a..315dcb58e2c 100644 --- a/src/aspnetcore/global.json +++ b/src/aspnetcore/global.json @@ -1,9 +1,9 @@ { "sdk": { - "version": "10.0.100-preview.4.25216.37" + "version": "10.0.100-preview.6.25272.112" }, "tools": { - "dotnet": "10.0.100-preview.4.25216.37", + "dotnet": "10.0.100-preview.6.25272.112", "runtimes": { "dotnet/x86": [ "$(MicrosoftInternalRuntimeAspNetCoreTransportVersion)" @@ -27,9 +27,9 @@ "jdk": "latest" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25270.108", - "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.25270.108", - "Microsoft.DotNet.SharedFramework.Sdk": "10.0.0-beta.25270.108", + "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25277.102", + "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.25277.102", + "Microsoft.DotNet.SharedFramework.Sdk": "10.0.0-beta.25277.102", "Microsoft.Build.NoTargets": "3.7.0", "Microsoft.Build.Traversal": "3.4.0" } diff --git a/src/aspnetcore/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.Composite.sfxproj b/src/aspnetcore/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.Composite.sfxproj index 94c4ae0f988..4765688fceb 100644 --- a/src/aspnetcore/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.Composite.sfxproj +++ b/src/aspnetcore/src/Framework/App.Runtime/src/Microsoft.AspNetCore.App.Runtime.Composite.sfxproj @@ -82,9 +82,10 @@ + - + - $(PackageVersion)-$(_PreReleaseLabel)$(_BuildNumberLabels) + $(PackageVersion) + $(PackageVersion)-$(_PreReleaseLabel)$(_BuildNumberLabels) @@ -122,7 +123,7 @@ - $([MSBuild]::NormalizeDirectory('$(CrossArchitectureInstallerBasePath)', 'aspnetcore', 'Runtime', '$(SharedFxMsiVersion)')) + $([MSBuild]::NormalizeDirectory('$(CrossArchitectureInstallerBasePath)', 'aspnetcore', 'Runtime', '$(NonStableVersion)')) diff --git a/src/emsdk/eng/Version.Details.xml b/src/emsdk/eng/Version.Details.xml index ea88cb0636e..f146624e3d8 100644 --- a/src/emsdk/eng/Version.Details.xml +++ b/src/emsdk/eng/Version.Details.xml @@ -1,38 +1,38 @@ - + - + https://github.com/dotnet/binaryen - d484b476589d25a24896414885060782f2a928c3 + d9d4f7258ec826cd523285fb54e2cfed4630b84a - + https://github.com/dotnet/binaryen - d484b476589d25a24896414885060782f2a928c3 + d9d4f7258ec826cd523285fb54e2cfed4630b84a - + https://github.com/dotnet/binaryen - d484b476589d25a24896414885060782f2a928c3 + d9d4f7258ec826cd523285fb54e2cfed4630b84a - + https://github.com/dotnet/binaryen - d484b476589d25a24896414885060782f2a928c3 + d9d4f7258ec826cd523285fb54e2cfed4630b84a - + https://github.com/dotnet/binaryen - d484b476589d25a24896414885060782f2a928c3 + d9d4f7258ec826cd523285fb54e2cfed4630b84a - + https://github.com/dotnet/binaryen - d484b476589d25a24896414885060782f2a928c3 + d9d4f7258ec826cd523285fb54e2cfed4630b84a - + https://github.com/dotnet/binaryen - d484b476589d25a24896414885060782f2a928c3 + d9d4f7258ec826cd523285fb54e2cfed4630b84a - + https://github.com/dotnet/binaryen - d484b476589d25a24896414885060782f2a928c3 + d9d4f7258ec826cd523285fb54e2cfed4630b84a https://github.com/dotnet/cpython @@ -50,37 +50,37 @@ https://github.com/dotnet/cpython e764026d1370aca7147a0eb205c4cbe9d9da17ca - + https://github.com/dotnet/node - de3034f1db35fba928e31233221ae3d4adee6705 + 2bbb9a8840d4dea41a848cde520c4e16ca6f9ad5 - + https://github.com/dotnet/node - de3034f1db35fba928e31233221ae3d4adee6705 + 2bbb9a8840d4dea41a848cde520c4e16ca6f9ad5 - + https://github.com/dotnet/node - de3034f1db35fba928e31233221ae3d4adee6705 + 2bbb9a8840d4dea41a848cde520c4e16ca6f9ad5 - + https://github.com/dotnet/node - de3034f1db35fba928e31233221ae3d4adee6705 + 2bbb9a8840d4dea41a848cde520c4e16ca6f9ad5 - + https://github.com/dotnet/node - de3034f1db35fba928e31233221ae3d4adee6705 + 2bbb9a8840d4dea41a848cde520c4e16ca6f9ad5 - + https://github.com/dotnet/node - de3034f1db35fba928e31233221ae3d4adee6705 + 2bbb9a8840d4dea41a848cde520c4e16ca6f9ad5 - + https://github.com/dotnet/node - de3034f1db35fba928e31233221ae3d4adee6705 + 2bbb9a8840d4dea41a848cde520c4e16ca6f9ad5 - + https://github.com/dotnet/node - de3034f1db35fba928e31233221ae3d4adee6705 + 2bbb9a8840d4dea41a848cde520c4e16ca6f9ad5 https://github.com/dotnet/llvm-project @@ -236,33 +236,33 @@ https://github.com/dotnet/llvm-project 43649018a9ca75bafcb7e9614082a4f2e4ff7ce6 - + https://github.com/dotnet/dotnet - f5705c8f4c5079bba77bae8698ba1583bde0388c + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - f5705c8f4c5079bba77bae8698ba1583bde0388c + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - f5705c8f4c5079bba77bae8698ba1583bde0388c + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - f5705c8f4c5079bba77bae8698ba1583bde0388c + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - f5705c8f4c5079bba77bae8698ba1583bde0388c + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - f5705c8f4c5079bba77bae8698ba1583bde0388c + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d - + https://github.com/dotnet/dotnet - f5705c8f4c5079bba77bae8698ba1583bde0388c + 57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d diff --git a/src/emsdk/eng/Versions.props b/src/emsdk/eng/Versions.props index 98faae1a0c4..370fcf42691 100644 --- a/src/emsdk/eng/Versions.props +++ b/src/emsdk/eng/Versions.props @@ -18,28 +18,28 @@ 7.0.20 6.0.36 - 10.0.0-alpha.1.25269.1 - 10.0.0-alpha.1.25269.1 - 10.0.0-alpha.1.25269.1 - 10.0.0-alpha.1.25269.1 - 10.0.0-alpha.1.25269.1 - 10.0.0-alpha.1.25269.1 - 10.0.0-alpha.1.25269.1 - 10.0.0-alpha.1.25269.1 + 10.0.0-alpha.1.25275.1 + 10.0.0-alpha.1.25275.1 + 10.0.0-alpha.1.25275.1 + 10.0.0-alpha.1.25275.1 + 10.0.0-alpha.1.25275.1 + 10.0.0-alpha.1.25275.1 + 10.0.0-alpha.1.25275.1 + 10.0.0-alpha.1.25275.1 10.0.0-alpha.1.25275.1 10.0.0-alpha.1.25275.1 10.0.0-alpha.1.25275.1 10.0.0-alpha.1.25275.1 - 10.0.0-alpha.1.25269.2 - 10.0.0-alpha.1.25269.2 - 10.0.0-alpha.1.25269.2 - 10.0.0-alpha.1.25269.2 - 10.0.0-alpha.1.25269.2 - 10.0.0-alpha.1.25269.2 - 10.0.0-alpha.1.25269.2 - 10.0.0-alpha.1.25269.2 + 10.0.0-alpha.1.25276.2 + 10.0.0-alpha.1.25276.2 + 10.0.0-alpha.1.25276.2 + 10.0.0-alpha.1.25276.2 + 10.0.0-alpha.1.25276.2 + 10.0.0-alpha.1.25276.2 + 10.0.0-alpha.1.25276.2 + 10.0.0-alpha.1.25276.2 19.1.0-alpha.1.25269.1 19.1.0-alpha.1.25269.1 @@ -57,11 +57,11 @@ release - 10.0.0-beta.25276.103 - 10.0.0-beta.25276.103 - 10.0.0-beta.25276.103 - 10.0.0-beta.25276.103 - 10.0.0-beta.25276.103 + 10.0.0-beta.25277.102 + 10.0.0-beta.25277.102 + 10.0.0-beta.25277.102 + 10.0.0-beta.25277.102 + 10.0.0-beta.25277.102 1.1.87-gba258badda diff --git a/src/emsdk/eng/common/build.sh b/src/emsdk/eng/common/build.sh index b105db583c4..9767bb411a4 100755 --- a/src/emsdk/eng/common/build.sh +++ b/src/emsdk/eng/common/build.sh @@ -257,7 +257,7 @@ function Build { /p:Sign=$sign \ /p:Publish=$publish \ /p:RestoreStaticGraphEnableBinaryLogger=$binary_log \ - "${properties[@]}" + ${properties[@]+"${properties[@]}"} ExitWithExitCode 0 } diff --git a/src/emsdk/eng/common/tools.ps1 b/src/emsdk/eng/common/tools.ps1 index 046ec9d08a0..c9e39595b58 100644 --- a/src/emsdk/eng/common/tools.ps1 +++ b/src/emsdk/eng/common/tools.ps1 @@ -644,7 +644,6 @@ function GetNuGetPackageCachePath() { $env:NUGET_PACKAGES = Join-Path $env:UserProfile '.nuget\packages\' } else { $env:NUGET_PACKAGES = Join-Path $RepoRoot '.packages\' - $env:RESTORENOHTTPCACHE = $true } } diff --git a/src/emsdk/eng/common/tools.sh b/src/emsdk/eng/common/tools.sh index 8bc68e8460f..28944dfcb3f 100755 --- a/src/emsdk/eng/common/tools.sh +++ b/src/emsdk/eng/common/tools.sh @@ -345,14 +345,12 @@ function InitializeBuildTool { _InitializeBuildToolCommand="msbuild" } -# Set RestoreNoHttpCache as a workaround for https://github.com/NuGet/Home/issues/3116 function GetNuGetPackageCachePath { if [[ -z ${NUGET_PACKAGES:-} ]]; then if [[ "$use_global_nuget_cache" == true ]]; then export NUGET_PACKAGES="$HOME/.nuget/packages/" else export NUGET_PACKAGES="$repo_root/.packages/" - export RESTORENOHTTPCACHE=true fi fi diff --git a/src/emsdk/global.json b/src/emsdk/global.json index 2eb19d4d25c..7f924a22ecf 100644 --- a/src/emsdk/global.json +++ b/src/emsdk/global.json @@ -3,8 +3,8 @@ "dotnet": "10.0.100-preview.6.25272.112" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25276.103", - "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.25276.103", + "Microsoft.DotNet.Arcade.Sdk": "10.0.0-beta.25277.102", + "Microsoft.DotNet.Helix.Sdk": "10.0.0-beta.25277.102", "Microsoft.Build.Traversal": "3.4.0" } } diff --git a/src/fsharp/eng/DotNetBuild.props b/src/fsharp/eng/DotNetBuild.props index 4c243eff3e8..b78d9712948 100644 --- a/src/fsharp/eng/DotNetBuild.props +++ b/src/fsharp/eng/DotNetBuild.props @@ -28,7 +28,7 @@ -bl enables the binlogs for the tools and Proto builds, which make debugging failures here easier --> diff --git a/src/fsharp/eng/Version.Details.xml b/src/fsharp/eng/Version.Details.xml index 612b8e5a32f..f68624a4cd6 100644 --- a/src/fsharp/eng/Version.Details.xml +++ b/src/fsharp/eng/Version.Details.xml @@ -1,6 +1,6 @@ - + https://github.com/dotnet/source-build-reference-packages diff --git a/src/msbuild/src/MSBuild/Resources/xlf/Strings.cs.xlf b/src/msbuild/src/MSBuild/Resources/xlf/Strings.cs.xlf index c6014c6874a..46f4539dd56 100644 --- a/src/msbuild/src/MSBuild/Resources/xlf/Strings.cs.xlf +++ b/src/msbuild/src/MSBuild/Resources/xlf/Strings.cs.xlf @@ -2046,42 +2046,50 @@ Když se nastaví na MessageUponIsolationViolation (nebo jeho krátký -bl:..\..\custom.binlog -binaryLogger - -binaryLogger[:[LogFile=]output.binlog[;ProjectImports={None,Embed,ZipFile}]] - Serializuje všechny události sestavení do komprimovaného binárního souboru. - Tento soubor se standardně nachází v aktuálním adresáři a má název msbuild.binlog. - Binární protokol je podrobný popis procesu sestavení, který se - dá později použít k rekonstrukci textových protokolů - a který můžou používat jiné nástroje pro analýzu. - Binární protokol má obvykle 10–20krát menší velikost než - nejpodrobnější textový protokol na úrovni diagnostiky, ale obsahuje více informací. - (Krátký tvar: -bl) + -binaryLogger[:[LogFile=]output.binlog[;ProjectImports={None,Embed,ZipFile}]] + Serializes all build events to a compressed binary file. + By default the file is in the current directory and named + "msbuild.binlog". The binary log is a detailed description + of the build process that can later be used to reconstruct + text logs and used by other analysis tools. A binary log + is usually 10-20x smaller than the most detailed text + diagnostic-level log, but it contains more information. + (Short form: -bl) - Binární protokolovací nástroj standardně shromažďuje - zdrojový text projektových souborů včetně všech - importovaných projektů a cílových souborů zjištěných - při sestavování. Toto chování řídí volitelný parametr ProjectImports: + The optional LogFile specifies the path where the + binary log is saved. To generate a distinct log file + for each build, the token "{}" can be added into the + path, for example: LogFile=output-{}-log.binlog. Each + "{}" in the log path is replaced with a unique string + using the timestamp, running process Id and random + string stamp. + + The binary logger by default collects the source text of + project files, including all imported projects and target + files encountered during the build. The optional + ProjectImports switch controls this behavior: - ProjectImports=None - Neshromažďovat importované - projekty. - ProjectImports=Embed - Vložit importované projekty - do souboru protokolu. - ProjectImports=ZipFile - Uložit projektové soubory - do output.projectimports.zip, - kde output je stejný název - jako název souboru binárního protokolu. + ProjectImports=None - Don't collect the project + imports. + ProjectImports=Embed - Embed project imports in the + log file. + ProjectImports=ZipFile - Save project files to + output.projectimports.zip + where output is the same name + as the binary log file name. - Výchozí nastavení pro ProjectImports je Embed. - Poznámka: Protokolovací nástroj neshromažďuje zdrojové - soubory nepatřící pod MSBuild, jako .cs, .cpp atd. + The default setting for ProjectImports is Embed. + Note: the logger does not collect non-MSBuild source files + such as .cs, .cpp etc. - Soubor .binlog se dá znovu přehrát“ tak, že se předá - souboru msbuild.exe jako argument místo projektu/řešení. - Jiné protokolovací nástroje obdrží informace obsažené - v souboru protokolu, jako by šlo o původní sestavení. - Více o binárním protokolu a jeho použití si můžete přečíst na stránce: + A .binlog file can be "played back" by passing it to + msbuild.exe as an argument instead of a project/solution. + Other loggers will receive the information contained + in the log file as if the original build was happening. + You can read more about the binary log and its usages at: https://aka.ms/msbuild/binlog - Příklady: + Examples: -bl -bl:output.binlog -bl:output.binlog;ProjectImports=None diff --git a/src/msbuild/src/MSBuild/Resources/xlf/Strings.de.xlf b/src/msbuild/src/MSBuild/Resources/xlf/Strings.de.xlf index d925361988c..87503286149 100644 --- a/src/msbuild/src/MSBuild/Resources/xlf/Strings.de.xlf +++ b/src/msbuild/src/MSBuild/Resources/xlf/Strings.de.xlf @@ -2034,42 +2034,50 @@ Dieses Protokollierungsformat ist standardmäßig aktiviert. -bl:..\..\custom.binlog -binaryLogger - -binaryLogger[:[LogFile=]output.binlog[;ProjectImports={None,Embed,ZipFile}]] - Serialisiert alle Buildereignisse in eine komprimierte Binärdatei. - Standardmäßig befindet sich die Datei im aktuellen Verzeichnis und hat den Namen - „msbuild.binlog“. Das binäre Protokoll ist eine detaillierte Beschreibung - des Buildprozesses, der später zum Rekonstruieren von - Textprotokollen dient und der von anderen Analysetools verwendet wird. Detaillierte - Textprotokolle auf Diagnoseebene sind in der Regel 10–20-mal so groß wie - binäre Protokolle, letztere enthalten jedoch mehr Informationen. - (Kurzform: -bl) + -binaryLogger[:[LogFile=]output.binlog[;ProjectImports={None,Embed,ZipFile}]] + Serializes all build events to a compressed binary file. + By default the file is in the current directory and named + "msbuild.binlog". The binary log is a detailed description + of the build process that can later be used to reconstruct + text logs and used by other analysis tools. A binary log + is usually 10-20x smaller than the most detailed text + diagnostic-level log, but it contains more information. + (Short form: -bl) - Die binäre Protokollierung erfasst standardmäßig den Quelltext von - Projektdateien, einschließlich aller beim Buildvorgang aufgetretenen importierten - Projekte und Zieldateien. Der optionale Schalter - ProjectImports steuert dieses Verhalten: + The optional LogFile specifies the path where the + binary log is saved. To generate a distinct log file + for each build, the token "{}" can be added into the + path, for example: LogFile=output-{}-log.binlog. Each + "{}" in the log path is replaced with a unique string + using the timestamp, running process Id and random + string stamp. - ProjectImports=None: – Projektimporte nicht - erfassen - ProjectImports=Embed: – Projektimporte in die - Protokolldatei einbetten - ProjectImports=ZipFile: – Projektdateien in + The binary logger by default collects the source text of + project files, including all imported projects and target + files encountered during the build. The optional + ProjectImports switch controls this behavior: + + ProjectImports=None - Don't collect the project + imports. + ProjectImports=Embed - Embed project imports in the + log file. + ProjectImports=ZipFile - Save project files to output.projectimports.zip - speichern, wobei „output“ dem Namen - der binären Protokolldatei entspricht. + where output is the same name + as the binary log file name. - Die Standardeinstellung für „ProjectImports“ ist „Embed“. - Hinweis: Die Protokollierung erfasst nur MSBuild-Quelldateien. - Andere Dateien wie etwa CS, CPP usw. werden nicht erfasst. + The default setting for ProjectImports is Embed. + Note: the logger does not collect non-MSBuild source files + such as .cs, .cpp etc. - Eine BINLOG-Datei kann „wiedergegeben“ werden, indem sie an - „msbuild.exe“ als Argument und nicht als Projekt/Lösung übergeben wird. - Andere Protokollierungen erhalten die Informationen, die - wie beim ursprünglichen Buildvorgang in der Protokolldatei enthalten sind. - Weitere Informationen zu binären Protokollen und ihrer Verwendung erhalten Sie unter: + A .binlog file can be "played back" by passing it to + msbuild.exe as an argument instead of a project/solution. + Other loggers will receive the information contained + in the log file as if the original build was happening. + You can read more about the binary log and its usages at: https://aka.ms/msbuild/binlog - Beispiele: + Examples: -bl -bl:output.binlog -bl:output.binlog;ProjectImports=None diff --git a/src/msbuild/src/MSBuild/Resources/xlf/Strings.es.xlf b/src/msbuild/src/MSBuild/Resources/xlf/Strings.es.xlf index a2d5f06ed08..c2804fb60c9 100644 --- a/src/msbuild/src/MSBuild/Resources/xlf/Strings.es.xlf +++ b/src/msbuild/src/MSBuild/Resources/xlf/Strings.es.xlf @@ -2040,49 +2040,57 @@ Esta marca es experimental y puede que no funcione según lo previsto. -bl:..\..\custom.binlog -binaryLogger - -binaryLogger[:[LogFile=]output.binlog[;ProjectImports={None,Embed,ZipFile}]] - Serializa todos los eventos de compilación en un archivo binario comprimido. - De manera predeterminada, el archivo se encuentra en el directorio actual y tiene - el nombre "msbuild.binlog". El registro binario es una - descripción detallada del proceso de compilación que - se puede utilizar más adelante para reconstruir registros - de texto y que otras herramientas de análisis pueden emplear. Un registro binario suele ser de 10 a 20 veces - más pequeño que el registro de nivel de diagnóstico de texto más detallado, pero contiene más información - (Forma corta: -bl). + -binaryLogger[:[LogFile=]output.binlog[;ProjectImports={None,Embed,ZipFile}]] + Serializes all build events to a compressed binary file. + By default the file is in the current directory and named + "msbuild.binlog". The binary log is a detailed description + of the build process that can later be used to reconstruct + text logs and used by other analysis tools. A binary log + is usually 10-20x smaller than the most detailed text + diagnostic-level log, but it contains more information. + (Short form: -bl) - De manera predeterminada, el registrador binario recopila - el texto de origen de los archivos del proyecto, incluidos - todos los proyectos y archivos de destino importados que se encuentren durante la compilación. El modificador - opcional ProjectImports controla este comportamiento: + The optional LogFile specifies the path where the + binary log is saved. To generate a distinct log file + for each build, the token "{}" can be added into the + path, for example: LogFile=output-{}-log.binlog. Each + "{}" in the log path is replaced with a unique string + using the timestamp, running process Id and random + string stamp. + + The binary logger by default collects the source text of + project files, including all imported projects and target + files encountered during the build. The optional + ProjectImports switch controls this behavior: - ProjectImports=None - No recopilar importaciones - de proyecto. - ProjectImports=Embed - Insertar importaciones de - proyecto en el archivo de registro. - ProjectImports=ZipFile - Guardar los archivos del - proyecto en salida.projectimports.zip, - donde "salida" es el mismo nombre que - el del archivo de registro binario. + ProjectImports=None - Don't collect the project + imports. + ProjectImports=Embed - Embed project imports in the + log file. + ProjectImports=ZipFile - Save project files to + output.projectimports.zip + where output is the same name + as the binary log file name. - La configuración predeterminada de ProjectImports es Embed. - Nota: El registrador no recopila archivos de código fuente - que no sean de MSBuild, como .cs, .cpp, etc. + The default setting for ProjectImports is Embed. + Note: the logger does not collect non-MSBuild source files + such as .cs, .cpp etc. - Un archivo .binlog se puede "reproducir" pasándolo a - msbuild.exe como argumento en lugar de proyecto o solución. - Otros registradores recibirán la información - que contiene el archivo de registro como si se estuviera - ejecutando la compilación original. Encontrará más información sobre el registro binario y su uso en: + A .binlog file can be "played back" by passing it to + msbuild.exe as an argument instead of a project/solution. + Other loggers will receive the information contained + in the log file as if the original build was happening. + You can read more about the binary log and its usages at: https://aka.ms/msbuild/binlog - Ejemplos: + Examples: -bl -bl:output.binlog -bl:output.binlog;ProjectImports=None - -bl:output.binlog;ProjectImports=ZipFile + -bl:output.binlog;ProjectImports=ZipFile -bl:..\..\custom.binlog - -binaryLogger - + -binaryLogger + LOCALIZATION: The following should not be localized: 1) "msbuild" diff --git a/src/msbuild/src/MSBuild/Resources/xlf/Strings.fr.xlf b/src/msbuild/src/MSBuild/Resources/xlf/Strings.fr.xlf index 859d96f7713..2035fa38c81 100644 --- a/src/msbuild/src/MSBuild/Resources/xlf/Strings.fr.xlf +++ b/src/msbuild/src/MSBuild/Resources/xlf/Strings.fr.xlf @@ -2035,66 +2035,57 @@ Remarque : verbosité des enregistreurs d’événements de fichiers -bl:..\..\custom.binlog -binaryLogger - -binaryLogger[:[LogFile=]output.binlog[;ProjectImports={None,Embed,ZipFile}]] - Sérialise tous les événements de build dans un fichier binaire compressé. - Par défaut, le fichier se trouve dans le répertoire actif et se nomme - "msbuild.binlog". Le journal binaire est une description détaillée - du processus de génération, qui peut servir plus tard à reconstruire - les journaux texte et être utilisé par d'autres outils d'analyse. Un journal binaire - est généralement -10 à 20 -fois plus petit que le journal - de diagnostic de type texte le plus détaillé, mais il contient plus d'informations. - (Forme abrégée -: -bl) - - - Le journaliseur binaire par défaut collecte le texte source - - des fichiers projet, notamment tous les projets importés et les + -binaryLogger[:[LogFile=]output.binlog[;ProjectImports={None,Embed,ZipFile}]] + Serializes all build events to a compressed binary file. + By default the file is in the current directory and named + "msbuild.binlog". The binary log is a detailed description + of the build process that can later be used to reconstruct + text logs and used by other analysis tools. A binary log + is usually 10-20x smaller than the most detailed text + diagnostic-level log, but it contains more information. + (Short form: -bl) - fichiers cibles rencontrés pendant la build. Le commutateur + The optional LogFile specifies the path where the + binary log is saved. To generate a distinct log file + for each build, the token "{}" can be added into the + path, for example: LogFile=output-{}-log.binlog. Each + "{}" in the log path is replaced with a unique string + using the timestamp, running process Id and random + string stamp. - ProjectImports facultatif contrôle ce comportement -: + The binary logger by default collects the source text of + project files, including all imported projects and target + files encountered during the build. The optional + ProjectImports switch controls this behavior: - ProjectImports=None - Ne collecte pas les importations - du projet. - ProjectImports=Embed - Incorpore les importations du projet dans - le fichier journal. - ProjectImports=ZipFile - Enregistre les fichiers projet dans + ProjectImports=None - Don't collect the project + imports. + ProjectImports=Embed - Embed project imports in the + log file. + ProjectImports=ZipFile - Save project files to output.projectimports.zip - où la sortie porte le même nom que - le fichier journal binaire. - - Le paramètre par défaut de ProjectImports est Embed. - Remarque -: Le journaliseur ne collecte pas les - - fichiers sources non MSBuild tels que .cs, .cpp etc. - - - Vous pouvez "lire" un fichier .binlog en le passant à - - msbuild.exe en tant qu'argument plutôt qu'en tant que projet/solution. - - D'autres enregistreurs d'événements reçoivent les informations - - contenues dans le fichier journal comme si la build d'origine était en cours de création. + where output is the same name + as the binary log file name. - Pour plus d'informations sur le journal binaire et ses usages, consultez -: - https://aka.ms/msbuild/binlog + The default setting for ProjectImports is Embed. + Note: the logger does not collect non-MSBuild source files + such as .cs, .cpp etc. - Exemples -: + A .binlog file can be "played back" by passing it to + msbuild.exe as an argument instead of a project/solution. + Other loggers will receive the information contained + in the log file as if the original build was happening. + You can read more about the binary log and its usages at: + https://aka.ms/msbuild/binlog + Examples: -bl - -bl:output.binlog - -bl:output.binlog;ProjectImports=None - -bl:output.binlog;ProjectImports=ZipFile -bl:..\..\custom.binlog -binaryLogger + -bl:output.binlog;ProjectImports=ZipFile + -bl:..\..\custom.binlog + -binaryLogger + LOCALIZATION: The following should not be localized: 1) "msbuild" diff --git a/src/msbuild/src/MSBuild/Resources/xlf/Strings.it.xlf b/src/msbuild/src/MSBuild/Resources/xlf/Strings.it.xlf index f837954ebb9..7629d5db226 100644 --- a/src/msbuild/src/MSBuild/Resources/xlf/Strings.it.xlf +++ b/src/msbuild/src/MSBuild/Resources/xlf/Strings.it.xlf @@ -2047,42 +2047,50 @@ Nota: livello di dettaglio dei logger di file -bl:..\..\custom.binlog -binaryLogger - -binaryLogger[:[LogFile=]output.binlog[;ProjectImports={None,Embed,ZipFile}]] - Serializza tutti gli eventi di compilazione in un file binario compresso. - Per impostazione predefinita, il file csi trova nella directory corrente e si chiama - "msbuild.binlog". Il log binario è una descrizione - dettagliata del processo di compilazione utilizzabile in - seguito per ricostruire i log di testo e viene usato da altri strumenti di analisi. Un log binario è in genere - 10-20 volte più piccolo del più dettagliato log di testo - di livello diagnostico, ma contiene maggiori informazioni. - (Froma breve: -bl) + -binaryLogger[:[LogFile=]output.binlog[;ProjectImports={None,Embed,ZipFile}]] + Serializes all build events to a compressed binary file. + By default the file is in the current directory and named + "msbuild.binlog". The binary log is a detailed description + of the build process that can later be used to reconstruct + text logs and used by other analysis tools. A binary log + is usually 10-20x smaller than the most detailed text + diagnostic-level log, but it contains more information. + (Short form: -bl) - Per impostazione predefinita, il logger binario raccoglie il testo di origine di - file di progetto, inclusi tutti i - progetti importati e i file di destinazione rilevati durante la compilazione. L'opzione facoltativa - ProjectImports controlla questo comportamento: + The optional LogFile specifies the path where the + binary log is saved. To generate a distinct log file + for each build, the token "{}" can be added into the + path, for example: LogFile=output-{}-log.binlog. Each + "{}" in the log path is replaced with a unique string + using the timestamp, running process Id and random + string stamp. - ProjectImports=None - Non viene eseguita la raccolta - delle importazioni del progetto. - ProjectImports=Embed - Le importazioni del progetto vengono incorporate nel - file di log. - ProjectImports=ZipFile - I file del progetto vengono salvati in + The binary logger by default collects the source text of + project files, including all imported projects and target + files encountered during the build. The optional + ProjectImports switch controls this behavior: + + ProjectImports=None - Don't collect the project + imports. + ProjectImports=Embed - Embed project imports in the + log file. + ProjectImports=ZipFile - Save project files to output.projectimports.zip - dove output corrisponde allo - as stesso nome del file di log binario. + where output is the same name + as the binary log file name. - L'impostazione predefinita di ProjectImports è Embed. - Nota: il logger non raccoglie i file di origine non-MSBuild, - ad esempio quelli con estensione .cs, .cpp e così via. + The default setting for ProjectImports is Embed. + Note: the logger does not collect non-MSBuild source files + such as .cs, .cpp etc. - È possibile riprodurre un file con estensione binlog - passandolo a msbuild.exe come argomento invece di un progetto o di una soluzione. - Altri logger riceveranno le - informazioni contenute nel file di log come se fosse in corso la compilazione originale. - Per maggiori informazioni sul file di log e su come usarlo, vedere: + A .binlog file can be "played back" by passing it to + msbuild.exe as an argument instead of a project/solution. + Other loggers will receive the information contained + in the log file as if the original build was happening. + You can read more about the binary log and its usages at: https://aka.ms/msbuild/binlog - Esempi: + Examples: -bl -bl:output.binlog -bl:output.binlog;ProjectImports=None diff --git a/src/msbuild/src/MSBuild/Resources/xlf/Strings.ja.xlf b/src/msbuild/src/MSBuild/Resources/xlf/Strings.ja.xlf index 4e2c4166a30..f68b82c28e9 100644 --- a/src/msbuild/src/MSBuild/Resources/xlf/Strings.ja.xlf +++ b/src/msbuild/src/MSBuild/Resources/xlf/Strings.ja.xlf @@ -2034,42 +2034,50 @@ -bl:..\..\custom.binlog -binaryLogger - -binaryLogger[:[LogFile=]output.binlog[;ProjectImports={None,Embed,ZipFile}]] - すべてのビルド イベントを圧縮バイナリ ファイルにシリアル化します。 - 既定では、このファイルは "msbuild.binlog" という名前で - 現在のディレクトリに置かれます。バイナリ ログはビルド プロセスの - 詳細な説明であり、後でテキスト ログを再構築するために使用でき、 - 他の分析ツールでも使用できます。バイナリ ログは通常、 - ほとんどの詳細なテキスト診断レベル ログと比べて 10 分の 1 から - 20 分の 1 の大きさですが、より多くの情報を含んでいます。 - (短い形式: -bl) + -binaryLogger[:[LogFile=]output.binlog[;ProjectImports={None,Embed,ZipFile}]] + Serializes all build events to a compressed binary file. + By default the file is in the current directory and named + "msbuild.binlog". The binary log is a detailed description + of the build process that can later be used to reconstruct + text logs and used by other analysis tools. A binary log + is usually 10-20x smaller than the most detailed text + diagnostic-level log, but it contains more information. + (Short form: -bl) - 既定では、バイナリ ロガーはプロジェクト ファイルのソース テキストを - 収集します。それには、ビルド中に検出された、すべてのインポート済み - プロジェクトとターゲット ファイルが含まれます。オプションの - ProjectImports スイッチは次のように動作を制御します。 + The optional LogFile specifies the path where the + binary log is saved. To generate a distinct log file + for each build, the token "{}" can be added into the + path, for example: LogFile=output-{}-log.binlog. Each + "{}" in the log path is replaced with a unique string + using the timestamp, running process Id and random + string stamp. - ProjectImports=None - プロジェクト インポートを収集しません。 + The binary logger by default collects the source text of + project files, including all imported projects and target + files encountered during the build. The optional + ProjectImports switch controls this behavior: - ProjectImports=Embed - プロジェクト インポートをログ ファイルに - 組み込みます。 - ProjectImports=ZipFile - プロジェクト ファイルを - output.projectimports.zip に保存します。 - ここで、output はバイナリ ログ - ファイル名と同じ名前です。 + ProjectImports=None - Don't collect the project + imports. + ProjectImports=Embed - Embed project imports in the + log file. + ProjectImports=ZipFile - Save project files to + output.projectimports.zip + where output is the same name + as the binary log file name. - ProjectImports の既定の設定は Embed です。 - メモ: ロガーは、MSBuild 以外のソース ファイルを収集しません - (.cs、.cpp など)。 + The default setting for ProjectImports is Embed. + Note: the logger does not collect non-MSBuild source files + such as .cs, .cpp etc. - プロジェクト/ソリューションの代わりに、引数として .binlog ファイルを - msbuild.exe に渡すと、そのファイルを "再生" することができます。 - 他のロガーは、オリジナルのビルドが行われたときのように、 - ログ ファイルに含まれる情報を受け取ることができます。 - バイナリ ログとその使用法の詳細については、以下をお読みください。 + A .binlog file can be "played back" by passing it to + msbuild.exe as an argument instead of a project/solution. + Other loggers will receive the information contained + in the log file as if the original build was happening. + You can read more about the binary log and its usages at: https://aka.ms/msbuild/binlog - 例: + Examples: -bl -bl:output.binlog -bl:output.binlog;ProjectImports=None diff --git a/src/msbuild/src/MSBuild/Resources/xlf/Strings.ko.xlf b/src/msbuild/src/MSBuild/Resources/xlf/Strings.ko.xlf index c027f3e3493..5765fff72a9 100644 --- a/src/msbuild/src/MSBuild/Resources/xlf/Strings.ko.xlf +++ b/src/msbuild/src/MSBuild/Resources/xlf/Strings.ko.xlf @@ -2034,42 +2034,50 @@ -bl:..\..\custom.binlog -binaryLogger - -binaryLogger[:[LogFile=]output.binlog[;ProjectImports={None,Embed,ZipFile}]] - 모든 빌드 이벤트를 압축된 이진 파일로 직렬화합니다. - 기본적으로 이 파일은 현재 디렉터리에 있으며 이름은 - "msbuild.binlog"입니다. 이진 로그는 빌드 프로세스를 - 자세히 설명하는 것으로, 나중에 텍스트 로그를 다시 - 구성하기 위해 사용할 수 있고 다른 분석 도구에 의해 - 사용될 수 있습니다. 이진 로그는 일반적으로 가장 - 상세한 텍스트 진단 수준 로그보다 10~20배 작지만, - 더 자세한 정보를 포함하고 있습니다. - (약식: -bl) + -binaryLogger[:[LogFile=]output.binlog[;ProjectImports={None,Embed,ZipFile}]] + Serializes all build events to a compressed binary file. + By default the file is in the current directory and named + "msbuild.binlog". The binary log is a detailed description + of the build process that can later be used to reconstruct + text logs and used by other analysis tools. A binary log + is usually 10-20x smaller than the most detailed text + diagnostic-level log, but it contains more information. + (Short form: -bl) - 이진 로거는 기본적으로 빌드 중에 가져온 모든 프로젝트와 - 발생한 대상 파일을 비롯한 프로젝트 파일의 소스 텍스트를 - 수집합니다. 선택적 ProjectImports 스위치는 이 동작을 제어합니다. + The optional LogFile specifies the path where the + binary log is saved. To generate a distinct log file + for each build, the token "{}" can be added into the + path, for example: LogFile=output-{}-log.binlog. Each + "{}" in the log path is replaced with a unique string + using the timestamp, running process Id and random + string stamp. + + The binary logger by default collects the source text of + project files, including all imported projects and target + files encountered during the build. The optional + ProjectImports switch controls this behavior: - ProjectImports=None - 프로젝트 가져오기를 수집하지 - 않습니다. - ProjectImports=Embed - 로그 파일에 프로젝트 가져오기를 - 포함합니다. - ProjectImports=ZipFile - 프로젝트 파일을 - output.projectimports.zip에 저장합니다. - 여기서 output은 이진 로그 파일 이름과 - 같은 이름입니다. + ProjectImports=None - Don't collect the project + imports. + ProjectImports=Embed - Embed project imports in the + log file. + ProjectImports=ZipFile - Save project files to + output.projectimports.zip + where output is the same name + as the binary log file name. - ProjectImports의 기본 설정은 Embed입니다. - 참고: 로거는 .cs, .cpp 등과 같은 MSBuild가 아닌 소스 파일은 - 수집하지 않습니다. + The default setting for ProjectImports is Embed. + Note: the logger does not collect non-MSBuild source files + such as .cs, .cpp etc. - .binlog 파일을 프로젝트/솔루션 대신 인수로 msbuild.exe에 - 전달하여 "재생"할 수 있습니다. 다른 로거는 원본 빌드가 - 발생하고 있는 것처럼 로그 파일에 포함된 정보를 받게 됩니다. - 이진 로그 및 해당 사용법에 대한 자세한 내용은 - 다음 위치에서 확인할 수 있습니다. + A .binlog file can be "played back" by passing it to + msbuild.exe as an argument instead of a project/solution. + Other loggers will receive the information contained + in the log file as if the original build was happening. + You can read more about the binary log and its usages at: https://aka.ms/msbuild/binlog - 예: + Examples: -bl -bl:output.binlog -bl:output.binlog;ProjectImports=None diff --git a/src/msbuild/src/MSBuild/Resources/xlf/Strings.pl.xlf b/src/msbuild/src/MSBuild/Resources/xlf/Strings.pl.xlf index 3314d604ce6..12c55ded106 100644 --- a/src/msbuild/src/MSBuild/Resources/xlf/Strings.pl.xlf +++ b/src/msbuild/src/MSBuild/Resources/xlf/Strings.pl.xlf @@ -2044,42 +2044,50 @@ Ta flaga jest eksperymentalna i może nie działać zgodnie z oczekiwaniami. -bl:..\..\custom.binlog -binaryLogger - -binaryLogger[:[LogFile=]wyjście.binlog[;ProjectImports={None,Embed,ZipFile}]] - Serializuje wszystkie zdarzenia kompilacji do skompresowanego pliku binarnego. - Domyślnie plik znajduje się w bieżącym katalogu i ma nazwę - „msbuild.binlog”. Dziennik binarny to szczegółowy opis procesu - kompilacji, którego można później użyć do odtworzenia -dzienników tekstowych i wykorzystać w innych narzędziach do analizy. Dziennik binarny - jest zwykle 10–20 razy mniejszy od najbardziej szczegółowych - tekstowych dzienników na poziomie diagnostycznym, ale zawiera więcej informacji. - (Krótka forma: -bl) + -binaryLogger[:[LogFile=]output.binlog[;ProjectImports={None,Embed,ZipFile}]] + Serializes all build events to a compressed binary file. + By default the file is in the current directory and named + "msbuild.binlog". The binary log is a detailed description + of the build process that can later be used to reconstruct + text logs and used by other analysis tools. A binary log + is usually 10-20x smaller than the most detailed text + diagnostic-level log, but it contains more information. + (Short form: -bl) - Rejestrator binarny domyślnie zbiera tekst źródłowy - plików projektu, w tym wszystkie zaimportowane projekty i pliki - docelowe napotkane podczas kompilowania. Tym zachowaniem - steruje opcjonalny przełącznik ProjectImports: + The optional LogFile specifies the path where the + binary log is saved. To generate a distinct log file + for each build, the token "{}" can be added into the + path, for example: LogFile=output-{}-log.binlog. Each + "{}" in the log path is replaced with a unique string + using the timestamp, running process Id and random + string stamp. + + The binary logger by default collects the source text of + project files, including all imported projects and target + files encountered during the build. The optional + ProjectImports switch controls this behavior: - ProjectImports=None — Nie zbieraj importów - projektu. - ProjectImports=Embed — Osadź importy projektu w - pliku dziennika. - ProjectImports=ZipFile — Zapisz pliki projektu w pliku - output.projectimports.zip, - gdzie wyjście to ciąg podany - dla nazwy pliku dziennika binarnego. + ProjectImports=None - Don't collect the project + imports. + ProjectImports=Embed - Embed project imports in the + log file. + ProjectImports=ZipFile - Save project files to + output.projectimports.zip + where output is the same name + as the binary log file name. - Domyślne ustawienie przełącznika ProjectImports to Embed. - Uwaga: rejestrator nie zbiera plików źródłowych - niepochodzących z programu MSBuild, np. cs, cpp itd. + The default setting for ProjectImports is Embed. + Note: the logger does not collect non-MSBuild source files + such as .cs, .cpp etc. - Plik binlog można „odtworzyć”, przekazując go do programu - msbuild.exe jako argument zamiast projektu/rozwiązania. - Inne rejestratory otrzymają informacje zawarte w pliku - dziennika tak, jak podczas wykonywania pierwotnej kompilacji. - Więcej informacji o dzienniku binarnym i jego zastosowaniach można uzyskać na stronie: + A .binlog file can be "played back" by passing it to + msbuild.exe as an argument instead of a project/solution. + Other loggers will receive the information contained + in the log file as if the original build was happening. + You can read more about the binary log and its usages at: https://aka.ms/msbuild/binlog - Przykłady: + Examples: -bl -bl:output.binlog -bl:output.binlog;ProjectImports=None diff --git a/src/msbuild/src/MSBuild/Resources/xlf/Strings.pt-BR.xlf b/src/msbuild/src/MSBuild/Resources/xlf/Strings.pt-BR.xlf index 445070bea1c..5e69b2ed4dd 100644 --- a/src/msbuild/src/MSBuild/Resources/xlf/Strings.pt-BR.xlf +++ b/src/msbuild/src/MSBuild/Resources/xlf/Strings.pt-BR.xlf @@ -2034,42 +2034,50 @@ arquivo de resposta. -bl:..\..\custom.binlog -binaryLogger - -binaryLogger[:[LogFile=]output.binlog[;ProjectImports={None,Embed,ZipFile}]] - Serializa todos os eventos da compilação em um arquivo binário compactado. - Por padrão, o arquivo está no diretório atual e é chamado de - "msbuild.binlog". O log binário é uma descrição detalhada - do processo de compilação que pode mais tarde ser usado para reconstruir - logs de texto e usados por outras ferramentas de análise. Um log binário - normalmente é 10 a 20x menor do que os log de nível - de diagnóstico do texto mais detalhado, mas contém mais informações. - (Forma abreviada: -bl) + -binaryLogger[:[LogFile=]output.binlog[;ProjectImports={None,Embed,ZipFile}]] + Serializes all build events to a compressed binary file. + By default the file is in the current directory and named + "msbuild.binlog". The binary log is a detailed description + of the build process that can later be used to reconstruct + text logs and used by other analysis tools. A binary log + is usually 10-20x smaller than the most detailed text + diagnostic-level log, but it contains more information. + (Short form: -bl) - O agente binário, por padrão, coleta o texto fonte dos - arquivos de projeto, incluindo todos os projetos importados e arquivos - de destino encontrados durante a compilação. A opção - ProjectImports opcional controla este comportamento: + The optional LogFile specifies the path where the + binary log is saved. To generate a distinct log file + for each build, the token "{}" can be added into the + path, for example: LogFile=output-{}-log.binlog. Each + "{}" in the log path is replaced with a unique string + using the timestamp, running process Id and random + string stamp. - ProjectImports=None - Não coletar as importações - do projeto. - ProjectImports=Embed - Inserir as importações do projeto no - arquivo de log. - ProjectImports=ZipFile - Salvar os arquivos de projeto em + The binary logger by default collects the source text of + project files, including all imported projects and target + files encountered during the build. The optional + ProjectImports switch controls this behavior: + + ProjectImports=None - Don't collect the project + imports. + ProjectImports=Embed - Embed project imports in the + log file. + ProjectImports=ZipFile - Save project files to output.projectimports.zip - em que a saída tem o mesmo nome que o - nome do arquivo de log binário. + where output is the same name + as the binary log file name. - A configuração padrão para ProjectImports é Embed. - Observação: o agente não coleta arquivos de origem não MSBuild - tais como .cs, .cpp etc. + The default setting for ProjectImports is Embed. + Note: the logger does not collect non-MSBuild source files + such as .cs, .cpp etc. - Um arquivo .binlog pode ser "reproduzido novamente", passando-o para - msbuild.exe como um argumento em vez de um projeto/solução. - Outros agentes receberão as informações contidas - no arquivo de log como se a compilação original estivesse acontecendo. - Você pode ler mais sobre o log binário e seus usos em: + A .binlog file can be "played back" by passing it to + msbuild.exe as an argument instead of a project/solution. + Other loggers will receive the information contained + in the log file as if the original build was happening. + You can read more about the binary log and its usages at: https://aka.ms/msbuild/binlog - Exemplos: + Examples: -bl -bl:output.binlog -bl:output.binlog;ProjectImports=None diff --git a/src/msbuild/src/MSBuild/Resources/xlf/Strings.ru.xlf b/src/msbuild/src/MSBuild/Resources/xlf/Strings.ru.xlf index 2efb0bca84e..13cd41c8bd0 100644 --- a/src/msbuild/src/MSBuild/Resources/xlf/Strings.ru.xlf +++ b/src/msbuild/src/MSBuild/Resources/xlf/Strings.ru.xlf @@ -2034,42 +2034,50 @@ -bl:..\..\custom.binlog -binaryLogger - -binaryLogger[:[LogFile=]output.binlog[;ProjectImports={None,Embed,ZipFile}]] - Сериализует все события сборки в сжатый двоичный файл. - По умолчанию файл находится в текущем каталоге и называется - "msbuild.binlog". Двоичный журнал включает подробное описание - процесса сборки, которое затем можно использовать для воссоздания - текстовых журналов. Он также может использоваться другими средствами анализа. Двоичный журнал - обычно в 10–20 раз меньше самого подробного текстового - журнала уровня диагностики, но содержит больше информации. - (Краткая форма: -bl) + -binaryLogger[:[LogFile=]output.binlog[;ProjectImports={None,Embed,ZipFile}]] + Serializes all build events to a compressed binary file. + By default the file is in the current directory and named + "msbuild.binlog". The binary log is a detailed description + of the build process that can later be used to reconstruct + text logs and used by other analysis tools. A binary log + is usually 10-20x smaller than the most detailed text + diagnostic-level log, but it contains more information. + (Short form: -bl) - Средство ведения двоичного журнала по умолчанию собирает исходный текст - файлов проекта, включая все импортированные проекты и целевые - файлы, найденные во время сборки. Дополнительный - параметр ProjectImports управляет этим поведением: + The optional LogFile specifies the path where the + binary log is saved. To generate a distinct log file + for each build, the token "{}" can be added into the + path, for example: LogFile=output-{}-log.binlog. Each + "{}" in the log path is replaced with a unique string + using the timestamp, running process Id and random + string stamp. + + The binary logger by default collects the source text of + project files, including all imported projects and target + files encountered during the build. The optional + ProjectImports switch controls this behavior: - ProjectImports=None — не собирать импортированные файлы - проекта. - ProjectImports=Embed — внедрять импортированные файлы проекта в - файл журнала. - ProjectImports=ZipFile — сохранять файлы проекта в - вывод.projectimports.zip, - где вывод — это то же имя, - что и у двоичного файла журнала. + ProjectImports=None - Don't collect the project + imports. + ProjectImports=Embed - Embed project imports in the + log file. + ProjectImports=ZipFile - Save project files to + output.projectimports.zip + where output is the same name + as the binary log file name. - Значение по умолчанию для ProjectImports — Embed. - Примечание. Средство ведения журнала не собирает исходные файлы, не от MSBuild, - например с расширениями CS, CPP и др. + The default setting for ProjectImports is Embed. + Note: the logger does not collect non-MSBuild source files + such as .cs, .cpp etc. - BINLOG-файл можно "воспроизвести", передав его в - msbuild.exe в качестве аргумента вместо проекта или решения. - Другие средства ведения журнала получат содержащиеся - в файле журнала сведения, как если бы происходила собственно сборка. - Дополнительные сведения о двоичных журналах и их использовании: + A .binlog file can be "played back" by passing it to + msbuild.exe as an argument instead of a project/solution. + Other loggers will receive the information contained + in the log file as if the original build was happening. + You can read more about the binary log and its usages at: https://aka.ms/msbuild/binlog - Примеры: + Examples: -bl -bl:output.binlog -bl:output.binlog;ProjectImports=None diff --git a/src/msbuild/src/MSBuild/Resources/xlf/Strings.tr.xlf b/src/msbuild/src/MSBuild/Resources/xlf/Strings.tr.xlf index 45f67f474cc..a52796290f5 100644 --- a/src/msbuild/src/MSBuild/Resources/xlf/Strings.tr.xlf +++ b/src/msbuild/src/MSBuild/Resources/xlf/Strings.tr.xlf @@ -2037,42 +2037,50 @@ -bl:..\..\custom.binlog -binaryLogger - -binaryLogger[:[LogFile=]output.binlog[;ProjectImports={None,Embed,ZipFile}]] - Tüm derleme olaylarını sıkıştırılmış bir ikili dosyada seri hale getirir. - Varsayılan olarak, dosya geçerli dizinde bulunur ve "msbuild.binlog" - olarak adlandırılır. Daha sonra metin günlüklerini yeniden - yapılandırmak için kullanılabilen ve diğer analiz araçları tarafından - kullanılan ikili günlüğü, derleme işleminin ayrıntılı bir açıklamasıdır. - İkili günlüğü genellikle, en ayrıntılı metin tanılama düzeyi günlüklerden - 10-20 kat küçüktür ancak daha fazla bilgi içerir. - (Kısa biçim: -bl) + -binaryLogger[:[LogFile=]output.binlog[;ProjectImports={None,Embed,ZipFile}]] + Serializes all build events to a compressed binary file. + By default the file is in the current directory and named + "msbuild.binlog". The binary log is a detailed description + of the build process that can later be used to reconstruct + text logs and used by other analysis tools. A binary log + is usually 10-20x smaller than the most detailed text + diagnostic-level log, but it contains more information. + (Short form: -bl) - İkili günlükçü varsayılan olarak, derleme sırasında karşılaşılan - tüm içeri aktarılmış projeler ve hedef dosyalar dahil olmak üzere - proje dosyalarının kaynak dosyalarını toplar. İsteğe bağlı - ProjectImports anahtarı bu davranışı denetler: + The optional LogFile specifies the path where the + binary log is saved. To generate a distinct log file + for each build, the token "{}" can be added into the + path, for example: LogFile=output-{}-log.binlog. Each + "{}" in the log path is replaced with a unique string + using the timestamp, running process Id and random + string stamp. + + The binary logger by default collects the source text of + project files, including all imported projects and target + files encountered during the build. The optional + ProjectImports switch controls this behavior: - ProjectImports=None - Proje içeri aktarmalarını - toplama. - ProjectImports=Embed - Proje içeri aktarmalarını günlük dosyasına - ekler. - ProjectImports=ZipFile - Proje dosyalarını - çıkış.projectimports.zip - dosyasına kaydeder (burada çıkış, ikili - günlük dosyası adıyla aynı ada sahiptir). + ProjectImports=None - Don't collect the project + imports. + ProjectImports=Embed - Embed project imports in the + log file. + ProjectImports=ZipFile - Save project files to + output.projectimports.zip + where output is the same name + as the binary log file name. - ProjectImports için varsayılan ayar Embed’dir. - Not: Günlükçü .cs, .cpp vb. MSBuild olmayan kaynak - dosyaları toplamaz. + The default setting for ProjectImports is Embed. + Note: the logger does not collect non-MSBuild source files + such as .cs, .cpp etc. - Bir .binlog dosyası msbuild.exe’ye bir proje/çözüm - yerine bağımsız değişken olarak geçirilerek “yeniden oynatılabilir”. - Diğer günlükçüler, günlük dosyasındaki bilgileri özgün - derleme gerçekleşiyormuş gibi alır. - İkili günlük ve kullanımı hakkında daha fazla bilgiyi aşağıdaki adreste bulabilirsiniz: + A .binlog file can be "played back" by passing it to + msbuild.exe as an argument instead of a project/solution. + Other loggers will receive the information contained + in the log file as if the original build was happening. + You can read more about the binary log and its usages at: https://aka.ms/msbuild/binlog - Örnekler: + Examples: -bl -bl:output.binlog -bl:output.binlog;ProjectImports=None diff --git a/src/msbuild/src/MSBuild/Resources/xlf/Strings.zh-Hans.xlf b/src/msbuild/src/MSBuild/Resources/xlf/Strings.zh-Hans.xlf index 5b9eb8f6cb4..a525c7adf0d 100644 --- a/src/msbuild/src/MSBuild/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/msbuild/src/MSBuild/Resources/xlf/Strings.zh-Hans.xlf @@ -2033,49 +2033,57 @@ -bl:..\..\custom.binlog -binaryLogger - -binaryLogger[:[LogFile=]output.binlog[;ProjectImports={None,Embed,ZipFile}]] - 将所有生成事件序列化为压缩的二进制文件。 - 默认情况下该文件位于当前目录并且名为 "msbuild.binlog"。 - 二进制日志是生成过程的详细描述, - 以后可将其于重新构建文本日志 - 并由其他分析工具所使用。 - 二进制日志通常比大多数详细的文本诊断级日志小 10 到 20 倍, - 但它可以包含更多信息。 - (缩写: -bl) + -binaryLogger[:[LogFile=]output.binlog[;ProjectImports={None,Embed,ZipFile}]] + Serializes all build events to a compressed binary file. + By default the file is in the current directory and named + "msbuild.binlog". The binary log is a detailed description + of the build process that can later be used to reconstruct + text logs and used by other analysis tools. A binary log + is usually 10-20x smaller than the most detailed text + diagnostic-level log, but it contains more information. + (Short form: -bl) - 默认情况下,二进制记录器收集项目文件的源文本, - 包括生成期间所有导入的 - 项目和目标文件。可选的 - ProjectImports 开关控制此行为: + The optional LogFile specifies the path where the + binary log is saved. To generate a distinct log file + for each build, the token "{}" can be added into the + path, for example: LogFile=output-{}-log.binlog. Each + "{}" in the log path is replaced with a unique string + using the timestamp, running process Id and random + string stamp. - ProjectImports=None - 不收集项目 - 导入项。 - ProjectImports=Embed - 在日志文件中 - 嵌入项目导入项。 - ProjectImports=ZipFile - 将项目文件保存到 - output.projectimports.zip, - 其中输出的名称 - 与二进制日志文件名称相同。 + The binary logger by default collects the source text of + project files, including all imported projects and target + files encountered during the build. The optional + ProjectImports switch controls this behavior: - ProjectImports 的默认设置为 Embed。 - 注意: 记录器不会收集非 MSBuild 源文件, - 例如 .cs、.cpp 等。 + ProjectImports=None - Don't collect the project + imports. + ProjectImports=Embed - Embed project imports in the + log file. + ProjectImports=ZipFile - Save project files to + output.projectimports.zip + where output is the same name + as the binary log file name. - 可将 .binlog 文件以参数(而不是项目/解决方案)的形式传递给 - msbuild.exe 对其进行“播放”。 - 其他记录器将接收日志文件中的信息, - 就像原始的生成正在发生一样。 - 你可以通过以下网址阅读有关二进制文件及其用法的详细信息: - https://aka.ms/msbuild/binlog + The default setting for ProjectImports is Embed. + Note: the logger does not collect non-MSBuild source files + such as .cs, .cpp etc. - 示例: + A .binlog file can be "played back" by passing it to + msbuild.exe as an argument instead of a project/solution. + Other loggers will receive the information contained + in the log file as if the original build was happening. + You can read more about the binary log and its usages at: + https://aka.ms/msbuild/binlog + + Examples: -bl -bl:output.binlog -bl:output.binlog;ProjectImports=None -bl:output.binlog;ProjectImports=ZipFile -bl:..\..\custom.binlog -binaryLogger - + LOCALIZATION: The following should not be localized: 1) "msbuild" diff --git a/src/msbuild/src/MSBuild/Resources/xlf/Strings.zh-Hant.xlf b/src/msbuild/src/MSBuild/Resources/xlf/Strings.zh-Hant.xlf index 69fd2495b08..4bec527be35 100644 --- a/src/msbuild/src/MSBuild/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/msbuild/src/MSBuild/Resources/xlf/Strings.zh-Hant.xlf @@ -2034,42 +2034,50 @@ -bl:..\..\custom.binlog -binaryLogger - -binaryLogger[:[LogFile=]output.binlog[;ProjectImports={None,Embed,ZipFile}]] - 將所有建置事件序列化成壓縮的二進位檔案。 - 根據預設,此檔案存放在目前的目錄下,並會命名為 - 「msbuild.binlog」。此二進位記錄檔是 - 建置程序的詳細描述,之後可用於重建文字記錄, - 以及供其他分析工具使用。二進位記錄檔 - 的大小通常會比大部分的詳細文字 - 診斷層級記錄小 10-20 倍,但包含了更多資訊。 - (簡短形式: -bl) + -binaryLogger[:[LogFile=]output.binlog[;ProjectImports={None,Embed,ZipFile}]] + Serializes all build events to a compressed binary file. + By default the file is in the current directory and named + "msbuild.binlog". The binary log is a detailed description + of the build process that can later be used to reconstruct + text logs and used by other analysis tools. A binary log + is usually 10-20x smaller than the most detailed text + diagnostic-level log, but it contains more information. + (Short form: -bl) - 根據預設,二進位記錄器會收集專案檔的 - 原始程式文字,包括在建置期間遇到的 - 所有匯入專案及目標檔案。選擇性的 ProjectImports 參數 - 會控制此行為: + The optional LogFile specifies the path where the + binary log is saved. To generate a distinct log file + for each build, the token "{}" can be added into the + path, for example: LogFile=output-{}-log.binlog. Each + "{}" in the log path is replaced with a unique string + using the timestamp, running process Id and random + string stamp. + + The binary logger by default collects the source text of + project files, including all imported projects and target + files encountered during the build. The optional + ProjectImports switch controls this behavior: - ProjectImports=None - 不收集專案 - 匯入。 - ProjectImports=Embed - 在記錄檔中內嵌 - 專案匯入。 - ProjectImports=ZipFile - 將專案檔儲存到 - output.projectimports.zip, - 其中輸出的名稱與 - 二進位記錄檔名稱相同。 + ProjectImports=None - Don't collect the project + imports. + ProjectImports=Embed - Embed project imports in the + log file. + ProjectImports=ZipFile - Save project files to + output.projectimports.zip + where output is the same name + as the binary log file name. - ProjectImports 的預設設定為 Embed。 - 注意: 記錄器不會收集非 MSBuild 的來源檔案, - 例如 .cs、.cpp 等。 + The default setting for ProjectImports is Embed. + Note: the logger does not collect non-MSBuild source files + such as .cs, .cpp etc. - 將 .binlog 檔案傳遞到 msbuild.exe 作為引數而非 - 專案/解決方案,即可加以「播放」。 - 其他記錄器會收到記錄檔中包含的資訊, - 就如同原始組建發生時的情況。 - 若要深入閱讀二進位記錄檔及其使用方式,請前往: + A .binlog file can be "played back" by passing it to + msbuild.exe as an argument instead of a project/solution. + Other loggers will receive the information contained + in the log file as if the original build was happening. + You can read more about the binary log and its usages at: https://aka.ms/msbuild/binlog - 範例: + Examples: -bl -bl:output.binlog -bl:output.binlog;ProjectImports=None diff --git a/src/razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/Legacy/RazorParserTest.cs b/src/razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/Legacy/RazorParserTest.cs index a6c9bbd554c..27e08d0dbeb 100644 --- a/src/razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/Legacy/RazorParserTest.cs +++ b/src/razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/Legacy/RazorParserTest.cs @@ -37,7 +37,7 @@ public void ParseMethodCallsParseDocumentOnMarkupParserAndReturnsResults() var syntaxTree = parser.Parse(TestRazorSourceDocument.Create("foo @bar baz")); // Assert - var actual = SyntaxNodeSerializer.Serialize(syntaxTree.Root, validateSpanEditHandlers: true); + var actual = TestSyntaxSerializer.Serialize(syntaxTree.Root, allowSpanEditHandlers: true); AssertEx.AssertEqualToleratingWhitespaceDifferences(expected, actual); } } diff --git a/src/razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/DefaultRazorTagHelperBinderPhaseTest.cs b/src/razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/DefaultRazorTagHelperBinderPhaseTest.cs index abea6f12392..b50d579fc1d 100644 --- a/src/razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/DefaultRazorTagHelperBinderPhaseTest.cs +++ b/src/razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/DefaultRazorTagHelperBinderPhaseTest.cs @@ -1245,26 +1245,6 @@ @using static SomeProject.SomeOtherFolder.Foo Assert.Same(componentDescriptor, result); } - [Theory] - [InlineData("", "", true)] - [InlineData("Foo", "Project", true)] - [InlineData("Project.Foo", "Project", true)] - [InlineData("Project.Foo", "global::Project", true)] - [InlineData("Project.Bar.Foo", "Project.Bar", true)] - [InlineData("Project.Foo", "Project.Bar", false)] - [InlineData("Project.Foo", "global::Project.Bar", false)] - [InlineData("Project.Bar.Foo", "Project", false)] - [InlineData("Bar.Foo", "Project", false)] - public void IsTypeInNamespace_WorksAsExpected(string typeName, string @namespace, bool expected) - { - // Arrange & Act - var descriptor = CreateComponentDescriptor(typeName, typeName, "Test.dll"); - var result = DefaultRazorTagHelperContextDiscoveryPhase.ComponentDirectiveVisitor.IsTypeInNamespace(descriptor, @namespace); - - // Assert - Assert.Equal(expected, result); - } - [Theory] [InlineData("", "", true)] [InlineData("Foo", "Project", true)] @@ -1273,11 +1253,13 @@ public void IsTypeInNamespace_WorksAsExpected(string typeName, string @namespace [InlineData("Project.Foo", "Project.Bar", true)] [InlineData("Project.Bar.Foo", "Project", false)] [InlineData("Bar.Foo", "Project", false)] - public void IsTypeInScope_WorksAsExpected(string typeName, string currentNamespace, bool expected) + public void IsTypeNamespaceInScope_WorksAsExpected(string typeName, string currentNamespace, bool expected) { // Arrange & Act var descriptor = CreateComponentDescriptor(typeName, typeName, "Test.dll"); - var result = DefaultRazorTagHelperContextDiscoveryPhase.ComponentDirectiveVisitor.IsTypeInScope(descriptor, currentNamespace); + var tagHelperTypeNamespace = descriptor.GetTypeNamespace(); + + var result = DefaultRazorTagHelperContextDiscoveryPhase.ComponentDirectiveVisitor.IsTypeNamespaceInScope(tagHelperTypeNamespace, currentNamespace); // Assert Assert.Equal(expected, result); diff --git a/src/razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/FindTokenIntegrationTest.cs b/src/razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/FindTokenIntegrationTest.cs index ce12732a233..545d59c9d7e 100644 --- a/src/razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/FindTokenIntegrationTest.cs +++ b/src/razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/FindTokenIntegrationTest.cs @@ -20,6 +20,6 @@ public void EmptyDirective() var root = codeDocument.GetSyntaxTree().Root; var token = root.FindToken(27); - AssertEx.Equal("Identifier;[];", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("Identifier;[];", TestSyntaxSerializer.Serialize(token).Trim()); } } diff --git a/src/razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/RazorParserTest.cs b/src/razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/RazorParserTest.cs index 85c24eaae1b..98316708891 100644 --- a/src/razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/RazorParserTest.cs +++ b/src/razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/RazorParserTest.cs @@ -3,6 +3,7 @@ #nullable disable +using Microsoft.AspNetCore.Razor.Language; using Xunit; namespace Microsoft.AspNetCore.Razor.Language.Legacy; @@ -48,7 +49,7 @@ public void ParseMethodCallsParseDocumentOnMarkupParserAndReturnsResults() var syntaxTree = parser.Parse(TestRazorSourceDocument.Create("foo @bar baz")); // Assert - var actual = SyntaxNodeSerializer.Serialize(syntaxTree.Root, validateSpanEditHandlers: false); + var actual = TestSyntaxSerializer.Serialize(syntaxTree.Root, allowSpanEditHandlers: false); Assert.Equal(expected, actual); } } diff --git a/src/razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Syntax/FindTokenTests.cs b/src/razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Syntax/FindTokenTests.cs index a0f5cd31dfd..22986df7432 100644 --- a/src/razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Syntax/FindTokenTests.cs +++ b/src/razor/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Syntax/FindTokenTests.cs @@ -39,7 +39,7 @@ public void ReturnsEofOnFileEnd() var token = tree.Root.FindToken(position); - AssertEx.Equal("""EndOfFile;[];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""EndOfFile;[];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact, WorkItem("https://github.com/dotnet/razor/issues/7505")] @@ -54,7 +54,7 @@ public void ReturnsEofOnFileEnd_WithTrailingTrivia() var token = tree.Root.FindToken(position); - AssertEx.Equal("""EndOfFile;[];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""EndOfFile;[];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact, WorkItem("https://github.com/dotnet/razor/issues/9040")] @@ -67,7 +67,7 @@ public void LeadingWhitespace_BeforeAnyNode() var token = tree.Root.FindToken(position); - AssertEx.Equal("""OpenAngle;[<];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""OpenAngle;[<];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -78,7 +78,7 @@ public void ReturnsOpenAngle() var token = tree.Root.FindToken(position); - AssertEx.Equal("""OpenAngle;[<];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""OpenAngle;[<];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Theory] @@ -91,7 +91,7 @@ public void ReturnsStartDivTag(string text) var token = tree.Root.FindToken(position); - AssertEx.Equal("""Text;[div];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""Text;[div];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -102,7 +102,7 @@ public void ReturnsCloseAngle() var token = tree.Root.FindToken(position); - AssertEx.Equal("""CloseAngle;[>];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""CloseAngle;[>];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact, WorkItem("https://github.com/dotnet/razor/issues/7630")] @@ -113,7 +113,7 @@ public void ReturnsEof_AfterVoidTag() var token = tree.Root.FindToken(position); - AssertEx.Equal("""EndOfFile;[];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""EndOfFile;[];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact, WorkItem("https://github.com/dotnet/razor/issues/7630")] @@ -124,7 +124,7 @@ public void ReturnsCloseAngle_AfterVoidTagWithTrailingSpace() var token = tree.Root.FindToken(position); - AssertEx.Equal("""CloseAngle;[>];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""CloseAngle;[>];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -139,7 +139,7 @@ public void CSharpTransition_01() var token = tree.Root.FindToken(position); - AssertEx.Equal("""Transition;[@];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""Transition;[@];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -154,7 +154,7 @@ public void CSharpTransition_02() var token = tree.Root.FindToken(position); - AssertEx.Equal("""Keyword;[if];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""Keyword;[if];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -169,7 +169,7 @@ public void CSharpTransition_03_IgnoreWhitespace() var token = tree.Root.FindToken(position); - AssertEx.Equal("""Keyword;[if];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""Keyword;[if];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -184,7 +184,7 @@ public void CSharpTransition_03_IncludeWhitespace() var token = tree.Root.FindToken(position, includeWhitespace: true); - AssertEx.Equal("""Whitespace;[ ];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""Whitespace;[ ];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -199,7 +199,7 @@ public void CSharpTransition_04() var token = tree.Root.FindToken(position); - AssertEx.Equal("""LeftParenthesis;[(];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""LeftParenthesis;[(];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -214,7 +214,7 @@ public void CSharpTransition_05() var token = tree.Root.FindToken(position); - AssertEx.Equal("""Keyword;[true];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""Keyword;[true];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -229,7 +229,7 @@ public void CSharpTransition_06() var token = tree.Root.FindToken(position); - AssertEx.Equal("""RightParenthesis;[)];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""RightParenthesis;[)];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -244,7 +244,7 @@ public void CSharpTransition_07_IgnoreWhitespace() var token = tree.Root.FindToken(position); - AssertEx.Equal("""RightParenthesis;[)];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""RightParenthesis;[)];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -259,7 +259,7 @@ public void CSharpTransition_07_IncludeWhitespace() var token = tree.Root.FindToken(position, includeWhitespace: true); - AssertEx.Equal("""NewLine;[LF];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""NewLine;[LF];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -274,7 +274,7 @@ public void CSharpTransition_08() var token = tree.Root.FindToken(position); - AssertEx.Equal("""LeftBrace;[{];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""LeftBrace;[{];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -290,7 +290,7 @@ public void CSharpTransition_09() var token = tree.Root.FindToken(position); - AssertEx.Equal("""RightBrace;[}];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""RightBrace;[}];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -305,7 +305,7 @@ public void CSharpTransition_10() var token = tree.Root.FindToken(position); - AssertEx.Equal("""RightBrace;[}];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""RightBrace;[}];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -318,7 +318,7 @@ public void CSharpTransition_11() var token = tree.Root.FindToken(position); - AssertEx.Equal("""Transition;[@];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""Transition;[@];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -331,7 +331,7 @@ public void CSharpTransition_12() var token = tree.Root.FindToken(position); - AssertEx.Equal("""Identifier;[value];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""Identifier;[value];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -344,7 +344,7 @@ public void CSharpTransition_12_IgnoreWhitespace() var token = tree.Root.FindToken(position); - AssertEx.Equal("""Identifier;[value];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""Identifier;[value];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -357,7 +357,7 @@ public void CSharpTransition_12_IncludeWhitespace() var token = tree.Root.FindToken(position, includeWhitespace: true); - AssertEx.Equal("""Whitespace;[ ];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""Whitespace;[ ];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -370,7 +370,7 @@ public void CSharpTransition_13() var token = tree.Root.FindToken(position); - AssertEx.Equal("""Transition;[@];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""Transition;[@];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -383,7 +383,7 @@ public void CSharpTransition_14() var token = tree.Root.FindToken(position); - AssertEx.Equal("""LeftParenthesis;[(];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""LeftParenthesis;[(];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -396,7 +396,7 @@ public void CSharpTransition_15() var token = tree.Root.FindToken(position); - AssertEx.Equal("""Identifier;[value];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""Identifier;[value];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -409,7 +409,7 @@ public void CSharpTransition_16() var token = tree.Root.FindToken(position); - AssertEx.Equal("""RightParenthesis;[)];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""RightParenthesis;[)];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -422,7 +422,7 @@ public void CSharpTransition_17_IgnoreWhitespace() var token = tree.Root.FindToken(position); - AssertEx.Equal("""RightParenthesis;[)];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""RightParenthesis;[)];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -435,7 +435,7 @@ public void CSharpTransition_17_IncludeWhitespace() var token = tree.Root.FindToken(position, includeWhitespace: true); - AssertEx.Equal("""Whitespace;[ ];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""Whitespace;[ ];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -451,7 +451,7 @@ public void HtmlTransition_01() var token = tree.Root.FindToken(position); - AssertEx.Equal("""OpenAngle;[<];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""OpenAngle;[<];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Theory, WorkItem("https://github.com/dotnet/razor/issues/7630")] @@ -470,7 +470,7 @@ public void HtmlTransition_02(string tagContent) var token = tree.Root.FindToken(position); - AssertEx.Equal("""CloseAngle;[>];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""CloseAngle;[>];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact, WorkItem("https://github.com/dotnet/razor/issues/7630")] @@ -486,7 +486,7 @@ public void HtmlTransition_03() var token = tree.Root.FindToken(position); - AssertEx.Equal("""OpenAngle;[<];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""OpenAngle;[<];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact, WorkItem("https://github.com/dotnet/razor/issues/7630")] @@ -502,7 +502,7 @@ public void HtmlTransition_04() var token = tree.Root.FindToken(position); - AssertEx.Equal("""CloseAngle;[>];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""CloseAngle;[>];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Theory, WorkItem("https://github.com/dotnet/razor/issues/7505")] @@ -531,7 +531,7 @@ public void HtmlTransition_05(bool withComment) var token = tree.Root.FindToken(position); - AssertEx.Equal("""OpenAngle;[<];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""OpenAngle;[<];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -546,7 +546,7 @@ public void IgnoreWhitespace_BeforeNewline_01() var token = tree.Root.FindToken(position); - AssertEx.Equal("""CloseAngle;[>];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""CloseAngle;[>];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -560,7 +560,7 @@ public void IgnoreWhitespace_BeforeNewline_02() var token = tree.Root.FindToken(position); - AssertEx.Equal("""Text;[asdf];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""Text;[asdf];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -575,7 +575,7 @@ public void IgnoreWhitespace_AfterNewline() var token = tree.Root.FindToken(position); - AssertEx.Equal("""OpenAngle;[<];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""OpenAngle;[<];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -589,7 +589,7 @@ public void IgnoreWhitespace_InsideTag_01() var token = tree.Root.FindToken(position); - AssertEx.Equal("""Text;[div];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""Text;[div];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -603,7 +603,7 @@ public void IgnoreWhitespace_InsideTag_02() var token = tree.Root.FindToken(position); - AssertEx.Equal("""Text;[Attribute];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""Text;[Attribute];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -617,7 +617,7 @@ public void IgnoreWhitespace_InsideTag_03() var token = tree.Root.FindToken(position); - AssertEx.Equal("""Equals;[=];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""Equals;[=];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -632,7 +632,7 @@ public void IgnoreWhitespace_InsideTag_04() var token = tree.Root.FindToken(position); - AssertEx.Equal("""DoubleQuote;["];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""DoubleQuote;["];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -646,7 +646,7 @@ public void IgnoreWhitespace_InsideTag_05() var token = tree.Root.FindToken(position); - AssertEx.Equal("""DoubleQuote;["];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""DoubleQuote;["];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -660,7 +660,7 @@ public void IgnoreWhitespace_InsideTag_06() var token = tree.Root.FindToken(position); - AssertEx.Equal("""Text;[value];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""Text;[value];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -674,7 +674,7 @@ public void IgnoreWhitespace_InsideTag_07() var token = tree.Root.FindToken(position); - AssertEx.Equal("""DoubleQuote;["];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""DoubleQuote;["];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -688,7 +688,7 @@ public void IgnoreWhitespace_InsideTag_08() var token = tree.Root.FindToken(position); - AssertEx.Equal("""CloseAngle;[>];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""CloseAngle;[>];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -703,7 +703,7 @@ public void IgnoreWhitespace_InsideTag_09() var token = tree.Root.FindToken(position); - AssertEx.Equal("""CloseAngle;[>];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""CloseAngle;[>];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -717,7 +717,7 @@ public void HtmlComment_01() var token = tree.Root.FindToken(position); - AssertEx.Equal("""OpenAngle;[<];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""OpenAngle;[<];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -731,7 +731,7 @@ public void HtmlComment_02() var token = tree.Root.FindToken(position); - AssertEx.Equal("""Bang;[!];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""Bang;[!];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -745,7 +745,7 @@ public void HtmlComment_03() var token = tree.Root.FindToken(position); - AssertEx.Equal("""DoubleHyphen;[--];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""DoubleHyphen;[--];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -759,7 +759,7 @@ public void HtmlComment_04_IgnoreWhitespace() var token = tree.Root.FindToken(position); - AssertEx.Equal("""DoubleHyphen;[--];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""DoubleHyphen;[--];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -773,7 +773,7 @@ public void HtmlComment_04_IncludeWhitespace() var token = tree.Root.FindToken(position, includeWhitespace: true); - AssertEx.Equal("""Whitespace;[ ];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""Whitespace;[ ];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -787,7 +787,7 @@ public void HtmlComment_05() var token = tree.Root.FindToken(position); - AssertEx.Equal("""Text;[Comment];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""Text;[Comment];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -801,7 +801,7 @@ public void HtmlComment_06() var token = tree.Root.FindToken(position); - AssertEx.Equal("""Text;[Comment];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""Text;[Comment];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -815,7 +815,7 @@ public void HtmlComment_07() var token = tree.Root.FindToken(position); - AssertEx.Equal("""DoubleHyphen;[--];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""DoubleHyphen;[--];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -829,7 +829,7 @@ public void HtmlComment_08() var token = tree.Root.FindToken(position); - AssertEx.Equal("""CloseAngle;[>];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""CloseAngle;[>];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -843,7 +843,7 @@ public void HtmlComment_09() var token = tree.Root.FindToken(position); - AssertEx.Equal("""CloseAngle;[>];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""CloseAngle;[>];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -857,7 +857,7 @@ public void RazorComment_01() var token = tree.Root.FindToken(position); - AssertEx.Equal("""RazorCommentTransition;[@];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""RazorCommentTransition;[@];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -871,7 +871,7 @@ public void RazorComment_02() var token = tree.Root.FindToken(position); - AssertEx.Equal("""RazorCommentStar;[*];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""RazorCommentStar;[*];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -885,7 +885,7 @@ public void RazorComment_03_IgnoreWhitespace() var token = tree.Root.FindToken(position); - AssertEx.Equal("""RazorCommentLiteral;[ Comment ];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""RazorCommentLiteral;[ Comment ];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -899,7 +899,7 @@ public void RazorComment_03_IncludeWhitespace() var token = tree.Root.FindToken(position, includeWhitespace: true); - AssertEx.Equal("""RazorCommentLiteral;[ Comment ];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""RazorCommentLiteral;[ Comment ];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -913,7 +913,7 @@ public void RazorComment_04() var token = tree.Root.FindToken(position); - AssertEx.Equal("""RazorCommentLiteral;[ Comment ];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""RazorCommentLiteral;[ Comment ];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -927,7 +927,7 @@ public void RazorComment_05() var token = tree.Root.FindToken(position); - AssertEx.Equal("""RazorCommentLiteral;[ Comment ];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""RazorCommentLiteral;[ Comment ];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -941,7 +941,7 @@ public void RazorComment_06() var token = tree.Root.FindToken(position); - AssertEx.Equal("""RazorCommentStar;[*];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""RazorCommentStar;[*];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -955,7 +955,7 @@ public void RazorComment_07() var token = tree.Root.FindToken(position); - AssertEx.Equal("""RazorCommentTransition;[@];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""RazorCommentTransition;[@];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] @@ -969,7 +969,7 @@ public void RazorComment_08() var token = tree.Root.FindToken(position); - AssertEx.Equal("""RazorCommentTransition;[@];""", SyntaxSerializer.Serialize(token).Trim()); + AssertEx.Equal("""RazorCommentTransition;[@];""", TestSyntaxSerializer.Serialize(token).Trim()); } [Fact] diff --git a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultDirectiveSyntaxTreePass.cs b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultDirectiveSyntaxTreePass.cs index 80bed8804d6..8bf57143dd1 100644 --- a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultDirectiveSyntaxTreePass.cs +++ b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultDirectiveSyntaxTreePass.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Immutable; +using System.Diagnostics.CodeAnalysis; using Microsoft.AspNetCore.Razor.Language.Extensions; using Microsoft.AspNetCore.Razor.Language.Syntax; @@ -39,7 +40,8 @@ public RazorSyntaxTree Verify() return new RazorSyntaxTree(root, _syntaxTree.Source, diagnostics, _syntaxTree.Options); } - public override SyntaxNode Visit(SyntaxNode node) + [return: NotNullIfNotNull(nameof(node))] + public override SyntaxNode? Visit(SyntaxNode? node) { try { diff --git a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorTagHelperContextDiscoveryPhase.cs b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorTagHelperContextDiscoveryPhase.cs index e349364cd1f..2a57f87eeb4 100644 --- a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorTagHelperContextDiscoveryPhase.cs +++ b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorTagHelperContextDiscoveryPhase.cs @@ -58,18 +58,18 @@ protected override void ExecuteCore(RazorCodeDocument codeDocument, Cancellation codeDocument.SetPreTagHelperSyntaxTree(syntaxTree); } - private static ReadOnlySpan GetSpanWithoutGlobalPrefix(string s) + internal static ReadOnlyMemory GetMemoryWithoutGlobalPrefix(string s) { const string globalPrefix = "global::"; - var span = s.AsSpan(); + var mem = s.AsMemory(); - if (span.StartsWith(globalPrefix.AsSpan(), StringComparison.Ordinal)) + if (mem.Span.StartsWith(globalPrefix.AsSpan(), StringComparison.Ordinal)) { - return span[globalPrefix.Length..]; + return mem[globalPrefix.Length..]; } - return span; + return mem; } internal abstract class DirectiveVisitor : SyntaxWalker @@ -241,7 +241,7 @@ public override void VisitRazorDirective(RazorDirectiveSyntax node) continue; } - switch (GetSpanWithoutGlobalPrefix(addTagHelper.TypePattern)) + switch (GetMemoryWithoutGlobalPrefix(addTagHelper.TypePattern).Span) { case ['*']: AddMatches(nonComponentTagHelpers); @@ -287,7 +287,7 @@ public override void VisitRazorDirective(RazorDirectiveSyntax node) continue; } - switch (GetSpanWithoutGlobalPrefix(removeTagHelper.TypePattern)) + switch (GetMemoryWithoutGlobalPrefix(removeTagHelper.TypePattern).Span) { case ['*']: RemoveMatches(nonComponentTagHelpers); @@ -334,7 +334,9 @@ public override void VisitRazorDirective(RazorDirectiveSyntax node) internal sealed class ComponentDirectiveVisitor : DirectiveVisitor { - private readonly List _nonFullyQualifiedComponents = []; + // The list values in this dictionary are pooled + private readonly Dictionary, List> _typeNamespaceToNonFullyQualifiedComponents = new Dictionary, List>(ReadOnlyMemoryOfCharComparer.Instance); + private List? _nonFullyQualifiedComponentsWithEmptyTypeNamespace; private string? _filePath; private RazorSourceDocument? _source; @@ -347,6 +349,7 @@ public void Initialize(string filePath, IReadOnlyList tagHe Debug.Assert(!IsInitialized); _filePath = filePath; + _nonFullyQualifiedComponentsWithEmptyTypeNamespace = ListPool.Default.Get(); foreach (var tagHelper in tagHelpers.AsEnumerable()) { @@ -363,25 +366,31 @@ public void Initialize(string filePath, IReadOnlyList tagHe continue; } - _nonFullyQualifiedComponents.Add(tagHelper); + var tagHelperTypeNamespace = tagHelper.GetTypeNamespace().AsMemory(); - if (currentNamespace is null) + if (tagHelperTypeNamespace.IsEmpty) { - continue; + _nonFullyQualifiedComponentsWithEmptyTypeNamespace.Add(tagHelper); } - - if (tagHelper.IsChildContentTagHelper) + else { - // If this is a child content tag helper, we want to add it if it's original type is in scope. - // E.g, if the type name is `Test.MyComponent.ChildContent`, we want to add it if `Test.MyComponent` is in scope. - if (IsTypeInScope(tagHelper, currentNamespace)) + if (!_typeNamespaceToNonFullyQualifiedComponents.TryGetValue(tagHelperTypeNamespace, out var tagHelpersList)) { - AddMatch(tagHelper); + tagHelpersList = ListPool.Default.Get(); + _typeNamespaceToNonFullyQualifiedComponents.Add(tagHelperTypeNamespace, tagHelpersList); } + + tagHelpersList.Add(tagHelper); } - else if (IsTypeInScope(tagHelper, currentNamespace)) + + if (currentNamespace is null) { - // Also, if the type is already in scope of the document's namespace, using isn't necessary. + continue; + } + + if (IsTypeNamespaceInScope(tagHelperTypeNamespace.Span, currentNamespace)) + { + // If the type is already in scope of the document's namespace, using isn't necessary. AddMatch(tagHelper); } } @@ -391,7 +400,18 @@ public void Initialize(string filePath, IReadOnlyList tagHe public override void Reset() { - _nonFullyQualifiedComponents.Clear(); + if (_nonFullyQualifiedComponentsWithEmptyTypeNamespace != null) + { + ListPool.Default.Return(_nonFullyQualifiedComponentsWithEmptyTypeNamespace); + _nonFullyQualifiedComponentsWithEmptyTypeNamespace = null; + } + + foreach (var (_, tagHelpers) in _typeNamespaceToNonFullyQualifiedComponents) + { + ListPool.Default.Return(tagHelpers); + } + + _typeNamespaceToNonFullyQualifiedComponents.Clear(); _filePath = null; _source = null; @@ -407,6 +427,8 @@ public override void Visit(RazorSyntaxTree tree) public override void VisitRazorDirective(RazorDirectiveSyntax node) { + var componentsWithEmptyTypeNamespace = _nonFullyQualifiedComponentsWithEmptyTypeNamespace.AssumeNotNull(); + var descendantLiterals = node.DescendantNodes(); foreach (var child in descendantLiterals) { @@ -455,22 +477,30 @@ public override void VisitRazorDirective(RazorDirectiveSyntax node) continue; } - foreach (var tagHelper in _nonFullyQualifiedComponents) + if (_typeNamespaceToNonFullyQualifiedComponents.Count == 0 && componentsWithEmptyTypeNamespace.Count == 0) + { + // There aren't any non qualified components to add + continue; + } + + // Add all tag helpers that have an empty type namespace + foreach (var tagHelper in componentsWithEmptyTypeNamespace) { Debug.Assert(!tagHelper.IsComponentFullyQualifiedNameMatch, "We've already processed these."); - if (tagHelper.IsChildContentTagHelper) - { - // If this is a child content tag helper, we want to add it if it's original type is in scope of the given namespace. - // E.g, if the type name is `Test.MyComponent.ChildContent`, we want to add it if `Test.MyComponent` is in this namespace. - if (IsTypeInNamespace(tagHelper, @namespace)) - { - AddMatch(tagHelper); - } - } - else if (IsTypeInNamespace(tagHelper, @namespace)) + AddMatch(tagHelper); + } + + // Remove global:: prefix from namespace. + var normalizedNamespace = GetMemoryWithoutGlobalPrefix(@namespace); + + // Add all tag helpers with a matching namespace + if (_typeNamespaceToNonFullyQualifiedComponents.TryGetValue(normalizedNamespace, out var tagHelpers)) + { + foreach (var tagHelper in tagHelpers) { - // If the type is at the top-level or if the type's namespace matches the using's namespace, add it. + Debug.Assert(!tagHelper.IsComponentFullyQualifiedNameMatch, "We've already processed these."); + AddMatch(tagHelper); } } @@ -480,32 +510,14 @@ public override void VisitRazorDirective(RazorDirectiveSyntax node) } } - internal static bool IsTypeInNamespace(TagHelperDescriptor tagHelper, string @namespace) - { - var typeNamespace = tagHelper.GetTypeNamespace(); - - if (typeNamespace.IsNullOrEmpty()) - { - // Either the typeName is not the full type name or this type is at the top level. - return true; - } - - // Remove global:: prefix from namespace. - var normalizedNamespaceSpan = GetSpanWithoutGlobalPrefix(@namespace); - - return normalizedNamespaceSpan.Equals(typeNamespace.AsSpan(), StringComparison.Ordinal); - } - - // Check if the given type is already in scope given the namespace of the current document. + // Check if a type's namespace is already in scope given the namespace of the current document. // E.g, // If the namespace of the document is `MyComponents.Components.Shared`, // then the types `MyComponents.FooComponent`, `MyComponents.Components.BarComponent`, `MyComponents.Components.Shared.BazComponent` are all in scope. // Whereas `MyComponents.SomethingElse.OtherComponent` is not in scope. - internal static bool IsTypeInScope(TagHelperDescriptor tagHelper, string @namespace) + internal static bool IsTypeNamespaceInScope(ReadOnlySpan typeNamespace, string @namespace) { - var typeNamespace = tagHelper.GetTypeNamespace(); - - if (typeNamespace.IsNullOrEmpty()) + if (typeNamespace.IsEmpty) { // Either the typeName is not the full type name or this type is at the top level. return true; diff --git a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/TagHelperBlockRewriter.cs b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/TagHelperBlockRewriter.cs index 7731498b812..6464726bed6 100644 --- a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/TagHelperBlockRewriter.cs +++ b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/TagHelperBlockRewriter.cs @@ -621,7 +621,7 @@ public override SyntaxNode VisitCSharpImplicitExpression(CSharpImplicitExpressio var firstToken = firstChild.GetFirstToken(); var newFirstToken = SyntaxFactory.Token(firstToken.Kind, node.Transition.Transition.Content + firstToken.Content).WithAnnotations(firstToken.GetAnnotations()); - var newFirstChild = firstChild.ReplaceNode(firstToken, newFirstToken); + var newFirstChild = firstChild.ReplaceToken(firstToken, newFirstToken); builder.AddRange(rewrittenBody.Children.Replace(firstChild, newFirstChild)); // Since the original transition is part of the body, we need something to take it's place. diff --git a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/TagHelperParseTreeRewriter.cs b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/TagHelperParseTreeRewriter.cs index dcc5167dd70..091ff3e91be 100644 --- a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/TagHelperParseTreeRewriter.cs +++ b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/TagHelperParseTreeRewriter.cs @@ -36,10 +36,7 @@ public static RazorSyntaxTree Rewrite(RazorSyntaxTree syntaxTree, TagHelperBinde foreach (var descriptor in binder.Descriptors) { - foreach (var diagnostic in descriptor.GetAllDiagnostics()) - { - builder.Add(diagnostic); - } + descriptor.AppendAllDiagnostics(ref builder.AsRef()); } var diagnostics = builder.ToImmutableOrderedBy(static d => d.Span.AbsoluteIndex); @@ -162,7 +159,7 @@ public override SyntaxNode VisitMarkupElement(MarkupElementSyntax node) var body = VisitList(node.Body); // Visit end tag. - var endTag = (MarkupEndTagSyntax)Visit(node.EndTag); + var endTag = (MarkupEndTagSyntax?)Visit(node.EndTag); if (endTag != null) { var tagName = endTag.GetTagNameWithOptionalBang(); diff --git a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/ReadOnlyMemoryOfCharComparer.cs b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/ReadOnlyMemoryOfCharComparer.cs new file mode 100644 index 00000000000..802b2fd23bb --- /dev/null +++ b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/ReadOnlyMemoryOfCharComparer.cs @@ -0,0 +1,42 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.Extensions.Internal; + +namespace Microsoft.AspNetCore.Razor.Language; + +internal sealed class ReadOnlyMemoryOfCharComparer : IEqualityComparer> +{ + public static readonly ReadOnlyMemoryOfCharComparer Instance = new ReadOnlyMemoryOfCharComparer(); + + private ReadOnlyMemoryOfCharComparer() + { + } + + public static bool Equals(ReadOnlySpan x, ReadOnlyMemory y) + => x.SequenceEqual(y.Span); + + public bool Equals(ReadOnlyMemory x, ReadOnlyMemory y) + => x.Span.SequenceEqual(y.Span); + + public int GetHashCode(ReadOnlyMemory memory) + { +#if NET + return string.GetHashCode(memory.Span); +#else + // We don't rely on ReadOnlyMemory.GetHashCode() because it includes + // the index and length, but we just want a hash based on the characters. + var hashCombiner = HashCodeCombiner.Start(); + + foreach (var ch in memory.Span) + { + hashCombiner.Add(ch); + } + + return hashCombiner.CombinedHash; +#endif + } +} diff --git a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/RazorSyntaxNode.cs b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/RazorSyntaxNode.cs index 9307de39f5d..fc8b07ca77a 100644 --- a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/RazorSyntaxNode.cs +++ b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/RazorSyntaxNode.cs @@ -1,7 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#nullable disable +using System; +using System.Collections.Generic; namespace Microsoft.AspNetCore.Razor.Language.Syntax; @@ -11,4 +12,29 @@ public RazorSyntaxNode(GreenNode green, SyntaxNode parent, int position) : base(green, parent, position) { } + + internal override string SerializedValue => Serializer.Serialize(this); + + public abstract TResult? Accept(SyntaxVisitor visitor); + + public abstract void Accept(SyntaxVisitor visitor); + + protected internal override SyntaxNode ReplaceCore( + IEnumerable? nodes = null, + Func? computeReplacementNode = null, + IEnumerable? tokens = null, + Func? computeReplacementToken = null) + => SyntaxReplacer.Replace(this, nodes, computeReplacementNode, tokens, computeReplacementToken); + + protected internal override SyntaxNode ReplaceNodeInListCore(SyntaxNode originalNode, IEnumerable replacementNodes) + => SyntaxReplacer.ReplaceNodeInList(this, originalNode, replacementNodes); + + protected internal override SyntaxNode InsertNodesInListCore(SyntaxNode nodeInList, IEnumerable nodesToInsert, bool insertBefore) + => SyntaxReplacer.InsertNodeInList(this, nodeInList, nodesToInsert, insertBefore); + + protected internal override SyntaxNode ReplaceTokenInListCore(SyntaxToken originalToken, IEnumerable newTokens) + => SyntaxReplacer.ReplaceTokenInList(this, originalToken, newTokens); + + protected internal override SyntaxNode InsertTokensInListCore(SyntaxToken originalToken, IEnumerable newTokens, bool insertBefore) + => SyntaxReplacer.InsertTokenInList(this, originalToken, newTokens, insertBefore); } diff --git a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxList.cs b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxList.cs index 678cdb9bd87..56d343db80f 100644 --- a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxList.cs +++ b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxList.cs @@ -1,6 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System; +using System.Collections.Generic; + namespace Microsoft.AspNetCore.Razor.Language.Syntax; internal abstract class SyntaxList : SyntaxNode @@ -10,17 +13,28 @@ protected SyntaxList(InternalSyntax.SyntaxList green, SyntaxNode parent, int pos { } - public override TResult Accept(SyntaxVisitor visitor) - { - return visitor.Visit(this); - } + internal override string SerializedValue => $"List: {SlotCount} slots"; - public override void Accept(SyntaxVisitor visitor) - { - visitor.Visit(this); - } + protected internal override SyntaxNode ReplaceCore( + IEnumerable? nodes = null, + Func? computeReplacementNode = null, + IEnumerable? tokens = null, + Func? computeReplacementToken = null) + => Assumed.Unreachable(); + + protected internal override SyntaxNode ReplaceNodeInListCore(SyntaxNode originalNode, IEnumerable replacementNodes) + => Assumed.Unreachable(); + + protected internal override SyntaxNode InsertNodesInListCore(SyntaxNode nodeInList, IEnumerable nodesToInsert, bool insertBefore) + => Assumed.Unreachable(); + + protected internal override SyntaxNode ReplaceTokenInListCore(SyntaxToken originalToken, IEnumerable newTokens) + => Assumed.Unreachable(); + + protected internal override SyntaxNode InsertTokensInListCore(SyntaxToken originalToken, IEnumerable newTokens, bool insertBefore) + => Assumed.Unreachable(); - internal class WithTwoChildren : SyntaxList + internal sealed class WithTwoChildren : SyntaxList { private SyntaxNode? _child0; private SyntaxNode? _child1; @@ -47,7 +61,7 @@ internal WithTwoChildren(InternalSyntax.SyntaxList green, SyntaxNode parent, int }; } - internal class WithThreeChildren : SyntaxList + internal sealed class WithThreeChildren : SyntaxList { private SyntaxNode? _child0; private SyntaxNode? _child1; @@ -77,7 +91,7 @@ internal WithThreeChildren(InternalSyntax.SyntaxList green, SyntaxNode parent, i }; } - internal class WithManyChildren : SyntaxList + internal sealed class WithManyChildren : SyntaxList { private readonly ArrayElement[] _children; diff --git a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxNode.Serializer.cs b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxNode.Serializer.cs new file mode 100644 index 00000000000..bf0cf90152f --- /dev/null +++ b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxNode.Serializer.cs @@ -0,0 +1,36 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Text; +using Microsoft.AspNetCore.Razor.PooledObjects; + +namespace Microsoft.AspNetCore.Razor.Language.Syntax; + +internal abstract partial class SyntaxNode +{ + protected sealed class Serializer : SyntaxSerializer + { + private Serializer(StringBuilder builder) + : base(builder) + { + } + + internal static string Serialize(RazorSyntaxNode node) + { + using var _ = StringBuilderPool.GetPooledObject(out var builder); + var serializer = new Serializer(builder); + serializer.Visit(node); + + return builder.ToString(); + } + + internal static string Serialize(SyntaxToken token) + { + using var _ = StringBuilderPool.GetPooledObject(out var builder); + var serializer = new Serializer(builder); + serializer.VisitToken(token); + + return builder.ToString(); + } + } +} diff --git a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxNode.cs b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxNode.cs index 7fbcf0b4581..018e7808dd3 100644 --- a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxNode.cs +++ b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxNode.cs @@ -42,11 +42,7 @@ internal abstract partial class SyntaxNode(GreenNode green, SyntaxNode parent, i public bool ContainsAnnotations => Green.ContainsAnnotations; - internal string SerializedValue => SyntaxSerializer.Serialize(this); - - public abstract TResult Accept(SyntaxVisitor visitor); - - public abstract void Accept(SyntaxVisitor visitor); + internal abstract string SerializedValue { get; } internal abstract SyntaxNode? GetNodeSlot(int index); @@ -280,23 +276,17 @@ public IEnumerable DescendantTokens(Func? descend return DescendantNodesImpl(Span, descendIntoChildren, includeSelf: true).OfType(); } - protected internal SyntaxNode ReplaceCore( + protected internal abstract SyntaxNode ReplaceCore( IEnumerable? nodes = null, - Func? computeReplacementNode = null) - where TNode : SyntaxNode - { - return SyntaxReplacer.Replace(this, nodes, computeReplacementNode); - } - - protected internal SyntaxNode ReplaceNodeInListCore(SyntaxNode originalNode, IEnumerable replacementNodes) - { - return SyntaxReplacer.ReplaceNodeInList(this, originalNode, replacementNodes); - } - - protected internal SyntaxNode InsertNodesInListCore(SyntaxNode nodeInList, IEnumerable nodesToInsert, bool insertBefore) - { - return SyntaxReplacer.InsertNodeInList(this, nodeInList, nodesToInsert, insertBefore); - } + Func? computeReplacementNode = null, + IEnumerable? tokens = null, + Func? computeReplacementToken = null) + where TNode : SyntaxNode; + + protected internal abstract SyntaxNode ReplaceNodeInListCore(SyntaxNode originalNode, IEnumerable replacementNodes); + protected internal abstract SyntaxNode InsertNodesInListCore(SyntaxNode nodeInList, IEnumerable nodesToInsert, bool insertBefore); + protected internal abstract SyntaxNode ReplaceTokenInListCore(SyntaxToken originalToken, IEnumerable newTokens); + protected internal abstract SyntaxNode InsertTokensInListCore(SyntaxToken originalToken, IEnumerable newTokens, bool insertBefore); public RazorDiagnostic[] GetDiagnostics() { diff --git a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxNodeExtensions.cs b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxNodeExtensions.cs index 2aa9d639f9d..098305ef3a0 100644 --- a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxNodeExtensions.cs +++ b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxNodeExtensions.cs @@ -120,11 +120,14 @@ public static SourceSpan GetSourceSpan(this SyntaxNode node, RazorSourceDocument public static TRoot ReplaceSyntax( this TRoot root, IEnumerable nodes, - Func computeReplacementNode) + Func computeReplacementNode, + IEnumerable tokens, + Func computeReplacementToken) where TRoot : SyntaxNode { return (TRoot)root.ReplaceCore( - nodes: nodes, computeReplacementNode: computeReplacementNode); + nodes: nodes, computeReplacementNode: computeReplacementNode, + tokens: tokens, computeReplacementToken: computeReplacementToken); } /// @@ -175,6 +178,35 @@ public static TRoot ReplaceNode(this TRoot root, SyntaxNode oldNode, IEnu return (TRoot)root.ReplaceNodeInListCore(oldNode, newNodes); } + /// + /// Creates a new tree of nodes with the specified old node replaced with a new node. + /// + /// The type of the root node. + /// The root node of the tree of nodes. + /// The token to be replaced; descendants of the root node. + /// A function that computes a replacement token for + /// the argument tokens. The first argument is the original token. The second argument is + /// the same token potentially rewritten with replaced trivia. + public static TRoot ReplaceTokens(this TRoot root, IEnumerable tokens, Func computeReplacementToken) + where TRoot : SyntaxNode + { + return (TRoot)root.ReplaceCore(tokens: tokens, computeReplacementToken: computeReplacementToken); + } + + /// + /// Creates a new tree of nodes with the specified old token replaced with a new token. + /// + /// The type of the root node. + /// The root node of the tree of nodes. + /// The token to be replaced. + /// The new token to use in the new tree in place of the old + /// token. + public static TRoot ReplaceToken(this TRoot root, SyntaxToken oldToken, SyntaxToken newToken) + where TRoot : SyntaxNode + { + return (TRoot)root.ReplaceCore(tokens: [oldToken], computeReplacementToken: (o, r) => newToken); + } + /// /// Creates a new tree of nodes with new nodes inserted before the specified node. /// @@ -225,5 +257,17 @@ public override void Visit(SyntaxNode node) base.Visit(node); } } + + public override void VisitToken(SyntaxToken token) + { + if (token.ContainsDiagnostics == true) + { + var diagnostics = token.GetDiagnostics(); + + _diagnostics.AddRange(diagnostics); + + base.VisitToken(token); + } + } } } diff --git a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxReplacer.cs b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxReplacer.cs index 20b2304c9df..e6ce05481cf 100644 --- a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxReplacer.cs +++ b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxReplacer.cs @@ -1,10 +1,9 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#nullable disable - using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using Microsoft.CodeAnalysis.Text; @@ -14,11 +13,13 @@ internal static class SyntaxReplacer { internal static SyntaxNode Replace( SyntaxNode root, - IEnumerable nodes = null, - Func computeReplacementNode = null) + IEnumerable? nodes = null, + Func? computeReplacementNode = null, + IEnumerable? tokens = null, + Func? computeReplacementToken = null) where TNode : SyntaxNode { - var replacer = new Replacer(nodes, computeReplacementNode); + var replacer = new Replacer(nodes, computeReplacementNode, tokens, computeReplacementToken); if (replacer.HasWork) { @@ -30,60 +31,75 @@ internal static SyntaxNode Replace( } } - internal static SyntaxNode ReplaceNodeInList(SyntaxNode root, SyntaxNode originalNode, IEnumerable newNodes) + internal static SyntaxToken Replace( + SyntaxToken root, + IEnumerable? nodes = null, + Func? computeReplacementNode = null, + IEnumerable? tokens = null, + Func? computeReplacementToken = null) { - return new NodeListEditor(originalNode, newNodes, ListEditKind.Replace).Visit(root); - } + var replacer = new Replacer(nodes, computeReplacementNode, tokens, computeReplacementToken); - internal static SyntaxNode InsertNodeInList(SyntaxNode root, SyntaxNode nodeInList, IEnumerable nodesToInsert, bool insertBefore) - { - return new NodeListEditor(nodeInList, nodesToInsert, insertBefore ? ListEditKind.InsertBefore : ListEditKind.InsertAfter).Visit(root); + if (replacer.HasWork) + { + return replacer.VisitToken(root); + } + else + { + return root; + } } - private class Replacer : SyntaxRewriter where TNode : SyntaxNode + private sealed class Replacer : SyntaxRewriter where TNode : SyntaxNode { - private readonly Func _computeReplacementNode; + private static readonly HashSet s_noNodes = []; + private static readonly HashSet s_noTokens = []; + + private readonly Func? _computeReplacementNode; + private readonly Func? _computeReplacementToken; + private readonly HashSet _nodeSet; + private readonly HashSet _tokenSet; private readonly HashSet _spanSet; - private readonly TextSpan _totalSpan; - public Replacer(IEnumerable nodes, Func computeReplacementNode) + private TextSpan _totalSpan; + + public Replacer( + IEnumerable? nodes = null, + Func? computeReplacementNode = null, + IEnumerable? tokens = null, + Func? computeReplacementToken = null) { _computeReplacementNode = computeReplacementNode; - _nodeSet = nodes != null ? new HashSet(nodes) : new HashSet(); - _spanSet = new HashSet(_nodeSet.Select(n => n.Span)); - _totalSpan = ComputeTotalSpan(_spanSet); + _computeReplacementToken = computeReplacementToken; + + _nodeSet = nodes != null ? [.. nodes] : s_noNodes; + _tokenSet = tokens != null ? [.. tokens] : s_noTokens; + + _spanSet = []; + CalculateVisitationCriteria(); } - public bool HasWork => _nodeSet.Count > 0; + public bool HasWork => _nodeSet.Count + _tokenSet.Count > 0; - public override SyntaxNode Visit(SyntaxNode node) + private void CalculateVisitationCriteria() { - var rewritten = node; - - if (node != null) + _spanSet.Clear(); + foreach (var node in _nodeSet) { - if (ShouldVisit(node.Span)) - { - rewritten = base.Visit(node); - } - - if (_nodeSet.Contains(node) && _computeReplacementNode != null) - { - rewritten = _computeReplacementNode((TNode)node, (TNode)rewritten); - } + _spanSet.Add(node.Span); } - return rewritten; - } + foreach (var token in _tokenSet) + { + _spanSet.Add(token.Span); + } - private static TextSpan ComputeTotalSpan(IEnumerable spans) - { var first = true; var start = 0; var end = 0; - foreach (var span in spans) + foreach (var span in _spanSet) { if (first) { @@ -98,7 +114,7 @@ private static TextSpan ComputeTotalSpan(IEnumerable spans) } } - return new TextSpan(start, end - start); + _totalSpan = new TextSpan(start, end - start); } private bool ShouldVisit(TextSpan span) @@ -123,24 +139,101 @@ private bool ShouldVisit(TextSpan span) return false; } + + [return: NotNullIfNotNull(nameof(node))] + public override SyntaxNode? Visit(SyntaxNode? node) + { + var rewritten = node; + + if (node != null) + { + var isReplacedNode = _nodeSet.Remove(node); + + if (isReplacedNode) + { + // If node is in _nodeSet, then it contributed to the calculation of _spanSet. + // We are currently processing that node, so it no longer needs to contribute + // to _spanSet and affect determination of inward visitation. This is done before + // calling ShouldVisit to avoid walking into the node if there aren't any remaining + // spans inside it representing items to replace. + CalculateVisitationCriteria(); + } + + if (ShouldVisit(node.Span)) + { + rewritten = base.Visit(node); + } + + if (isReplacedNode && _computeReplacementNode != null) + { + rewritten = _computeReplacementNode((TNode)node, (TNode)rewritten!); + } + } + + return rewritten; + } + + public override SyntaxToken VisitToken(SyntaxToken token) + { + var rewritten = token; + var isReplacedToken = _tokenSet.Remove(token); + + if (isReplacedToken) + { + // If token is in _tokenSet, then it contributed to the calculation of _spanSet. + // We are currently processing that token, so it no longer needs to contribute + // to _spanSet and affect determination of inward visitation. This is done before + // calling ShouldVisit to avoid walking into the token if there aren't any remaining + // spans inside it representing items to replace. + CalculateVisitationCriteria(); + } + + if (isReplacedToken && _computeReplacementToken != null) + { + rewritten = _computeReplacementToken(token, rewritten); + } + + return rewritten; + } + } + + internal static SyntaxNode ReplaceNodeInList(SyntaxNode root, SyntaxNode originalNode, IEnumerable newNodes) + { + return new NodeListEditor(originalNode, newNodes, ListEditKind.Replace).Visit(root); + } + + internal static SyntaxNode InsertNodeInList(SyntaxNode root, SyntaxNode nodeInList, IEnumerable nodesToInsert, bool insertBefore) + { + return new NodeListEditor(nodeInList, nodesToInsert, insertBefore ? ListEditKind.InsertBefore : ListEditKind.InsertAfter).Visit(root); } - private class NodeListEditor : SyntaxRewriter + public static SyntaxNode ReplaceTokenInList(SyntaxNode root, SyntaxToken tokenInList, IEnumerable newTokens) + { + return new TokenListEditor(tokenInList, newTokens, ListEditKind.Replace).Visit(root); + } + + public static SyntaxNode InsertTokenInList(SyntaxNode root, SyntaxToken tokenInList, IEnumerable newTokens, bool insertBefore) + { + return new TokenListEditor(tokenInList, newTokens, insertBefore ? ListEditKind.InsertBefore : ListEditKind.InsertAfter).Visit(root); + } + + private enum ListEditKind + { + InsertBefore, + InsertAfter, + Replace + } + + private abstract class BaseListEditor : SyntaxRewriter { private readonly TextSpan _elementSpan; - private readonly SyntaxNode _originalNode; - private readonly IEnumerable _newNodes; - private readonly ListEditKind _editKind; - public NodeListEditor( - SyntaxNode originalNode, - IEnumerable replacementNodes, - ListEditKind editKind) + protected readonly ListEditKind EditKind; + + protected BaseListEditor(TextSpan elementSpan, ListEditKind editKind) { - _elementSpan = originalNode.Span; - _originalNode = originalNode; - _newNodes = replacementNodes; - _editKind = editKind; + _elementSpan = elementSpan; + EditKind = editKind; } private bool ShouldVisit(TextSpan span) @@ -155,14 +248,10 @@ private bool ShouldVisit(TextSpan span) return false; } - public override SyntaxNode Visit(SyntaxNode node) + [return: NotNullIfNotNull(nameof(node))] + public override SyntaxNode? Visit(SyntaxNode? node) { - if (node == _originalNode) - { - throw new InvalidOperationException("Expecting a list"); - } - - var rewritten = node; + SyntaxNode? rewritten = node; if (node != null) { @@ -174,6 +263,33 @@ public override SyntaxNode Visit(SyntaxNode node) return rewritten; } + } + + private sealed class NodeListEditor : BaseListEditor + { + private readonly SyntaxNode _originalNode; + private readonly IEnumerable _newNodes; + + public NodeListEditor( + SyntaxNode originalNode, + IEnumerable replacementNodes, + ListEditKind editKind) + : base(originalNode.Span, editKind) + { + _originalNode = originalNode; + _newNodes = replacementNodes; + } + + [return: NotNullIfNotNull(nameof(node))] + public override SyntaxNode? Visit(SyntaxNode? node) + { + if (node == _originalNode) + { + throw new InvalidOperationException("Expecting a list"); + } + + return base.Visit(node); + } public override SyntaxList VisitList(SyntaxList list) { @@ -182,7 +298,7 @@ public override SyntaxList VisitList(SyntaxList list) var index = list.IndexOf((TNode)_originalNode); if (index >= 0 && index < list.Count) { - switch (_editKind) + switch (EditKind) { case ListEditKind.Replace: return list.ReplaceRange((TNode)_originalNode, _newNodes.Cast()); @@ -196,14 +312,54 @@ public override SyntaxList VisitList(SyntaxList list) } } - return base.VisitList(list); + return base.VisitList(list); } } - private enum ListEditKind + private class TokenListEditor : BaseListEditor { - InsertBefore, - InsertAfter, - Replace + private readonly SyntaxToken _originalToken; + private readonly IEnumerable _newTokens; + + public TokenListEditor( + SyntaxToken originalToken, + IEnumerable newTokens, + ListEditKind editKind) + : base(originalToken.Span, editKind) + { + _originalToken = originalToken; + _newTokens = newTokens; + } + + public override SyntaxToken VisitToken(SyntaxToken token) + { + if (token == _originalToken) + { + throw new InvalidOperationException("Expecting a list"); + } + + return base.VisitToken(token); + } + + public override SyntaxList VisitList(SyntaxList list) + { + var index = list.IndexOf(_originalToken); + if (index >= 0 && index < list.Count) + { + switch (EditKind) + { + case ListEditKind.Replace: + return list.ReplaceRange(_originalToken, _newTokens); + + case ListEditKind.InsertAfter: + return list.InsertRange(index + 1, _newTokens); + + case ListEditKind.InsertBefore: + return list.InsertRange(index, _newTokens); + } + } + + return base.VisitList(list); + } } } diff --git a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxRewriter.cs b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxRewriter.cs index 9ad1a77e468..7604f7902aa 100644 --- a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxRewriter.cs +++ b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxRewriter.cs @@ -1,8 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#nullable disable - +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using Microsoft.AspNetCore.Razor.PooledObjects; namespace Microsoft.AspNetCore.Razor.Language.Syntax; @@ -11,17 +11,21 @@ internal abstract partial class SyntaxRewriter : SyntaxVisitor { private int _recursionDepth; - public override SyntaxNode Visit(SyntaxNode node) + [return: NotNullIfNotNull(nameof(node))] + public override SyntaxNode? Visit(SyntaxNode? node) { if (node != null) { + Debug.Assert(!node.IsToken); + Debug.Assert(!node.IsList); + _recursionDepth++; StackGuard.EnsureSufficientExecutionStack(_recursionDepth); - var result = node.Accept(this); + var result = ((RazorSyntaxNode)node).Accept(this); _recursionDepth--; - return result; + return result!; } else { @@ -29,8 +33,13 @@ public override SyntaxNode Visit(SyntaxNode node) } } + public virtual SyntaxToken VisitToken(SyntaxToken token) + { + return token; + } + public virtual SyntaxList VisitList(SyntaxList list) - where TNode : SyntaxNode + where TNode : RazorSyntaxNode { var count = list.Count; if (count == 0) @@ -70,13 +79,49 @@ public virtual SyntaxList VisitList(SyntaxList list) : list; } - public override SyntaxNode VisitToken(SyntaxToken token) + public virtual TNode? VisitListElement(TNode? node) + where TNode : RazorSyntaxNode { - return token; + return (TNode?)Visit(node); } - public virtual TNode VisitListElement(TNode node) where TNode : SyntaxNode + public virtual SyntaxList VisitList(SyntaxList list) { - return (TNode)(SyntaxNode)Visit(node); + var count = list.Count; + if (count == 0) + { + return list; + } + + using PooledArrayBuilder builder = []; + + var isUpdating = false; + + for (var i = 0; i < count; i++) + { + var item = list[i]; + + var visited = VisitToken(item); + + if (item != visited && !isUpdating) + { + // The list is being updated, so we need to initialize the builder + // add the items we've seen so far. + builder.SetCapacityIfLarger(count); + + builder.AddRange(list, index: 0, count: i); + + isUpdating = true; + } + + if (isUpdating && visited != null && visited.Kind != SyntaxKind.None) + { + builder.Add(visited); + } + } + + return isUpdating + ? builder.ToList() + : list; } } diff --git a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxSerializer.cs b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxSerializer.cs index 531be95fc2a..290e094b080 100644 --- a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxSerializer.cs +++ b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxSerializer.cs @@ -1,323 +1,248 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#nullable disable - using System; using System.Collections.Generic; -using System.IO; using System.Linq; using System.Text; using Microsoft.AspNetCore.Razor.Language.Legacy; +using Microsoft.CodeAnalysis.Text; namespace Microsoft.AspNetCore.Razor.Language.Syntax; -internal class SyntaxSerializer +internal abstract class SyntaxSerializer(StringBuilder builder) : SyntaxWalker { - internal static string Serialize(SyntaxNode node) - { - using (var writer = new StringWriter()) - { - var walker = new Walker(writer); - walker.Visit(node); + protected const int IndentSize = 4; + protected const string Separator = " - "; - return writer.ToString(); - } - } + protected readonly StringBuilder Builder = builder; + private bool _visitedRoot; - private class Walker : SyntaxWalker - { - private readonly SyntaxWriter _visitor; - private readonly TextWriter _writer; + private int _depth; - public Walker(TextWriter writer) + public sealed override void Visit(SyntaxNode? node) + { + if (node == null) { - _visitor = new SyntaxWriter(writer); - _writer = writer; + return; } - public TextWriter Writer { get; } + WriteNode(node); + Builder.AppendLine(); - public override SyntaxNode Visit(SyntaxNode node) - { - if (node == null) - { - return node; - } - - if (node.IsList) - { - return base.DefaultVisit(node); - } - - _visitor.Visit(node); - _writer.WriteLine(); - - if (!node.IsToken) - { - _visitor.Depth++; - node = base.DefaultVisit(node); - _visitor.Depth--; - } - - return node; - } + IncreaseIndent(); + base.Visit(node); + DecreaseIndent(); } - private class SyntaxWalker : SyntaxRewriter + public sealed override void VisitToken(SyntaxToken token) { - private readonly List _ancestors = new List(); - - protected IReadOnlyList Ancestors => _ancestors; - - protected SyntaxNode Parent => _ancestors.Count > 0 ? _ancestors[0] : null; - - protected override SyntaxNode DefaultVisit(SyntaxNode node) - { - _ancestors.Insert(0, node); - - try - { - for (var i = 0; i < node.SlotCount; i++) - { - var child = node.GetNodeSlot(i); - Visit(child); - } - } - finally - { - _ancestors.RemoveAt(0); - } - - return node; - } + WriteToken(token); + Builder.AppendLine(); } - private class SyntaxWriter : SyntaxRewriter + private void WriteNode(SyntaxNode node) { - private readonly TextWriter _writer; - private bool _visitedRoot; - - public SyntaxWriter(TextWriter writer) - { - _writer = writer; - } - - public int Depth { get; set; } - - public override SyntaxNode Visit(SyntaxNode node) - { - if (node is SyntaxToken token) - { - return VisitToken(token); - } - - WriteNode(node); - return node; - } - - public override SyntaxNode VisitToken(SyntaxToken token) - { - WriteToken(token); - return base.VisitToken(token); - } + WriteIndent(); + WriteValue(node.Kind); + WriteSeparator(); + WriteSpan(node.Span); - private void WriteNode(SyntaxNode node) + switch (node) { - WriteIndent(); - Write(node.Kind); - WriteSeparator(); - Write($"[{node.Position}..{node.EndPosition})"); - WriteSeparator(); - Write($"Width: {node.Width}"); - - if (node is RazorDirectiveSyntax razorDirective) - { + case RazorDirectiveSyntax razorDirective: WriteRazorDirective(razorDirective); - } - else if (node is MarkupTagHelperElementSyntax tagHelperElement) - { + break; + + case MarkupTagHelperElementSyntax tagHelperElement: WriteTagHelperElement(tagHelperElement); - } - else if (node is MarkupTagHelperAttributeSyntax tagHelperAttribute) - { + break; + + case MarkupTagHelperAttributeSyntax tagHelperAttribute: WriteTagHelperAttributeInfo(tagHelperAttribute.TagHelperAttributeInfo); - } - else if (node is MarkupMinimizedTagHelperAttributeSyntax minimizedTagHelperAttribute) - { + break; + + case MarkupMinimizedTagHelperAttributeSyntax minimizedTagHelperAttribute: WriteTagHelperAttributeInfo(minimizedTagHelperAttribute.TagHelperAttributeInfo); - } - else if (node is MarkupStartTagSyntax startTag) - { + break; + + case MarkupStartTagSyntax startTag: if (startTag.IsMarkupTransition) { WriteSeparator(); - Write("MarkupTransition"); + WriteValue("MarkupTransition"); } - } - else if (node is MarkupEndTagSyntax endTag) - { + + break; + + case MarkupEndTagSyntax endTag: if (endTag.IsMarkupTransition) { WriteSeparator(); - Write("MarkupTransition"); + WriteValue("MarkupTransition"); } - } - - if (ShouldDisplayNodeContent(node)) - { - WriteSeparator(); - Write($"[{node.GetContent()}]"); - } - - WriteChunkGenerator(node); - - var annotation = node.GetAnnotations().FirstOrDefault(a => a.Kind == SyntaxConstants.EditHandlerKind); - if (annotation != null && annotation.Data is SpanEditHandler handler) - { - WriteEditHandler(handler); - } - - if (!_visitedRoot) - { - WriteSeparator(); - Write($"[{node}]"); - _visitedRoot = true; - } - } - - private void WriteRazorDirective(RazorDirectiveSyntax node) - { - if (node.DirectiveDescriptor == null) - { - return; - } - - var builder = new StringBuilder("Directive:{"); - builder.Append(node.DirectiveDescriptor.Directive); - builder.Append(';'); - builder.Append(node.DirectiveDescriptor.Kind); - builder.Append(';'); - builder.Append(node.DirectiveDescriptor.Usage); - builder.Append('}'); - - var diagnostics = node.GetDiagnostics(); - if (diagnostics.Length > 0) - { - builder.Append(" ["); - var ids = string.Join(", ", diagnostics.Select(diagnostic => $"{diagnostic.Id}{diagnostic.Span}")); - builder.Append(ids); - builder.Append(']'); - } - WriteSeparator(); - Write(builder.ToString()); + break; } - private void WriteTagHelperElement(MarkupTagHelperElementSyntax node) + if (ShouldDisplayNodeContent(node)) { - // Write tag name WriteSeparator(); - Write($"{node.TagHelperInfo.TagName}[{node.TagHelperInfo.TagMode}]"); + WriteValue($"[{node.GetContent()}]"); + } - // Write descriptors - foreach (var descriptor in node.TagHelperInfo.BindingResult.Descriptors) - { - WriteSeparator(); + WriteChunkGenerator(node); - // Get the type name without the namespace. - var typeName = descriptor.Name.Substring(descriptor.Name.LastIndexOf('.') + 1); - Write(typeName); - } - } + WriteSpanEditHandlers(node); - private void WriteTagHelperAttributeInfo(TagHelperAttributeInfo info) + if (!_visitedRoot) { - // Write attributes WriteSeparator(); - Write(info.Name); - WriteSeparator(); - Write(info.AttributeStructure); - WriteSeparator(); - Write(info.Bound ? "Bound" : "Unbound"); + WriteValue($"[{node}]"); + _visitedRoot = true; } + } + + protected virtual void WriteSpan(TextSpan span) + { + WriteValue($"[{span.Start}..{span.End}{Separator}Width: {span.End - span.Start}"); + } - private void WriteToken(SyntaxToken token) + private void WriteRazorDirective(RazorDirectiveSyntax node) + { + if (node.DirectiveDescriptor is not { } descriptor) { - WriteIndent(); - var content = token.IsMissing ? "" : token.Content; - var diagnostics = token.GetDiagnostics(); - var tokenString = $"{token.Kind};[{content}];{string.Join(", ", diagnostics.Select(diagnostic => diagnostic.Id + diagnostic.Span))}"; - Write(tokenString); + return; } - private void WriteChunkGenerator(SyntaxNode node) + WriteSeparator(); + WriteValue($"Directive:{{{descriptor.Directive};{descriptor.Kind};{descriptor.Usage}}}"); + + if (node.GetDiagnostics() is { Length: > 0} diagnostics) { - var generator = node.GetChunkGenerator(); - if (generator != null) - { - WriteSeparator(); - Write($"Gen<{generator}>"); - } + WriteValue($" [{GetDiagnosticsText(diagnostics)}]"); } + } - private void WriteEditHandler(SpanEditHandler handler) + private void WriteTagHelperElement(MarkupTagHelperElementSyntax node) + { + var tagHelperInfo = node.TagHelperInfo.AssumeNotNull(); + + // Write tag name + WriteSeparator(); + WriteValue($"{tagHelperInfo.TagName}[{tagHelperInfo.TagMode}]"); + + // Write descriptors + foreach (var descriptor in tagHelperInfo.BindingResult.Descriptors) { WriteSeparator(); - Write(handler); - } - protected void WriteIndent() - { - for (var i = 0; i < Depth; i++) - { - for (var j = 0; j < 4; j++) - { - Write(' '); - } - } + // Get the type name without the namespace. + var typeName = descriptor.Name[(descriptor.Name.LastIndexOf('.') + 1)..]; + WriteValue(typeName); } + } - protected void WriteSeparator() - { - Write(" - "); - } + private void WriteTagHelperAttributeInfo(TagHelperAttributeInfo info) + { + // Write attributes + WriteValue($"{Separator}{info.Name}{Separator}{info.AttributeStructure}{Separator}{(info.Bound ? "Bound" : "Unbound")}"); + } + + private void WriteToken(SyntaxToken token) + { + WriteIndent(); + + var content = token.IsMissing ? "" : token.Content; + var diagnostics = token.GetDiagnostics(); + var diagnosticsText = GetDiagnosticsText(diagnostics); + + WriteValue($"{token.Kind};[{content}];{diagnosticsText}"); + } + + private static string GetDiagnosticsText(RazorDiagnostic[] diagnostics) + { + return diagnostics.Length > 0 + ? string.Join(", ", diagnostics.Select(diagnostic => $"{diagnostic.Id}{diagnostic.Span}")) + : string.Empty; + } - protected void WriteNewLine() + private void WriteChunkGenerator(SyntaxNode node) + { + if (node.GetChunkGenerator() is { } generator) { - _writer.WriteLine(); + WriteSeparator(); + WriteValue($"Gen<{generator}>"); } + } - protected void Write(object value) + protected virtual void WriteSpanEditHandlers(SyntaxNode node) + { + var annotation = node.GetAnnotations().FirstOrDefault(a => a.Kind == SyntaxConstants.EditHandlerKind); + if (annotation?.Data is SpanEditHandler handler) { - if (value is string stringValue) - { - stringValue = stringValue.Replace(Environment.NewLine, "LF"); - _writer.Write(stringValue); - return; - } - - _writer.Write(value); + WriteSeparator(); + WriteValue(handler); } + } + + protected void IncreaseIndent() + { + _depth++; + } + + protected void DecreaseIndent() + { + Assumed.True(--_depth >= 0, "Depth can't be less than 0."); + } + + protected void WriteIndent() + { + WriteValue(new string(' ', _depth * IndentSize)); + } + + protected void WriteSeparator() + { + WriteValue(Separator); + } + + protected virtual void WriteValue(string value) + { + Builder.Append(value.Replace(Environment.NewLine, "LF")); + } - private static bool ShouldDisplayNodeContent(SyntaxNode node) + protected virtual void WriteValue(object? value) + { + switch (value) { - return node.Kind == SyntaxKind.MarkupTextLiteral || - node.Kind == SyntaxKind.MarkupEphemeralTextLiteral || - node.Kind == SyntaxKind.MarkupStartTag || - node.Kind == SyntaxKind.MarkupEndTag || - node.Kind == SyntaxKind.MarkupTagHelperStartTag || - node.Kind == SyntaxKind.MarkupTagHelperEndTag || - node.Kind == SyntaxKind.MarkupAttributeBlock || - node.Kind == SyntaxKind.MarkupMinimizedAttributeBlock || - node.Kind == SyntaxKind.MarkupTagHelperAttribute || - node.Kind == SyntaxKind.MarkupMinimizedTagHelperAttribute || - node.Kind == SyntaxKind.MarkupLiteralAttributeValue || - node.Kind == SyntaxKind.MarkupDynamicAttributeValue || - node.Kind == SyntaxKind.CSharpStatementLiteral || - node.Kind == SyntaxKind.CSharpExpressionLiteral || - node.Kind == SyntaxKind.CSharpEphemeralTextLiteral || - node.Kind == SyntaxKind.UnclassifiedTextLiteral; + case string s: + WriteValue(s); + break; + + default: + Builder.Append(value); + break; } } + + private static bool ShouldDisplayNodeContent(SyntaxNode node) + { + return node.Kind is + SyntaxKind.MarkupTextLiteral or + SyntaxKind.MarkupEphemeralTextLiteral or + SyntaxKind.MarkupStartTag or + SyntaxKind.MarkupEndTag or + SyntaxKind.MarkupTagHelperStartTag or + SyntaxKind.MarkupTagHelperEndTag or + SyntaxKind.MarkupAttributeBlock or + SyntaxKind.MarkupMinimizedAttributeBlock or + SyntaxKind.MarkupTagHelperAttribute or + SyntaxKind.MarkupMinimizedTagHelperAttribute or + SyntaxKind.MarkupLiteralAttributeValue or + SyntaxKind.MarkupDynamicAttributeValue or + SyntaxKind.CSharpStatementLiteral or + SyntaxKind.CSharpExpressionLiteral or + SyntaxKind.CSharpEphemeralTextLiteral or + SyntaxKind.UnclassifiedTextLiteral; + } } diff --git a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxToken.cs b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxToken.cs index 27c62c0c0b4..001c940e137 100644 --- a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxToken.cs +++ b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxToken.cs @@ -1,13 +1,12 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#nullable disable - using System; +using System.Collections.Generic; namespace Microsoft.AspNetCore.Razor.Language.Syntax; -internal class SyntaxToken : RazorSyntaxNode +internal class SyntaxToken : SyntaxNode { internal static readonly Func NonZeroWidth = t => t.Width > 0; internal static readonly Func Any = t => true; @@ -17,6 +16,8 @@ internal SyntaxToken(GreenNode green, SyntaxNode parent, int position) { } + internal override string SerializedValue => Serializer.Serialize(this); + internal new InternalSyntax.SyntaxToken Green => (InternalSyntax.SyntaxToken)base.Green; public string Content => Green.Content; @@ -31,21 +32,30 @@ internal sealed override SyntaxNode GetNodeSlot(int slot) throw new InvalidOperationException("Tokens can't have slots."); } - public override TResult Accept(SyntaxVisitor visitor) - { - return visitor.VisitToken(this); - } + protected internal override SyntaxNode ReplaceCore( + IEnumerable? nodes = null, + Func? computeReplacementNode = null, + IEnumerable? tokens = null, + Func? computeReplacementToken = null) + => Assumed.Unreachable(); - public override void Accept(SyntaxVisitor visitor) - { - visitor.VisitToken(this); - } + protected internal override SyntaxNode ReplaceNodeInListCore(SyntaxNode originalNode, IEnumerable replacementNodes) + => Assumed.Unreachable(); + + protected internal override SyntaxNode InsertNodesInListCore(SyntaxNode nodeInList, IEnumerable nodesToInsert, bool insertBefore) + => Assumed.Unreachable(); + + protected internal override SyntaxNode ReplaceTokenInListCore(SyntaxToken originalToken, IEnumerable newTokens) + => Assumed.Unreachable(); + + protected internal override SyntaxNode InsertTokensInListCore(SyntaxToken originalToken, IEnumerable newTokens, bool insertBefore) + => Assumed.Unreachable(); /// /// Gets the token that follows this token in the syntax tree. /// /// The token that follows this token in the syntax tree. - public SyntaxToken GetNextToken(bool includeZeroWidth = false) + public SyntaxToken? GetNextToken(bool includeZeroWidth = false) { return SyntaxNavigator.GetNextToken(this, includeZeroWidth); } @@ -54,7 +64,7 @@ public SyntaxToken GetNextToken(bool includeZeroWidth = false) /// Gets the token that precedes this token in the syntax tree. /// /// The previous token that precedes this token in the syntax tree. - public SyntaxToken GetPreviousToken(bool includeZeroWidth = false) + public SyntaxToken? GetPreviousToken(bool includeZeroWidth = false) { return SyntaxNavigator.GetPreviousToken(this, includeZeroWidth); } diff --git a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxVisitor.cs b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxVisitor.cs index 5433eea93a0..82bd15fced4 100644 --- a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxVisitor.cs +++ b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxVisitor.cs @@ -1,61 +1,62 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#nullable disable +using System.Diagnostics; namespace Microsoft.AspNetCore.Razor.Language.Syntax; /// -/// Represents a visitor that visits only the single SyntaxNode -/// passed into its Visit method and produces -/// a value of the type specified by the parameter. +/// Represents a visitor that visits only the single +/// RazorSyntaxNode passed into its Visit method and produces a value of the type +/// specified by the parameter. /// /// -/// The type of the return value this visitor's Visit method. +/// The type of the return value this visitor's Visit method. /// internal abstract partial class SyntaxVisitor { - public virtual TResult Visit(SyntaxNode node) + public virtual TResult? Visit(SyntaxNode? node) { if (node != null) { - return node.Accept(this); + Debug.Assert(!node.IsToken); + Debug.Assert(!node.IsList); + + return ((RazorSyntaxNode)node).Accept(this); } - return default(TResult); + return default; } - public virtual TResult VisitToken(SyntaxToken token) + protected virtual TResult? DefaultVisit(SyntaxNode node) { - return DefaultVisit(token); - } + Debug.Assert(!node.IsToken); + Debug.Assert(!node.IsList); - protected virtual TResult DefaultVisit(SyntaxNode node) - { - return default(TResult); + return default; } } /// -/// Represents a visitor that visits only the single SyntaxNode -/// passed into its Visit method. +/// Represents a visitor that visits only the single +/// RazorSyntaxNode passed into its Visit method. /// internal abstract partial class SyntaxVisitor { - public virtual void Visit(SyntaxNode node) + public virtual void Visit(SyntaxNode? node) { if (node != null) { - node.Accept(this); - } - } + Debug.Assert(!node.IsToken); + Debug.Assert(!node.IsList); - public virtual void VisitToken(SyntaxToken token) - { - DefaultVisit(token); + ((RazorSyntaxNode)node).Accept(this); + } } public virtual void DefaultVisit(SyntaxNode node) { + Debug.Assert(!node.IsToken); + Debug.Assert(!node.IsList); } } diff --git a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxWalker.cs b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxWalker.cs index 759905aef46..2993754640c 100644 --- a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxWalker.cs +++ b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Syntax/SyntaxWalker.cs @@ -1,9 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#nullable disable - -using Microsoft.CodeAnalysis.Text; +using System.Diagnostics; namespace Microsoft.AspNetCore.Razor.Language.Syntax; @@ -16,21 +14,18 @@ namespace Microsoft.AspNetCore.Razor.Language.Syntax; internal abstract class SyntaxWalker : SyntaxVisitor { private int _recursionDepth; - private readonly TextSpan? _range; - - public SyntaxWalker(TextSpan? range = null) - { - _range = range; - } - public override void Visit(SyntaxNode node) + public override void Visit(SyntaxNode? node) { - if (node != null && (_range is null || _range.Value.OverlapsWith(node.Span))) + if (node != null) { + Debug.Assert(!node.IsToken); + Debug.Assert(!node.IsList); + _recursionDepth++; StackGuard.EnsureSufficientExecutionStack(_recursionDepth); - node.Accept(this); + ((RazorSyntaxNode)node).Accept(this); _recursionDepth--; } @@ -38,15 +33,23 @@ public override void Visit(SyntaxNode node) public override void DefaultVisit(SyntaxNode node) { - var children = node.ChildNodes(); - for (var i = 0; i < children.Count; i++) - { - var child = children[i]; + Debug.Assert(!node.IsToken); + Debug.Assert(!node.IsList); - if (_range is null || _range.Value.OverlapsWith(node.Span)) + foreach (var child in node.ChildNodes()) + { + if (child is SyntaxToken token) + { + VisitToken(token); + } + else { Visit(child); } } } + + public virtual void VisitToken(SyntaxToken token) + { + } } diff --git a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/TagHelperDescriptor.cs b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/TagHelperDescriptor.cs index 6ebaf55c66d..dd290b221df 100644 --- a/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/TagHelperDescriptor.cs +++ b/src/razor/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/TagHelperDescriptor.cs @@ -173,35 +173,35 @@ static ImmutableArray GetEditorRequiredAttributes(Immu } public IEnumerable GetAllDiagnostics() + { + using var diagnostics = new PooledArrayBuilder(); + + AppendAllDiagnostics(ref diagnostics.AsRef()); + + foreach (var diagnostic in diagnostics) + { + yield return diagnostic; + } + } + + internal void AppendAllDiagnostics(ref PooledArrayBuilder diagnostics) { foreach (var allowedChildTag in AllowedChildTags) { - foreach (var diagnostic in allowedChildTag.Diagnostics) - { - yield return diagnostic; - } + diagnostics.AddRange(allowedChildTag.Diagnostics); } foreach (var boundAttribute in BoundAttributes) { - foreach (var diagnostic in boundAttribute.Diagnostics) - { - yield return diagnostic; - } + diagnostics.AddRange(boundAttribute.Diagnostics); } foreach (var tagMatchingRule in TagMatchingRules) { - foreach (var diagnostic in tagMatchingRule.Diagnostics) - { - yield return diagnostic; - } + diagnostics.AddRange(tagMatchingRule.Diagnostics); } - foreach (var diagnostic in Diagnostics) - { - yield return diagnostic; - } + diagnostics.AddRange(Diagnostics); } public override string ToString() diff --git a/src/razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Completion/AbstractRazorCompletionFactsService.cs b/src/razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Completion/AbstractRazorCompletionFactsService.cs index d1c4924caea..f01f2eba19f 100644 --- a/src/razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Completion/AbstractRazorCompletionFactsService.cs +++ b/src/razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Completion/AbstractRazorCompletionFactsService.cs @@ -5,6 +5,7 @@ using System.Collections.Immutable; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; +using Microsoft.AspNetCore.Razor.Language.Syntax; using Microsoft.AspNetCore.Razor.PooledObjects; using Microsoft.VisualStudio.Editor.Razor; @@ -78,6 +79,16 @@ public ImmutableArray GetCompletionItems(RazorCompletionCon return previousToken2.Parent; } + // If we have @ transition right in front of an existing equals and caret is after @, e.g. + // + // we get entire attribute from FindInnermostNode. We always want the attribute name as the context in such cases, + // so we adjust it to be the attrbute name node. + if (originalNode is MarkupAttributeBlockSyntax markupAttribute + && markupAttribute.EqualsToken.SpanStart == requestIndex) + { + return markupAttribute.Name; + } + return originalNode; } } diff --git a/src/razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Completion/MarkupTransitionCompletionItemProvider.cs b/src/razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Completion/MarkupTransitionCompletionItemProvider.cs index 4278e2b8f01..848c3465fca 100644 --- a/src/razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Completion/MarkupTransitionCompletionItemProvider.cs +++ b/src/razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Completion/MarkupTransitionCompletionItemProvider.cs @@ -36,7 +36,7 @@ public ImmutableArray GetCompletionItems(RazorCompletionCon if (owner is RazorMetaCodeSyntax { SpanStart: var spanStart, MetaCode: [var metaCodeToken, ..] } && spanStart == context.AbsoluteIndex) { var previousToken = metaCodeToken.GetPreviousToken(); - owner = previousToken.Parent; + owner = previousToken!.Parent; } if (!AtMarkupTransitionCompletionPoint(owner)) diff --git a/src/razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RazorSyntaxNodeExtensions.cs b/src/razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RazorSyntaxNodeExtensions.cs index 96a04ec822a..c9a26a09dfc 100644 --- a/src/razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RazorSyntaxNodeExtensions.cs +++ b/src/razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RazorSyntaxNodeExtensions.cs @@ -232,7 +232,7 @@ public static LinePositionSpan GetLinePositionSpan(this SyntaxNode node, RazorSo token = token.GetPreviousToken(includeWhitespace); } - var foundPosition = token.Position; + var foundPosition = token!.Position; if (walkMarkersBack && token.Kind == SyntaxKind.Marker) { diff --git a/src/razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/New/CSharpFormattingPass.CSharpDocumentGenerator.cs b/src/razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/New/CSharpFormattingPass.CSharpDocumentGenerator.cs index b701b16329e..1f8578d369d 100644 --- a/src/razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/New/CSharpFormattingPass.CSharpDocumentGenerator.cs +++ b/src/razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/New/CSharpFormattingPass.CSharpDocumentGenerator.cs @@ -228,7 +228,7 @@ public void Generate() _builder.AppendLine(additionalLinesBuilder.ToString()); } - public override LineInfo Visit(RazorSyntaxNode node) + public override LineInfo Visit(RazorSyntaxNode? node) { // Sometimes we are in a block where we want to do no formatting at all if (_ignoreUntilLine is not null) diff --git a/src/razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/CompilationHelpers.cs b/src/razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/CompilationHelpers.cs index 17dbc60999d..19d42442ddf 100644 --- a/src/razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/CompilationHelpers.cs +++ b/src/razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/CompilationHelpers.cs @@ -39,7 +39,7 @@ internal static async Task GenerateDesignTimeCodeDocumentAsyn return generator.GenerateDesignTime(source, document.FileKind, importSources, tagHelpers, cancellationToken); } - private static async Task> GetImportSourcesAsync(IDocumentSnapshot document, RazorProjectEngine projectEngine, CancellationToken cancellationToken) + internal static async Task> GetImportSourcesAsync(IDocumentSnapshot document, RazorProjectEngine projectEngine, CancellationToken cancellationToken) { // We don't use document.FilePath when calling into GetItem(...) because // it could be rooted outside of the project root. document.TargetPath should @@ -74,9 +74,7 @@ private static async Task> GetImportSourcesA } else if (project.TryGetDocument(importProjectItem.PhysicalPath, out var importDocument)) { - var text = await importDocument.GetTextAsync(cancellationToken).ConfigureAwait(false); - var properties = RazorSourceDocumentProperties.Create(importProjectItem.FilePath, importProjectItem.RelativePhysicalPath); - var importSource = RazorSourceDocument.Create(text, properties); + var importSource = await importDocument.GetSourceAsync(cancellationToken).ConfigureAwait(false); importSources.Add(importSource); } diff --git a/src/razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SemanticTokens/SemanticTokensVisitor.cs b/src/razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SemanticTokens/SemanticTokensVisitor.cs index f26b3029ee7..4893c1ac88e 100644 --- a/src/razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SemanticTokens/SemanticTokensVisitor.cs +++ b/src/razor/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SemanticTokens/SemanticTokensVisitor.cs @@ -16,16 +16,17 @@ internal sealed class SemanticTokensVisitor : SyntaxWalker { private readonly ImmutableArray.Builder _semanticRanges; private readonly RazorCodeDocument _razorCodeDocument; + private readonly TextSpan _range; private readonly ISemanticTokensLegendService _semanticTokensLegend; private readonly bool _colorCodeBackground; private bool _addRazorCodeModifier; - private SemanticTokensVisitor(ImmutableArray.Builder semanticRanges, RazorCodeDocument razorCodeDocument, TextSpan? range, ISemanticTokensLegendService semanticTokensLegend, bool colorCodeBackground) - : base(range) + private SemanticTokensVisitor(ImmutableArray.Builder semanticRanges, RazorCodeDocument razorCodeDocument, TextSpan range, ISemanticTokensLegendService semanticTokensLegend, bool colorCodeBackground) { _semanticRanges = semanticRanges; _razorCodeDocument = razorCodeDocument; + _range = range; _semanticTokensLegend = semanticTokensLegend; _colorCodeBackground = colorCodeBackground; } @@ -49,6 +50,19 @@ private void Visit(SyntaxList syntaxNodes) } } + private bool IsInRange(TextSpan span) + { + return _range.OverlapsWith(span); + } + + public override void Visit(SyntaxNode? node) + { + if (node != null && IsInRange(node.Span)) + { + base.Visit(node); + } + } + #region HTML public override void VisitMarkupTextLiteral(MarkupTextLiteralSyntax node) @@ -537,6 +551,11 @@ private void AddSemanticRange(SyntaxNode node, int semanticKind) return; } + if (!IsInRange(node.Span)) + { + return; + } + var source = _razorCodeDocument.Source; var range = node.GetLinePositionSpan(source); var tokenModifier = _addRazorCodeModifier ? _semanticTokensLegend.TokenModifiers.RazorCodeModifier : 0; diff --git a/src/razor/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Language/Legacy/ToolingParserTestBase.cs b/src/razor/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Language/Legacy/ToolingParserTestBase.cs index de1dcae9e6f..2da046af94f 100644 --- a/src/razor/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Language/Legacy/ToolingParserTestBase.cs +++ b/src/razor/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Language/Legacy/ToolingParserTestBase.cs @@ -73,7 +73,7 @@ internal virtual void AssertSyntaxTreeNodeMatchesBaseline(RazorSyntaxTree syntax { // Write syntax tree baseline var baselineFullPath = Path.Combine(TestProjectRoot, baselineFileName); - File.WriteAllText(baselineFullPath, SyntaxNodeSerializer.Serialize(root, validateSpanEditHandlers: EnableSpanEditHandlers)); + File.WriteAllText(baselineFullPath, TestSyntaxSerializer.Serialize(root, allowSpanEditHandlers: EnableSpanEditHandlers)); // Write diagnostics baseline var baselineDiagnosticsFullPath = Path.Combine(TestProjectRoot, baselineDiagnosticsFileName); @@ -114,7 +114,7 @@ internal virtual void AssertSyntaxTreeNodeMatchesBaseline(RazorSyntaxTree syntax } var syntaxNodeBaseline = stFile.ReadAllText(); - var actualSyntaxNodes = SyntaxNodeSerializer.Serialize(root, validateSpanEditHandlers: EnableSpanEditHandlers); + var actualSyntaxNodes = TestSyntaxSerializer.Serialize(root, allowSpanEditHandlers: EnableSpanEditHandlers); AssertEx.AssertEqualToleratingWhitespaceDifferences(syntaxNodeBaseline, actualSyntaxNodes); // Verify diagnostics diff --git a/src/razor/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/ProjectSnapshotTest.cs b/src/razor/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/ProjectSnapshotTest.cs index 504def8d622..e6e8e93264e 100644 --- a/src/razor/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/ProjectSnapshotTest.cs +++ b/src/razor/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/ProjectSnapshotTest.cs @@ -1,9 +1,12 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. +using System.IO; using System.Linq; +using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.AspNetCore.Razor.Test.Common.ProjectSystem; using Microsoft.AspNetCore.Razor.Test.Common.Workspaces; using Xunit; using Xunit.Abstractions; @@ -92,4 +95,38 @@ public void GetRelatedDocuments_ImportDocument_ReturnsRelated() path => Assert.Equal(s_documents[0].FilePath, path), path => Assert.Equal(s_documents[1].FilePath, path)); } + + [Fact, WorkItem("https://github.com/dotnet/razor/issues/11712")] + public async Task GetImportSources_ResultsHaveCorrectFilePaths() + { + var basePath = TestPathUtilities.CreateRootedPath("my", "project", "path"); + var hostProject = TestHostProject.Create(Path.Combine(basePath, "project.csproj")); + + var importHostDocument = TestHostDocument.Create( + hostProject, + Path.Combine(basePath, "_ViewImports.cshtml")); + + var hostDocument = TestHostDocument.Create( + hostProject, + Path.Combine(basePath, "Products", "Index.cshtml")); + + var state = ProjectState + .Create(hostProject, CompilerOptions, ProjectEngineFactoryProvider) + .AddEmptyDocument(importHostDocument) + .AddEmptyDocument(hostDocument); + + var project = new ProjectSnapshot(state); + var importDocument = project.GetRequiredDocument(importHostDocument.FilePath); + var document = project.GetRequiredDocument(hostDocument.FilePath); + + var importSources = await CompilationHelpers.GetImportSourcesAsync(document, project.ProjectEngine, DisposalToken); + + // Note: The only import returned is the one we added. There aren't any default imports + // because of the ConfigureProjectEngine override above. + var importSource = Assert.Single(importSources); + + // The RazorSourceDocument for the import should use the paths from the document. + Assert.Equal(importDocument.FilePath, importSource.FilePath, FilePathComparer.Instance); + Assert.Equal(importDocument.TargetPath, importSource.RelativePath, FilePathComparer.Instance); + } } diff --git a/src/razor/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/CompletionIntegrationTests.cs b/src/razor/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/CompletionIntegrationTests.cs index 9d92641f528..01c0b7bdc23 100644 --- a/src/razor/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/CompletionIntegrationTests.cs +++ b/src/razor/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/CompletionIntegrationTests.cs @@ -142,6 +142,29 @@ private void IncrementCount() expectedSelectedItemLabel: "style"); } + [IdeFact] + public async Task CompletionCommit_BlazorDirectiveAttribute() + { + await VerifyTypeAndCommitCompletionAsync( + input: """ + @page "/test" + + Test + + + """, + output: """ + @page "/test" + + Test + + + """, + search: "