aboutsummaryrefslogtreecommitdiff
path: root/scripts/buildsystems/msbuild
diff options
context:
space:
mode:
authorBilly O'Neal <bion@microsoft.com>2020-10-27 20:48:14 -0700
committerGitHub <noreply@github.com>2020-10-27 20:48:14 -0700
commita6a1722cfa94caa5db98848679b99377bc5a0112 (patch)
tree0f17c63e4a0551866280600e466f21267c8ae1ce /scripts/buildsystems/msbuild
parentc34c4189ebbf0795e1f8e2de562c527a854c8db4 (diff)
downloadvcpkg-a6a1722cfa94caa5db98848679b99377bc5a0112.tar.gz
vcpkg-a6a1722cfa94caa5db98848679b99377bc5a0112.zip
[vcpkg, jsonnet, openssl-uwp] Enable use of the system powershell-core if it is present. (#13805)
Diffstat (limited to 'scripts/buildsystems/msbuild')
-rw-r--r--scripts/buildsystems/msbuild/vcpkg.targets41
1 files changed, 34 insertions, 7 deletions
diff --git a/scripts/buildsystems/msbuild/vcpkg.targets b/scripts/buildsystems/msbuild/vcpkg.targets
index a9c339559..5013d764a 100644
--- a/scripts/buildsystems/msbuild/vcpkg.targets
+++ b/scripts/buildsystems/msbuild/vcpkg.targets
@@ -103,18 +103,45 @@
</Target>
<Target Name="AppLocalFromInstalled" AfterTargets="CopyFilesToOutputDirectory" BeforeTargets="CopyLocalFilesOutputGroup;RegisterOutput" Condition="'$(VcpkgEnabled)' == 'true' and '$(VcpkgApplocalDeps)' == 'true'">
+ <Message Text="[vcpkg] Starting VcpkgApplocalDeps" Importance="low" />
<WriteLinesToFile
- File="$(TLogLocation)$(ProjectName).write.1u.tlog"
- Lines="^$(TargetPath);$([System.IO.Path]::Combine($(ProjectDir),$(IntDir)))vcpkg.applocal.log" Encoding="Unicode"/>
+ File="$(TLogLocation)$(ProjectName).write.1u.tlog"
+ Lines="^$(TargetPath);$([System.IO.Path]::Combine($(ProjectDir),$(IntDir)))vcpkg.applocal.log" Encoding="Unicode"/>
+ <PropertyGroup>
+ <_VcpkgAppLocalPowerShellCommonArguments>-ExecutionPolicy Bypass -noprofile -File "$(MSBuildThisFileDirectory)applocal.ps1" "$(TargetPath)" "$(VcpkgCurrentInstalledDir)$(VcpkgConfigSubdir)bin" "$(TLogLocation)$(ProjectName).write.1u.tlog" "$(IntDir)vcpkg.applocal.log"</_VcpkgAppLocalPowerShellCommonArguments>
+ </PropertyGroup>
+ <!-- Search %PATH% for pwsh.exe if it is available. -->
<Exec
- Command="$(SystemRoot)\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -noprofile -File %22$(MSBuildThisFileDirectory)applocal.ps1%22 %22$(TargetPath)%22 %22$(VcpkgCurrentInstalledDir)$(VcpkgConfigSubdir)bin%22 %22$(TLogLocation)$(ProjectName).write.1u.tlog%22 %22$(IntDir)vcpkg.applocal.log%22"
- StandardOutputImportance="Normal">
+ Command="pwsh.exe $(_VcpkgAppLocalPowerShellCommonArguments)"
+ StandardOutputImportance="Normal"
+ StandardErrorImportance="Normal"
+ IgnoreExitCode="true"
+ UseCommandProcessor="false">
+ <Output TaskParameter="ExitCode"
+ PropertyName="_VcpkgAppLocalExitCode" />
</Exec>
- <ReadLinesFromFile File="$(IntDir)vcpkg.applocal.log">
+ <!-- Fall back to well known system PowerShell location otherwise. -->
+ <Message Text="[vcpkg] Failed to run applocal.ps1 using pwsh, falling back to system PowerShell." Importance="low"
+ Condition="$(_VcpkgAppLocalExitCode) == 9009" />
+ <Exec
+ Command="%22$(SystemRoot)\System32\WindowsPowerShell\v1.0\powershell.exe%22 $(_VcpkgAppLocalPowerShellCommonArguments)"
+ StandardOutputImportance="Normal"
+ StandardErrorImportance="Normal"
+ IgnoreExitCode="true"
+ UseCommandProcessor="false"
+ Condition="$(_VcpkgAppLocalExitCode) == 9009">
+ <Output TaskParameter="ExitCode"
+ PropertyName="_VcpkgAppLocalExitCode" />
+ </Exec>
+ <!-- We're ignoring the above exit codes, so translate into a warning if both failed. -->
+ <Warning Text="[vcpkg] Failed to gather app local DLL dependencies, program may not run. Set VcpkgApplocalDeps to false in your project file to suppress this warning. PowerShell arguments: $(_VcpkgAppLocalPowerShellCommonArguments)"
+ Condition="$(_VcpkgAppLocalExitCode) != 0"/>
+ <ReadLinesFromFile File="$(IntDir)vcpkg.applocal.log"
+ Condition="$(_VcpkgAppLocalExitCode) == 0">
<Output TaskParameter="Lines" ItemName="VcpkgAppLocalDLLs" />
</ReadLinesFromFile>
- <Message Text="@(VcpkgAppLocalDLLs,'%0A')" Importance="Normal" />
- <ItemGroup>
+ <Message Text="@(VcpkgAppLocalDLLs,'%0A')" Importance="Normal" Condition="$(_VcpkgAppLocalExitCode) == 0" />
+ <ItemGroup Condition="$(_VcpkgAppLocalExitCode) == 0">
<ReferenceCopyLocalPaths Include="@(VcpkgAppLocalDLLs)" />
</ItemGroup>
</Target>