From d7ccba87c30dc59bf88683ca0121727548a6837f Mon Sep 17 00:00:00 2001 From: autoantwort <41973254+autoantwort@users.noreply.github.com> Date: Thu, 7 May 2026 02:58:01 +0200 Subject: [PATCH] msbuild: run manifest install only once (#51348) Co-authored-by: Leander Schulten Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../msbuild/support/GetGlobalProperties.task | 59 +++++++++++++++++++ .../msbuild/support/GetVcpkgEnvVars.task | 35 +++++++++++ .../support/InstallImplementation.targets | 20 +++++++ .../msbuild/support/RestoreEnvVars.task | 28 +++++++++ scripts/buildsystems/msbuild/vcpkg.targets | 33 +++++++---- 5 files changed, 162 insertions(+), 13 deletions(-) create mode 100644 scripts/buildsystems/msbuild/support/GetGlobalProperties.task create mode 100644 scripts/buildsystems/msbuild/support/GetVcpkgEnvVars.task create mode 100644 scripts/buildsystems/msbuild/support/InstallImplementation.targets create mode 100644 scripts/buildsystems/msbuild/support/RestoreEnvVars.task diff --git a/scripts/buildsystems/msbuild/support/GetGlobalProperties.task b/scripts/buildsystems/msbuild/support/GetGlobalProperties.task new file mode 100644 index 0000000000..19dfd9e2d8 --- /dev/null +++ b/scripts/buildsystems/msbuild/support/GetGlobalProperties.task @@ -0,0 +1,59 @@ + + + + + + + + + + + /// An MSBuild task that retrieves the MSBuild Global Properties. + /// + public class GetGlobalProperties : Task + { + /// + /// Initializes a new instance of the class. + /// + public GetGlobalProperties() + { + } + + /// + /// Executes the build task. + /// + /// True. + public override bool Execute() + { + IReadOnlyDictionary? globalProperties = this.BuildEngine6?.GetGlobalProperties(); + if (globalProperties is null) + { + Log.LogError("Unable to retrieve GlobalProperties"); + return false; + } + this.GlobalPropertyNames = string.Join(";", globalProperties.Keys); + return true; + } + + /// + /// Gets or sets the GlobalPropertyNames parameter. + /// + [Output] + public string GlobalPropertyNames { get; private set; } = string.Empty; + } + ]]> + + + + diff --git a/scripts/buildsystems/msbuild/support/GetVcpkgEnvVars.task b/scripts/buildsystems/msbuild/support/GetVcpkgEnvVars.task new file mode 100644 index 0000000000..9e9fdcc08c --- /dev/null +++ b/scripts/buildsystems/msbuild/support/GetVcpkgEnvVars.task @@ -0,0 +1,35 @@ + + + + + + + + + + + 0) sb.Append("____"); + sb.Append(key + "=" + val); + } + } + VcpkgEnvVars = sb.ToString(); + ]]> + + + + diff --git a/scripts/buildsystems/msbuild/support/InstallImplementation.targets b/scripts/buildsystems/msbuild/support/InstallImplementation.targets new file mode 100644 index 0000000000..65e8818e1d --- /dev/null +++ b/scripts/buildsystems/msbuild/support/InstallImplementation.targets @@ -0,0 +1,20 @@ + + + + + + + + + + + + diff --git a/scripts/buildsystems/msbuild/support/RestoreEnvVars.task b/scripts/buildsystems/msbuild/support/RestoreEnvVars.task new file mode 100644 index 0000000000..eeed916fce --- /dev/null +++ b/scripts/buildsystems/msbuild/support/RestoreEnvVars.task @@ -0,0 +1,28 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/scripts/buildsystems/msbuild/vcpkg.targets b/scripts/buildsystems/msbuild/vcpkg.targets index c98ca5d69b..e31aba3574 100644 --- a/scripts/buildsystems/msbuild/vcpkg.targets +++ b/scripts/buildsystems/msbuild/vcpkg.targets @@ -168,31 +168,38 @@ <_ZVcpkgInstallManifestDependenciesInputs Include="$(_ZVcpkgConfigurationFileLocation)" Condition="Exists('$(_ZVcpkgConfigurationFileLocation)')"/> + + + + + + + + + + <_ZVcpkgTLogFileLocation>$(TLogLocation)VcpkgInstallManifest$(VcpkgTriplet).$(_ZVcpkgHostTripletSuffix)read.1u.tlog - - - - + -