-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[vcpkg, jsonnet, openssl-uwp] Enable use of the system powershell-core if it is present. #13805
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a remaining case of calling powershell.exe
via vcpkg_build_msbuild(USE_VCPKG_INTEGRATION)
-- this will pass flags to msbuild which pull in our standard applocal deployment stuff [1].
I recall when we spoke about this you mentioned that you tested some MSBuild cases and they didn't trigger the powershell bug, but I'm not sure if this specific one was considered.
The fix for this case is probably to add an internal VcpkgPowershell
property to our MSBuild scripts that can be redirected to pwsh
inside vcpkg but defaults to powershell
outside.
[1]
vcpkg/scripts/cmake/vcpkg_build_msbuild.cmake
Lines 109 to 116 in c902748
if(_csc_USE_VCPKG_INTEGRATION) | |
list( | |
APPEND _csc_OPTIONS | |
/p:ForceImportBeforeCppTargets=${SCRIPTS}/buildsystems/msbuild/vcpkg.targets | |
"/p:VcpkgTriplet=${TARGET_TRIPLET}" | |
"/p:VcpkgCurrentInstalledDir=${CURRENT_INSTALLED_DIR}" | |
) | |
endif() |
endif() | ||
macro(search_for_dependencies PATH_TO_SEARCH) | ||
file(GLOB TOOLS ${TOOL_DIR}/*.exe ${TOOL_DIR}/*.dll) | ||
foreach(TOOL ${TOOLS}) | ||
vcpkg_execute_required_process( | ||
COMMAND ${PS_EXE} -noprofile -executionpolicy Bypass -nologo | ||
-file ${SCRIPTS}/buildsystems/msbuild/applocal.ps1 | ||
COMMAND ${PWSH_EXE} -noprofile -executionpolicy Bypass -nologo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
COMMAND ${PWSH_EXE} -noprofile -executionpolicy Bypass -nologo | |
COMMAND "${PWSH_EXE}" -noprofile -executionpolicy Bypass -nologo |
scripts/buildsystems/vcpkg.cmake
Outdated
if (NOT DEFINED _VCPKG_POWERSHELL_PATH) | ||
find_program(_VCPKG_PWSH_PATH pwsh) | ||
if (_VCPKG_PWSH_PATH-NOTFOUND) | ||
message(WARNING "vcpkg: Could not find PowerShell Core; falling back to PowerShell") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since most users will not have PowerShell Core installed, this adds a warning for most/all users. I think we should probably not warn here.
Yes, this is the test I meant I tried. Consider activemq-cpp which uses that feature but I'm still left with a truetype font afterwards: so I think we're good with no changes here. |
That said I think this is an improvement even if it's unnecessary so I did that anyway. |
Oh I see, we don't trigger the problem because in those places we set |
ports/vs-yasm/portfile.cmake
Outdated
set(_files yasm.props yasm.targets yasm.xml) | ||
foreach(_file ${_files}) | ||
file(INSTALL "${SOURCE_PATH}/${_file}" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}/") | ||
endforeach() | ||
set(_file "${CURRENT_PACKAGES_DIR}/share/${PORT}/yasm.props") | ||
file(READ "${_file}" _contents) | ||
string(REPLACE "$(VCInstallDir)" "" _contents "${_contents}") | ||
string(REPLACE "$(VCInstallDir)" "${YASM_NATIVE}" _contents "${_contents}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This inserts absolute paths into the package which will become invalid if it is restored elsewhere.
At the beginning, the use of powershell in the user system was prohibited because some functions in our script lacked compatibility in different versions. So this PR should focus on this issue. |
That's why this checks for the version and only uses the system one if the version matches |
…sh.exe comes from Program Files.
2a946f3
to
c784469
Compare
The failures are all the same as the most recent CI build, so merging this anyway. |
…e if it is present. (microsoft#13805)
In #13267 we attempted to resolve failures to download PowerShell making the pool be relatively unstable by updating the version we look for to 7.0.3, and we have that version installed in the VMs. Unfortunately, this has not resulted in the reliability improvement we expected because vcpkg ignores the system copy. For example:
https://dev.azure.com/vcpkg/public/_build/results?buildId=43418&view=logs&j=5dffab7c-3299-5a76-7b02-e037cd868fad&t=70564965-7ae4-5af3-8764-a93ab8ddf245
This change enables detection of a system
pwsh
.Also note that callers in the scripts tree were changed to explicitly look for "
pwsh
" rather than "powershell
". Previously we copied the binary under the old name which worked as a fallback, but this fails whenpwsh
is in Program Files:Also fixed a few ports to explicitly name pwsh for more consistent behavior, and drive by attempted to fix #12237 since the problem repro'd in the validation build for x86-windows 682fa1f.