Rename the shell function to 'vcpkg-shell'. (#1442)
This commit is contained in:
Родитель
6d6266c8f5
Коммит
0e30cb1561
|
@ -444,14 +444,14 @@ endif()
|
|||
# === Target: vcpkg-ps1 ===
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/vcpkg.ps1"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/vcpkg-shell.ps1"
|
||||
COMMAND
|
||||
"${CMAKE_COMMAND}" ARGS -E copy "${CMAKE_CURRENT_SOURCE_DIR}/src/vcpkg-in-development.ps1" "${CMAKE_CURRENT_BINARY_DIR}/vcpkg.ps1"
|
||||
"${CMAKE_COMMAND}" ARGS -E copy "${CMAKE_CURRENT_SOURCE_DIR}/src/vcpkg-in-development.ps1" "${CMAKE_CURRENT_BINARY_DIR}/vcpkg-shell.ps1"
|
||||
DEPENDS
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/src/vcpkg-in-development.ps1"
|
||||
VERBATIM
|
||||
)
|
||||
add_custom_target(vcpkg-ps1 ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/vcpkg.ps1")
|
||||
add_custom_target(vcpkg-ps1 ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/vcpkg-shell.ps1")
|
||||
|
||||
# === Target: vcpkg ===
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ try {
|
|||
# can't deactivate without postscript:
|
||||
$output = Run-VcpkgAndCaptureOutput -ForceExe deactivate
|
||||
Throw-IfNotFailed
|
||||
Test-Match $output "no postscript file: rerun with the vcpkg shell function rather than executable"
|
||||
Test-Match $output "no postscript file: run vcpkg-shell with the same arguments"
|
||||
|
||||
$output = Run-VcpkgAndCaptureOutput deactivate
|
||||
Throw-IfFailed
|
||||
|
@ -219,21 +219,21 @@ try {
|
|||
# can't activate without postscript:
|
||||
$output = Run-VcpkgAndCaptureOutput -ForceExe activate
|
||||
Throw-IfNotFailed
|
||||
Test-Match $output "no postscript file: rerun with the vcpkg shell function rather than executable"
|
||||
Test-Match $output "no postscript file: run vcpkg-shell with the same arguments"
|
||||
Test-Activations
|
||||
|
||||
# unless --json passed
|
||||
$output = Run-VcpkgAndCaptureOutput -ForceExe activate --json (Join-Path $Project 'result.json')
|
||||
Throw-IfFailed
|
||||
Test-Match $output "Activating: $ProjectRegex"
|
||||
Test-NoMatch $output "no postscript file: rerun with the vcpkg shell function rather than executable"
|
||||
Test-NoMatch $output "no postscript file: run vcpkg-shell with the same arguments"
|
||||
Test-Activations # no shell activation
|
||||
|
||||
# or --msbuild-props passed
|
||||
$output = Run-VcpkgAndCaptureOutput -ForceExe activate --msbuild-props (Join-Path $Project 'result.props')
|
||||
Throw-IfFailed
|
||||
Test-Match $output "Activating: $ProjectRegex"
|
||||
Test-NoMatch $output "no postscript file: rerun with the vcpkg shell function rather than executable"
|
||||
Test-NoMatch $output "no postscript file: run vcpkg-shell with the same arguments"
|
||||
Test-Activations # no shell activation
|
||||
} finally {
|
||||
Run-Vcpkg deactivate
|
||||
|
|
|
@ -73,7 +73,7 @@ if ([string]::IsNullOrEmpty($VcpkgExe))
|
|||
|
||||
$VcpkgItem = Get-Item $VcpkgExe
|
||||
$VcpkgExe = $VcpkgItem.FullName
|
||||
$VcpkgPs1 = Join-Path $VcpkgItem.Directory "vcpkg.ps1"
|
||||
$VcpkgPs1 = Join-Path $VcpkgItem.Directory "vcpkg-shell.ps1"
|
||||
$TestScriptAssetCacheExe = Join-Path $VcpkgItem.Directory "test-script-asset-cache"
|
||||
|
||||
[Array]$AllTests = Get-ChildItem $PSScriptRoot/end-to-end-tests-dir/*.ps1
|
||||
|
|
|
@ -215,7 +215,7 @@ flowchart TD
|
|||
and check that a reasonable zlib version is printed.
|
||||
1. Back in the developer command prompt, verify that the copy of CMake can be customized by running:
|
||||
```
|
||||
vcpkg use microsoft:cmake
|
||||
vcpkg-shell use microsoft:cmake
|
||||
cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE="%VCPKG_ROOT%\scripts\buildsystems\vcpkg.cmake" -S . -B build_artifact
|
||||
ninja -C build_artifact
|
||||
build_artifact\program.exe
|
||||
|
|
|
@ -1720,7 +1720,7 @@
|
|||
"_optionsShouldBeASequenceFound$.comment": "\n'${p0}' is a parameter of type 'string'\n",
|
||||
"DuplicateKeysDetectedInManifest$": "Duplicate keys detected in manifest: '${p0}'",
|
||||
"_DuplicateKeysDetectedInManifest$.comment": "\n'${p0}' is a parameter of type 'string'\n",
|
||||
"noPostscriptFileRerunWithTheVcpkgShellFunctionRatherThanExecutable": "no postscript file: rerun with the vcpkg shell function rather than executable",
|
||||
"noPostscriptFileRunVcpkgshellWithTheSameArguments": "no postscript file: run vcpkg-shell with the same arguments",
|
||||
"DuplicateDefine$DuringActivationNewValueWillReplaceOld": "Duplicate define ${p0} during activation. New value will replace old.",
|
||||
"_DuplicateDefine$DuringActivationNewValueWillReplaceOld.comment": "\n'${p0}' is a parameter of type 'string'\n",
|
||||
"DuplicateToolDeclared$DuringActivationNewValueWillReplaceOld": "Duplicate tool declared ${p0} during activation. New value will replace old.",
|
||||
|
@ -1876,7 +1876,7 @@
|
|||
"_TriedToAddAnArtifact$$ButCouldNotDetermineTheRegistryToUse.comment": "\n'${p0}' is a parameter of type 'string'\n\n'${p1}' (aka 'artifact.id') is a parameter of type 'string'\n",
|
||||
"TriedToAddRegistry$As$ButItWasAlready$PleaseAdd$ToThisProjectManuallyAndReattempt": "Tried to add registry ${p0} as ${p1}, but it was already ${p2}. Please add ${p3} to this project manually and reattempt.",
|
||||
"_TriedToAddRegistry$As$ButItWasAlready$PleaseAdd$ToThisProjectManuallyAndReattempt.comment": "\n'${p0}' is a parameter of type 'string | undefined'\n\n'${p1}' is a parameter of type 'string'\n\n'${p2}' is a parameter of type 'string'\n\n'${p3}' is a parameter of type 'string'\n",
|
||||
"RunvcpkgActivateToApplyToTheCurrentTerminal": "Run \\`vcpkg activate\\` to apply to the current terminal",
|
||||
"RunvcpkgshellActivateToApplyToTheCurrentTerminal": "Run \\`vcpkg-shell activate\\` to apply to the current terminal",
|
||||
"DownloadsFolderCleared$": "Downloads folder cleared (${p0}) ",
|
||||
"_DownloadsFolderCleared$.comment": "\n'${p0}' (aka 'session.downloads.fsPath') is a parameter of type 'string'\n",
|
||||
"InstalledArtifactFolderCleared$": "Installed Artifact folder cleared (${p0}) ",
|
||||
|
|
|
@ -22,5 +22,7 @@ if (Test-Path $env:Z_VCPKG_POSTSCRIPT) {
|
|||
iex $postscr
|
||||
}
|
||||
|
||||
Remove-Item -Force -ea 0 $env:Z_VCPKG_POSTSCRIPT,env:Z_VCPKG_POSTSCRIPT
|
||||
Remove-Item -Force -ea 0 $env:Z_VCPKG_POSTSCRIPT
|
||||
}
|
||||
|
||||
Remove-Item env:Z_VCPKG_POSTSCRIPT
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace vcpkg
|
|||
constexpr CommandMetadata CommandActivateMetadata{
|
||||
"activate",
|
||||
msgCmdActivateSynopsis,
|
||||
{"vcpkg activate"},
|
||||
{"vcpkg-shell activate", "vcpkg activate --msbuild-props file.targets"},
|
||||
Undocumented,
|
||||
AutocompletePriority::Public,
|
||||
0,
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace vcpkg
|
|||
constexpr CommandMetadata CommandUseMetadata{
|
||||
"use",
|
||||
msgCmdUseSynopsis,
|
||||
{msgCmdUseExample1, "vcpkg use cmake"},
|
||||
{msgCmdUseExample1, "vcpkg-shell use cmake"},
|
||||
Undocumented,
|
||||
AutocompletePriority::Public,
|
||||
1,
|
||||
|
|
|
@ -39,7 +39,7 @@ function findCaseInsensitiveOnWindows<V>(map: Map<string, V>, key: string): V |
|
|||
export type Tuple<K, V> = [K, V];
|
||||
|
||||
function displayNoPostScriptError(channels: Channels) {
|
||||
channels.error(i`no postscript file: rerun with the vcpkg shell function rather than executable`);
|
||||
channels.error(i`no postscript file: run vcpkg-shell with the same arguments`);
|
||||
}
|
||||
|
||||
export class Activation {
|
||||
|
|
|
@ -77,7 +77,7 @@ export class AddCommand extends Command {
|
|||
|
||||
// write the file out.
|
||||
await projectManifest.metadata.save();
|
||||
session.channels.message(i`Run \`vcpkg activate\` to apply to the current terminal`);
|
||||
session.channels.message(i`Run \`vcpkg-shell activate\` to apply to the current terminal`);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
"_optionsShouldBeASequenceFound$.comment": "\n'${p0}' is a parameter of type 'string'\n",
|
||||
"DuplicateKeysDetectedInManifest$": "Duplicate keys detected in manifest: '${p0}'",
|
||||
"_DuplicateKeysDetectedInManifest$.comment": "\n'${p0}' is a parameter of type 'string'\n",
|
||||
"noPostscriptFileRerunWithTheVcpkgShellFunctionRatherThanExecutable": "no postscript file: rerun with the vcpkg shell function rather than executable",
|
||||
"noPostscriptFileRunVcpkgshellWithTheSameArguments": "no postscript file: run vcpkg-shell with the same arguments",
|
||||
"DuplicateDefine$DuringActivationNewValueWillReplaceOld": "Duplicate define ${p0} during activation. New value will replace old.",
|
||||
"_DuplicateDefine$DuringActivationNewValueWillReplaceOld.comment": "\n'${p0}' is a parameter of type 'string'\n",
|
||||
"DuplicateToolDeclared$DuringActivationNewValueWillReplaceOld": "Duplicate tool declared ${p0} during activation. New value will replace old.",
|
||||
|
@ -195,7 +195,7 @@
|
|||
"_TriedToAddAnArtifact$$ButCouldNotDetermineTheRegistryToUse.comment": "\n'${p0}' is a parameter of type 'string'\n\n'${p1}' (aka 'artifact.id') is a parameter of type 'string'\n",
|
||||
"TriedToAddRegistry$As$ButItWasAlready$PleaseAdd$ToThisProjectManuallyAndReattempt": "Tried to add registry ${p0} as ${p1}, but it was already ${p2}. Please add ${p3} to this project manually and reattempt.",
|
||||
"_TriedToAddRegistry$As$ButItWasAlready$PleaseAdd$ToThisProjectManuallyAndReattempt.comment": "\n'${p0}' is a parameter of type 'string | undefined'\n\n'${p1}' is a parameter of type 'string'\n\n'${p2}' is a parameter of type 'string'\n\n'${p3}' is a parameter of type 'string'\n",
|
||||
"RunvcpkgActivateToApplyToTheCurrentTerminal": "Run \\`vcpkg activate\\` to apply to the current terminal",
|
||||
"RunvcpkgshellActivateToApplyToTheCurrentTerminal": "Run \\`vcpkg-shell activate\\` to apply to the current terminal",
|
||||
"DownloadsFolderCleared$": "Downloads folder cleared (${p0}) ",
|
||||
"_DownloadsFolderCleared$.comment": "\n'${p0}' (aka 'session.downloads.fsPath') is a parameter of type 'string'\n",
|
||||
"InstalledArtifactFolderCleared$": "Installed Artifact folder cleared (${p0}) ",
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
# Licensed under the MIT License.
|
||||
|
||||
# wrapper script for vcpkg
|
||||
# this is intended to be dot-sourced and then you can use the vcpkg() function.
|
||||
# this is intended to be dot-sourced and then you can use the vcpkg-shell() function.
|
||||
|
||||
# check to see if we've been dot-sourced (should work for most POSIX shells)
|
||||
sourced=0
|
||||
|
@ -82,7 +82,7 @@ if [ $? -eq 1 ]; then
|
|||
fi
|
||||
|
||||
# So, we're the real script then.
|
||||
vcpkg() {
|
||||
vcpkg-shell() {
|
||||
# set the response file
|
||||
# Generate 32 bits of randomness, to avoid clashing with concurrent executions.
|
||||
export Z_VCPKG_POSTSCRIPT="$(mktemp).sh"
|
||||
|
@ -104,7 +104,7 @@ vcpkg() {
|
|||
|
||||
# did they dotsource and have args go ahead and run it then!
|
||||
if [ "$#" -gt "0" ]; then
|
||||
vcpkg $@
|
||||
vcpkg-shell $@
|
||||
fi
|
||||
|
||||
Z_VCPKG_cleanup
|
||||
|
|
|
@ -6,7 +6,7 @@ if #ftw NEQ '' goto :init
|
|||
# Licensed under the MIT License.
|
||||
|
||||
# wrapper script for vcpkg
|
||||
# this is intended to be dot-sourced and then you can use the vcpkg() function
|
||||
# this is intended to be dot-sourced and then you can use the vcpkg-shell() function
|
||||
|
||||
# Workaround for $IsWindows not existing in Windows PowerShell
|
||||
if (-Not (Test-Path variable:IsWindows)) {
|
||||
|
@ -80,7 +80,7 @@ if(-Not (bootstrap-vcpkg)) {
|
|||
# Export vcpkg to the current shell.
|
||||
New-Module -name vcpkg -ArgumentList @($VCPKG) -ScriptBlock {
|
||||
param($VCPKG)
|
||||
function vcpkg() {
|
||||
function vcpkg-shell() {
|
||||
# setup the postscript file
|
||||
# Generate 31 bits of randomness, to avoid clashing with concurrent executions.
|
||||
$env:Z_VCPKG_POSTSCRIPT = Join-Path ([System.IO.Path]::GetTempPath()) "VCPKG_tmp_$(Get-Random -SetSeed $PID).ps1"
|
||||
|
@ -92,13 +92,15 @@ New-Module -name vcpkg -ArgumentList @($VCPKG) -ScriptBlock {
|
|||
iex $postscr
|
||||
}
|
||||
|
||||
Remove-Item -Force -ea 0 $env:Z_VCPKG_POSTSCRIPT,env:Z_VCPKG_POSTSCRIPT
|
||||
Remove-Item -Force -ea 0 $env:Z_VCPKG_POSTSCRIPT
|
||||
}
|
||||
|
||||
Remove-Item env:Z_VCPKG_POSTSCRIPT
|
||||
}
|
||||
} | Out-Null
|
||||
|
||||
if ($args.Count -ne 0) {
|
||||
return vcpkg @args
|
||||
return vcpkg-shell @args
|
||||
}
|
||||
|
||||
return
|
||||
|
@ -140,7 +142,7 @@ IF ERRORLEVEL 1 (
|
|||
SET Z_POWERSHELL_EXE=
|
||||
|
||||
:: Install the doskey
|
||||
DOSKEY vcpkg="%VCPKG_ROOT%\vcpkg-cmd.cmd" $*
|
||||
DOSKEY vcpkg-shell="%VCPKG_ROOT%\vcpkg-cmd.cmd" $*
|
||||
|
||||
:: If there were any arguments, also invoke vcpkg with them
|
||||
IF "%1"=="" GOTO fin
|
||||
|
|
Загрузка…
Ссылка в новой задаче