* Use the git repo of --x-builtin-ports-root and --x-builtin-registry-versions-dir when talking about port commit shas and version tree shas, respectively.
I believe this is necessary to make the instructions in https://learn.microsoft.com/vcpkg/produce/publish-to-a-git-registry#4---update-the-versions-database actually work.
This also reduces the number of things that assume VCPKG_ROOT is a git repo. (Since it is not when we are shipped in VS or acquired with the one liner)
* Add name, synopsis, and example information to CommandMetadata.
* Clean up needing to make thunks for all help text in command metadata machinery.
* Power autocomplete and help with the same tables that power command lookup. Resolves this line item first discovered in https://github.com/microsoft/vcpkg-tool/pull/1164
* Improve help by printing synopsis and grouped examples powered by CommandMetadata.
* Update the main usage to make sure every relevant command is included.
* Add website link to all help commands.
* split rarely used and artifacts into separate `vcpkg help commands` from @ras0219-msft
* make tense for all synopsis and argument help text consistent from @ras0219-msft
* burninate 'instead of' and 'writes out'
* Deduplicate the all commands help topic and remove 'vcpkg' from 'vcpkg help blah'.
This removes the 'in September 2023' message and does what the message said we would do. For the next 6 months we'll warn that the behavior changed.
The specific change to triplet.cpp to change the triplet setting is from https://github.com/microsoft/vcpkg-tool/pull/640
Co-authored-by: Alexander Neumann <30894796+Neumann-A@users.noreply.github.com>
* initial implementation
* avoid value or exit and reuse MissinOption message
* improve messaging
* reduce redundancy
* add end2end test file
* add test cases for raw based exports in manifest mode
* Make commands physical design consistent.
In the vcpkg technical review meeting today we said:
* We want commands.Xxx.cpp for every "vcpkg Xxx" subcommand, rather than Xxx.cpp.
* We want x- commands to not have the x in their code names or x- in their file names, and z- commands have the z in their code names and z- in their file names.
* Command cpps have dashes.
Drive by fixes as part of this audit:
* FooCommand structs are gone, all users were stateless and are better served by plain function pointers. This also allows the command tables to be constexpr.
* commands.interface.h is dead, as it only existed to declare those structs that are dead.
Future changes:
* I really want all the Commands::Xxx and the commands namespace itself to go away. But ran out of time to sell this to the team.
* Xxx::COMMAND_STRUCTURE => XxxCommandMetadata
* Xxx::perform_and_exit => xxx_command_and_exit
Notes:build, install, and export probably deserve to have functionality split out, but that would probably be intricate so I have not attempted to do it here.
export.*.cpp seem like they *really* shouldn't be separate .cpps.
* Missed some _command s.
* wip
* wip
* format
* minimal impl
* add .xz
* Add help text for command
* vcpkg-artifacts uses x-extract
* format
* oops
* x-extract -> z-extract
* rename extract_archive_to_empty -> extract_archive and rename the old extract_archive to set_directory_to_archive_content
* fix comment
* wip
* add strip setting
* add strip option localized message
* format
* wip
* Add testing for strip mapping
* add --extract-type option to bypass file extension detection
* format
* wip
* test
* wip
* wip
* wip
* forward slash delim for non-windows
* wip
* try again
* maybe fix paths for non-windows
* use generic_Xxx
* use + instead of /
* convert back to path
* use appropriate path separators in test
* set VCPKG_COMMAND env variable
* set VCPKG_COMMAND
* set VCPKG_COMMAND in yaml
* wip
* use matrix.preset
* remove archive unit test from artifacts
* debug
* const everything
* create destination if it does not exist
* use fsPath instead
* bug fixes and remove installers
* fix end-to-end check
* wip
* wip
* debug messages
* fix strip for macos and linux
* print output
* wip
* cleanup
* format
* rename to command_extract_and_exit as per convention
* response to feedback
* remove the extract-type option and just fall back to cmake
* fix strip_map to proper behavior, better temp dir handling, etc
* fix unit tests
* for real this time
* wip
* wip
* reuse logic for is_slash functionality
* oops
* testing
* test
* testing
* verify problem
* try this
* fix
* use Strings::strto<int> instead of std::stoi
* add AUTO option + unit test
* add strip=AUTO
* switch artifacts to use strip=AUTO
* format
* cleanup
* fix compiler warnings
* fix conversion
* format
* remove magic -1, respond to feedback, format
* update localized messages
* add e2e
* test executable bits on non-windows
* oops
* better naming
* try this
* update end2end
* for real this time
* verify file exists
* print UnixMode
* oops
* fix indentation
* look for the right unixMode
* Simplify tests.
* Delete unreferenced test assets, add archive start events back.
* remove = from #define
* format
* minor fix
* Fix casing for enum class
* rename strip_map and get_common_prefix_count and add minimum documentation
* wip
* missed a couple renames
* rename test folder from "archive" to "folder0"
* remove then from artifact caller
* some structural changes
* enforce relationship between stripMode and stripCount
* use files is_slash
* check strip option is >=0
* format
* minor refactoring
* remove empty entries from get_archive_deploy_operations
* minor refactor
* adds testing for guess_extraction_type and get_strip_setting
* add testing for get_strip_setting
* minor feedback
---------
Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
Hopefully resolves test failures in https://github.com/microsoft/vcpkg-tool/pull/1129 -- asset caching is not turned on in the tool repo so testing things that need lots of external servers is problematic.
This was added back when the tool and registry were in the same repo in attempt to validate *registry* changes, not tool changes. As a result it doesn't really belong here.
The one thing that might also have been tested here is handling of old CONTROL files ports so I added an explicit test port for that.
* Add an e2e test for removed-from-baseline ports.
* Rename patterns.ps1 to e2e-registry.ps1, to reflect that there are
tests for more than just patterns now.
* Add removed.json.in and a call to it.
See also https://github.com/microsoft/vcpkg-tool/pull/1108 which
fixes all the e2e infrastructure to consistently use -s.
* Actually fix the bug: anything accepting both an ActionPlan and a PortFileProvider is suspect. In this case it was:
```
void load_tag_vars(const ActionPlan& action_plan,
const PortFileProvider& port_provider,
Triplet host_triplet) const;
```
Fix that by just pushing the ActionPlan part down to the underlying virtual load_tag_vars.
* Repair z-applocal test bugs.
* We accidentally checked in main.exe rather than main.cpp. Compiling main.cpp failed, but the test 'passed' because main.exe was already present.
* We never checked the output to see that vcpkg thought it actually deployed anything.
* We didn't actually test anything because we built the DLLs to be copied in the same location as the exe, so there was nothing to do.
* We wrote to the source tree.
* Also make deploying plugins from 'debug' bin dirs correct.
* Turn off autocrlf in format-manifest test.
Resolves output like
2023-05-18T00:52:19.4251966Z warning: in the working copy of '3fd/vcpkg.json', LF will be replaced by CRLF the next time Git touches it
2023-05-18T00:52:19.4372050Z warning: in the working copy of '7zip/vcpkg.json', LF will be replaced by CRLF the next time Git touches it
2023-05-18T00:52:19.4386085Z warning: in the working copy of 'ableton-link/vcpkg.json', LF will be replaced by CRLF the next time Git touches it
2023-05-18T00:52:19.4398373Z warning: in the working copy of 'ableton/vcpkg.json', LF will be replaced by CRLF the next time Git touches it
2023-05-18T00:52:19.4410932Z warning: in the working copy of 'abseil/vcpkg.json', LF will be replaced by CRLF the next time Git touches it
2023-05-18T00:52:19.4422736Z warning: in the working copy of 'absent/vcpkg.json', LF will be replaced by CRLF the next time Git touches it
in Actions output. Example: https://github.com/microsoft/vcpkg-tool/actions/runs/5008981073/jobs/8977401326
* use fmap instead of util::transform to keep original config in tact.
* formatting
* add test case to overlays end-to-end
* -IfNotEqual is not a thing :)
* probably best not to sort paths :)
* no need to convert to strings
* Don't emit the triplet warning with x-set-installed no args.
Also added e2e tests.
* clang-format
* Add purpose specific unit tests, including a new test for platform qualified expressions.
* Add end to end test for the environment variable being set not emitting the warning.
* Add a test to detect the problem that occurred in the demo of use stacking this morning.
Repro pseudocode:
vcpkg new
vcpkg add artifact gcc
vcpkg activate
vcpkg use cmake
vcpkg activate
assert(Get-Command cmake) -eq $null
* Delete unused Activation.getEnvironmentBlock()
* Reorder "deactivate" of the environment to happen at the beginning of activation rather than the end, so that replacements aren't dependent on whether activation happens or not.
* Extract writePostscript.
* clang-format
* Allow use to stack on use and activate, but not vice versa.
Resolves https://github.com/microsoft/vcpkg/issues/29978
Also adds the ability to e2e test any artifacts things.
Also gets rid of duplicate definition of Record.
Also removes meaningless --project switch from deactivate.
Also localizes error and warning in artifacts messages.
Also warns if the user ran just the exe and we're doing something that needs the postscript file.
Also applies changes from vcpkg-init.ps1 to vcpkg-in-development.ps1.
* Install successful installs even with --only-downloads.
Drive-by: Make set-installed accept --only-downloads.
"Download only" mode works by marking execute_process and friends to fail instantly when a port is run, and we just hope the `vcpkg_from_Xxx` is reached before that failure happens. Then, we didn't install the result, even if it "succeeded".
This failed for ports which put their "get" operation into a helper port, since the helper cmake script dependent ports were expecting to use was unavailable.
Before:
```
PS C:\Dev\vcpkg> .\vcpkg.exe install ignition-math4 --only-downloads
Computing installation plan...
The following packages will be built and installed:
* ignition-cmake0[core]:x86-windows -> 0.6.2#4
ignition-math4[core]:x86-windows -> 4.0.0#3
* ignition-modularscripts[core]:x64-windows -> 2022-05-11#1
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet x64-windows...
Detecting compiler hash for triplet x86-windows...
Installing 1/3 ignition-modularscripts:x64-windows...
Building ignition-modularscripts[core]:x64-windows...
-- Installing: C:/Dev/vcpkg/packages/ignition-modularscripts_x64-windows/share/ignition-modularscripts/vcpkg-port-config.cmake
Downloaded sources for ignition-modularscripts[core]:x64-windows
Elapsed time to handle ignition-modularscripts:x64-windows: 51.88 ms
Installing 2/3 ignition-cmake0:x86-windows...
Building ignition-cmake0[core]:x86-windows...
CMake Error at ports/ignition-cmake0/portfile.cmake:3 (ignition_modular_library):
Unknown CMake command "ignition_modular_library".
Call Stack (most recent call first):
scripts/ports.cmake:147 (include)
Downloaded sources for ignition-cmake0[core]:x86-windows
Elapsed time to handle ignition-cmake0:x86-windows: 43.37 ms
Installing 3/3 ignition-math4:x86-windows...
Building ignition-math4[core]:x86-windows...
CMake Error at ports/ignition-math4/portfile.cmake:1 (ignition_modular_library):
Unknown CMake command "ignition_modular_library".
Call Stack (most recent call first):
scripts/ports.cmake:147 (include)
Downloaded sources for ignition-math4[core]:x86-windows
Elapsed time to handle ignition-math4:x86-windows: 43.78 ms
Total install time: 4.206 s
RESULTS
ignition-modularscripts:x64-windows: DOWNLOADED: 51.88 ms
ignition-cmake0:x86-windows: DOWNLOADED: 43.37 ms
ignition-math4:x86-windows: DOWNLOADED: 43.78 ms
SUMMARY FOR x64-windows
DOWNLOADED: 1
SUMMARY FOR x86-windows
DOWNLOADED: 2
PS C:\Dev\vcpkg>
```
After:
```
PS C:\Dev\vcpkg> C:\Dev\vcpkg-tool\out\build\x64-Debug\vcpkg.exe install ignition-math4 --only-downloads
Computing installation plan...
The following packages will be built and installed:
* ignition-cmake0[core]:x86-windows -> 0.6.2#4
ignition-math4[core]:x86-windows -> 4.0.0#3
* ignition-modularscripts[core]:x64-windows -> 2022-05-11#1
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet x64-windows...
Detecting compiler hash for triplet x86-windows...
Installing 1/3 ignition-modularscripts:x64-windows...
Building ignition-modularscripts[core]:x64-windows...
-- Installing: C:/Dev/vcpkg/packages/ignition-modularscripts_x64-windows/share/ignition-modularscripts/vcpkg-port-config.cmake
-- Performing post-build validation
Elapsed time to handle ignition-modularscripts:x64-windows: 63.08 ms
Installing 2/3 ignition-cmake0:x86-windows...
Building ignition-cmake0[core]:x86-windows...
-- Downloading https://github.com/ignitionrobotics/ign-cmake/archive/ignition-cmake_0.6.1.tar.gz -> ignitionrobotics-ign-cmake-ignition-cmake_0.6.1-1.tar.gz...
-- Extracting source C:/Dev/vcpkg/downloads/ignitionrobotics-ign-cmake-ignition-cmake_0.6.1-1.tar.gz
-- Applying patch do-not-compile-gtest.patch
-- Applying patch support-arm64.patch
-- Applying patch uuid-do-not-require-pkg-config.patch
-- Applying patch fix-find-ign-curl.patch
-- Using source at C:/Dev/vcpkg/buildtrees/ignition-cmake0/src/make_0.6.1-6417790457.clean
-- Using cached msys-mingw-w64-i686-pkg-config-0.29.2-3-any.pkg.tar.zst.
-- Using cached msys-mingw-w64-i686-libwinpthread-git-9.0.0.6373.5be8fcd83-1-any.pkg.tar.zst.
-- Using msys root at C:/Dev/vcpkg/downloads/tools/msys2/9a1ec3f33446b195
-- Found external ninja('1.11.0').
-- Configuring x86-windows-dbg
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:23 (message):
This command cannot be executed in Download Mode.
Halting portfile execution.
Call Stack (most recent call first):
scripts/cmake/vcpkg_configure_cmake.cmake:326 (vcpkg_execute_required_process)
installed/x64-windows/share/ignition-modularscripts/vcpkg-port-config.cmake:8 (vcpkg_configure_cmake)
installed/x64-windows/share/ignition-modularscripts/vcpkg-port-config.cmake:160 (ignition_modular_build_library)
ports/ignition-cmake0/portfile.cmake:3 (ignition_modular_library)
scripts/ports.cmake:147 (include)
Downloaded sources for ignition-cmake0[core]:x86-windows
Elapsed time to handle ignition-cmake0:x86-windows: 1.004 s
Installing 3/3 ignition-math4:x86-windows...
Building ignition-math4[core]:x86-windows...
-- Downloading https://github.com/ignitionrobotics/ign-math/archive/ignition-math4_4.0.0.tar.gz -> ignitionrobotics-ign-math-ignition-math4_4.0.0-1.tar.gz...
-- Extracting source C:/Dev/vcpkg/downloads/ignitionrobotics-ign-math-ignition-math4_4.0.0-1.tar.gz
-- Using source at C:/Dev/vcpkg/buildtrees/ignition-math4/src/ath4_4.0.0-89bdbdf369.clean
-- Using cached msys-mingw-w64-i686-pkg-config-0.29.2-3-any.pkg.tar.zst.
-- Using cached msys-mingw-w64-i686-libwinpthread-git-9.0.0.6373.5be8fcd83-1-any.pkg.tar.zst.
-- Using msys root at C:/Dev/vcpkg/downloads/tools/msys2/9a1ec3f33446b195
-- Found external ninja('1.11.0').
-- Configuring x86-windows-dbg
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:23 (message):
This command cannot be executed in Download Mode.
Halting portfile execution.
Call Stack (most recent call first):
scripts/cmake/vcpkg_configure_cmake.cmake:326 (vcpkg_execute_required_process)
installed/x64-windows/share/ignition-modularscripts/vcpkg-port-config.cmake:8 (vcpkg_configure_cmake)
installed/x64-windows/share/ignition-modularscripts/vcpkg-port-config.cmake:160 (ignition_modular_build_library)
ports/ignition-math4/portfile.cmake:1 (ignition_modular_library)
scripts/ports.cmake:147 (include)
Downloaded sources for ignition-math4[core]:x86-windows
Elapsed time to handle ignition-math4:x86-windows: 965.5 ms
Total install time: 5.452 s
RESULTS
ignition-modularscripts:x64-windows: SUCCEEDED: 63.08 ms
ignition-cmake0:x86-windows: DOWNLOADED: 1.004 s
ignition-math4:x86-windows: DOWNLOADED: 965.5 ms
SUMMARY FOR x64-windows
SUCCEEDED: 1
SUMMARY FOR x86-windows
DOWNLOADED: 2
PS C:\Dev\vcpkg>
```
Observe that in the before we failed to download the sources of ignition-cmake0 and ignition-math4.
* Delete StringMetric::BuildError because it was leaking unhashed port names.
* Deduplicate the call to do_build_package_and_clean_buildtrees.
This required moving the bundleconfig to "next to the .exe" rather than "within vcpkg_root", and corresponding test changes, since we need to know information out of the bundle before we know where VCPKG_ROOT is (and maybe for commands that don't need VCPKG_ROOT in the first place).
This also changes `--no-disablemetrics` to force enable metrics if the user does that for some reason, even if there's a file named vcpkg.disable-metrics.
Drive bys:
* test_registry_key and get_registry_string where leaktrocities.
* get_registry_string was racy.
* get_registry_string accepted REG_MULTI_SZ despite that not actually being a string type. (It's vector<string>)
* Make e2e tests depend on fewer external resources.
Fixes macos failures caused by Azure Pipelines removing pkgconfig by default, and hopefully speeds some bits up a bit by building less.
* Also try updating MacOS image, and removing fmt dependency from those tests.
* Install pkg-config on MacOS because zlib needs it and avoiding the zlib dependency seems impractical.
* Unsupported platform added for env (fixes#29559)
* Unsupported platform added for env (fixes#29559)
* Revert error on linux, for testing CI
* Ignore error on linux
* Revert settings change
* Localized message
* Resolve prefix patterns in packages declarations
* Allow prefixes in configuration parser
* A few more test cases
* Add warning for ignored patterns/packages
* Print warnings on vcpkg configuration
* Localize warning messages
* Clean up
* Test registry parsing
* Apply Billy's patch
* Apply Billy's suggestions from code review
Co-authored-by: Billy O'Neal <bion@microsoft.com>
* Format
* Collect all package pattern warnings into one
* Improve warning message
* Format messages
* Disallow period separated segments in port names
* Error messages on invalid patterns/names
* Cleanup
* Disallow registries without setting a baseline
* Fix for artifact registries
* Billy's PR comments
* Add e2e test registry
* End-to-end tests
* Fix e2e tests
* Make tests success case silent
* Accept prefixes ending in '-'
Co-authored-by: Billy O'Neal <bion@microsoft.com>
* Remove unique_ptr from VcpkgCmdArguments.
* Ignore the VCPKG_ROOT environment variable when we detect a vcpkg_root.
This resolves https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1634907
In https://github.com/actions/runner-images/pull/6196 we have yet another CI system that is trying to helpfully set VCPKG_ROOT for customers to find their vcpkg instance which yet again breaks classic-mode-as-submodule customers. This change mitigates the issue by ignoring the environment variable when we detect a valid VCPKG_ROOT, which the user can override by using the command line option.
* Fix disable-metrics test and echo tool output.
* Fix imprecise env-passthrough test.
* Detect and track CI environments
* Skip detection loop if metrics are disabled
* Add environment variable to opt-out from CI detection.
* Use known CI providers array directly
* Add accessor for detected CI environment
* Add end-to-end tests
Co-authored-by: Billy O'Neal <bion@microsoft.com>