From 575fe0eeda15015b7f08dcea39d6bb01fb19a6a9 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Mon, 11 Jul 2022 15:10:53 -0700 Subject: [PATCH 01/61] WIP --- src/vcpkg/vcpkgcmdarguments.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/vcpkg/vcpkgcmdarguments.cpp b/src/vcpkg/vcpkgcmdarguments.cpp index fb855ae3c6..ace207bed8 100644 --- a/src/vcpkg/vcpkgcmdarguments.cpp +++ b/src/vcpkg/vcpkgcmdarguments.cpp @@ -11,6 +11,14 @@ namespace vcpkg { + DECLARE_AND_REGISTER_MESSAGE(HelpSearchCommand, (), "", "Search for packages available to be built."); + DECLARE_AND_REGISTER_MESSAGE(HelpInstallCommand, (), "", "Install a package."); + DECLARE_AND_REGISTER_MESSAGE(HelpRemoveCommand, (), "", "Uninstall a package."); + DECLARE_AND_REGISTER_MESSAGE(HelpListCommand, (), "", "List installed packages."); + DECLARE_AND_REGISTER_MESSAGE(HelpUpdateCommand, (), "", "List Update packages."); + DECLARE_AND_REGISTER_MESSAGE(HelpTopicsCommand, (), "", "Display the list of help topics."); + DECLARE_AND_REGISTER_MESSAGE(HelpTopicCommand, (), "", "Display help for a specific topic."); + static void set_from_feature_flag(const std::vector& flags, StringView flag, Optional& place) { if (!place.has_value()) @@ -559,17 +567,17 @@ namespace vcpkg { HelpTableFormatter table; table.header("Commands"); - table.format("vcpkg search [pat]", "Search for packages available to be built"); - table.format("vcpkg install ...", "Install a package"); - table.format("vcpkg remove ...", "Uninstall a package"); + table.format("vcpkg search [pat]", msg::format(msgHelpSearchCommand)); + table.format("vcpkg install ...", msg::format(msgHelpInstallCommand)); + table.format("vcpkg remove ...", msg::format(msgHelpRemoveCommand)); + table.format("vcpkg update", msg::format(msgHelpUpdateCommand)); table.format("vcpkg remove --outdated", "Uninstall all out-of-date packages"); - table.format("vcpkg list", "List installed packages"); - table.format("vcpkg update", "Display list of packages for updating"); table.format("vcpkg upgrade", "Rebuild all outdated packages"); table.format("vcpkg x-history ", "(Experimental) Shows the history of CONTROL versions of a package"); table.format("vcpkg hash [alg]", "Hash a file by specific algorithm, default SHA512"); - table.format("vcpkg help topics", "Display the list of help topics"); - table.format("vcpkg help ", "Display help for a specific topic"); + table.format("vcpkg help topics", msg::format(msgHelpTopicsCommand)); + table.format("vcpkg help ", msg::format(msgHelpTopicCommand)); + table.format("vcpkg list", msg::format(msgHelpListCommand)); table.blank(); Commands::Integrate::append_helpstring(table); table.blank(); From bef0248f37d76ccb4348265e094bae652ec1b532 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Mon, 11 Jul 2022 17:13:09 -0700 Subject: [PATCH 02/61] WIP --- locales/messages.en.json | 23 +++++ locales/messages.json | 24 +++++ src/vcpkg/vcpkgcmdarguments.cpp | 159 ++++++++++++++++++++++++-------- 3 files changed, 165 insertions(+), 41 deletions(-) diff --git a/locales/messages.en.json b/locales/messages.en.json index a38d698aba..bc5fb137ae 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -128,6 +128,29 @@ "GraphCycleDetected": "Cycle detected within graph at {package_name}:", "HashFileFailureToRead": "failed to read file '{path}' for hashing: ", "HeaderOnlyUsage": "{package_name} is header-only and can be used from CMake via:", + "HelpContactCommand": "Display contact information to send feedback.", + "HelpCreateCommand": "Create a new package.", + "HelpDependInfoCommand": "Display a list of dependencies for packages.", + "HelpEditCommand": "Open up a port for editing (uses '{env_var}' default 'code'.", + "HelpEnvCommand": "Creates a clean shell environment for development or compiling.", + "HelpExampleCommand": "For more help (including examples) see the accompanying README.md and docs folder.", + "HelpExportCommand": "Exports a package.", + "HelpFormatManifestCommand": "Formats all vcpkg.json files. Run this before committing to vcpkg.", + "HelpHashCommand": "Hash a file by specific algorithm, default SHA512.", + "HelpHistoryCommand": "(Experimental) Show the history of CONTROL versions of a package.", + "HelpInitializeRegistryCommand": "Initializes a registry in the directory .", + "HelpInstallCommand": "Install a package.", + "HelpListCommand": "List installed packages.", + "HelpOwnsCommand": "Search for files in installed packages.", + "HelpRemoveCommand": "Uninstall a package.", + "HelpRemoveOutdatedCommand": "Uninstall all out-of-date packages.", + "HelpResponseFileCommand": "Specify a response file to provide additional parameters.", + "HelpSearchCommand": "Search for packages available to be built.", + "HelpTopicCommand": "Display help for a specific topic.", + "HelpTopicsCommand": "Display the list of help topics.", + "HelpUpdateCommand": "List Packages that can be updated.", + "HelpUpgradeCommand": "Rebuild all outdated packages.", + "HelpVersionCommand": "Display version information.", "IllegalFeatures": "List of features is not allowed in this context", "IllegalPlatformSpec": "Platform qualifier is not allowed in this context", "InfoSetEnvVar": "You can also set the environment variable '{env_var}' to your editor of choice.", diff --git a/locales/messages.json b/locales/messages.json index 3a063c0288..5c3f4b7e44 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -226,6 +226,30 @@ "_HashFileFailureToRead.comment": "Printed after ErrorMessage and before the specific failing filesystem operation (like file not found) An example of {path} is /foo/bar.", "HeaderOnlyUsage": "{package_name} is header-only and can be used from CMake via:", "_HeaderOnlyUsage.comment": "'header' refers to C/C++ .h files An example of {package_name} is zlib.", + "HelpContactCommand": "Display contact information to send feedback.", + "HelpCreateCommand": "Create a new package.", + "HelpDependInfoCommand": "Display a list of dependencies for packages.", + "HelpEditCommand": "Open up a port for editing (uses '{env_var}' default 'code'.", + "_HelpEditCommand.comment": "An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", + "HelpEnvCommand": "Creates a clean shell environment for development or compiling.", + "HelpExampleCommand": "For more help (including examples) see the accompanying README.md and docs folder.", + "HelpExportCommand": "Exports a package.", + "HelpFormatManifestCommand": "Formats all vcpkg.json files. Run this before committing to vcpkg.", + "HelpHashCommand": "Hash a file by specific algorithm, default SHA512.", + "HelpHistoryCommand": "(Experimental) Show the history of CONTROL versions of a package.", + "HelpInitializeRegistryCommand": "Initializes a registry in the directory .", + "HelpInstallCommand": "Install a package.", + "HelpListCommand": "List installed packages.", + "HelpOwnsCommand": "Search for files in installed packages.", + "HelpRemoveCommand": "Uninstall a package.", + "HelpRemoveOutdatedCommand": "Uninstall all out-of-date packages.", + "HelpResponseFileCommand": "Specify a response file to provide additional parameters.", + "HelpSearchCommand": "Search for packages available to be built.", + "HelpTopicCommand": "Display help for a specific topic.", + "HelpTopicsCommand": "Display the list of help topics.", + "HelpUpdateCommand": "List Packages that can be updated.", + "HelpUpgradeCommand": "Rebuild all outdated packages.", + "HelpVersionCommand": "Display version information.", "IllegalFeatures": "List of features is not allowed in this context", "IllegalPlatformSpec": "Platform qualifier is not allowed in this context", "InfoSetEnvVar": "You can also set the environment variable '{env_var}' to your editor of choice.", diff --git a/src/vcpkg/vcpkgcmdarguments.cpp b/src/vcpkg/vcpkgcmdarguments.cpp index ace207bed8..eebaaff0ff 100644 --- a/src/vcpkg/vcpkgcmdarguments.cpp +++ b/src/vcpkg/vcpkgcmdarguments.cpp @@ -15,9 +15,86 @@ namespace vcpkg DECLARE_AND_REGISTER_MESSAGE(HelpInstallCommand, (), "", "Install a package."); DECLARE_AND_REGISTER_MESSAGE(HelpRemoveCommand, (), "", "Uninstall a package."); DECLARE_AND_REGISTER_MESSAGE(HelpListCommand, (), "", "List installed packages."); - DECLARE_AND_REGISTER_MESSAGE(HelpUpdateCommand, (), "", "List Update packages."); + DECLARE_AND_REGISTER_MESSAGE(HelpUpdateCommand, (), "", "List Packages that can be updated."); DECLARE_AND_REGISTER_MESSAGE(HelpTopicsCommand, (), "", "Display the list of help topics."); DECLARE_AND_REGISTER_MESSAGE(HelpTopicCommand, (), "", "Display help for a specific topic."); + DECLARE_AND_REGISTER_MESSAGE(HelpRemoveOutdatedCommand, (), "", "Uninstall all out-of-date packages."); + DECLARE_AND_REGISTER_MESSAGE(HelpUpgradeCommand, (), "", "Rebuild all outdated packages."); + DECLARE_AND_REGISTER_MESSAGE(HelpHistoryCommand, + (), + "", + "(Experimental) Show the history of CONTROL versions of a package."); + DECLARE_AND_REGISTER_MESSAGE(HelpHashCommand, (), "", "Hash a file by specific algorithm, default SHA512."); + + DECLARE_AND_REGISTER_MESSAGE(HelpExportCommand, (), "", "Exports a package."); + DECLARE_AND_REGISTER_MESSAGE(HelpEditCommand, + (msg::env_var), + "", + "Open up a port for editing (uses '{env_var}' default 'code'."); + DECLARE_AND_REGISTER_MESSAGE(HelpCreateCommand, (), "", "Create a new package."); + DECLARE_AND_REGISTER_MESSAGE(HelpInitializeRegistryCommand, + (), + "", + "Initializes a registry in the directory ."); + DECLARE_AND_REGISTER_MESSAGE(HelpFormatManifestCommand, + (), + "", + "Formats all vcpkg.json files. Run this before committing to vcpkg."); + DECLARE_AND_REGISTER_MESSAGE(HelpOwnsCommand, (), "", "Search for files in installed packages."); + DECLARE_AND_REGISTER_MESSAGE(HelpDependInfoCommand, (), "", "Display a list of dependencies for packages."); + DECLARE_AND_REGISTER_MESSAGE(HelpEnvCommand, + (), + "", + "Creates a clean shell environment for development or compiling."); + DECLARE_AND_REGISTER_MESSAGE(HelpVersionCommand, (), "", "Display version information."); + DECLARE_AND_REGISTER_MESSAGE(HelpContactCommand, (), "", "Display contact information to send feedback."); + DECLARE_AND_REGISTER_MESSAGE(HelpResponseFileCommand, + (), + "", + "Specify a response file to provide additional parameters."); + DECLARE_AND_REGISTER_MESSAGE(HelpExampleCommand, + (), + "", + "For more help (including examples) see the accompanying README.md and docs folder."); + + DECLARE_AND_REGISTER_MESSAGE( + SpecifyTargetArch, + (msg::env_var), + "", + "Specify the target architecture triplet. See 'vcpkg help triplet'.\n(default: '{env_var}')"); + DECLARE_AND_REGISTER_MESSAGE( + SpecifyHostArch, + (msg::env_var), + "", + "Specify the host architecture triplet. See 'vcpkg help triplet'\n(default: '{env_var}')"); + DECLARE_AND_REGISTER_MESSAGE(SpecifyDirectoriesWhenSearching, + (msg::env_var), + "", + "Specify directories to be used when searching for ports\n(also: '{env_var}')"); + DECLARE_AND_REGISTER_MESSAGE(SpecifyDirectoriesContaining, + (msg::env_var), + "", + "Specifiy directories containing triplets files.\n(also: '{env_var}')"); + DECLARE_AND_REGISTER_MESSAGE(BinarySourcesArg, + (), + "", + "Add sources for binary caching. See 'vcpkg help binarycaching'"); + DECLARE_AND_REGISTER_MESSAGE(AssetSourcesArg, + (), + "", + "Add sources for asset caching. See 'vcpkg help assetcaching'"); + DECLARE_AND_REGISTER_MESSAGE(DownloadRootsDir, + (msg::env_var), + "", + "Specify the downloads root directory\n(default: '{env_var}')"); + DECLARE_AND_REGISTER_MESSAGE(VcpkgRootsDir, + (msg::env_var), + "", + "Specify the vcpkg root directory\n(default: '{env_var}')"); + DECLARE_AND_REGISTER_MESSAGE(BuildTreesRootDir, (), "", "(Experimental) Specify the buildtrees root directory"); + DECLARE_AND_REGISTER_MESSAGE(InstallRootDir, (), "", "(Experimental) Specify the install root directory"); + DECLARE_AND_REGISTER_MESSAGE(PackageRootDir, (), "", "(Experimental) Specify the packages root directory"); + DECLARE_AND_REGISTER_MESSAGE(JsonSwitch, (), "", "(Experimental) Request JSON output"); static void set_from_feature_flag(const std::vector& flags, StringView flag, Optional& place) { @@ -571,36 +648,36 @@ namespace vcpkg table.format("vcpkg install ...", msg::format(msgHelpInstallCommand)); table.format("vcpkg remove ...", msg::format(msgHelpRemoveCommand)); table.format("vcpkg update", msg::format(msgHelpUpdateCommand)); - table.format("vcpkg remove --outdated", "Uninstall all out-of-date packages"); - table.format("vcpkg upgrade", "Rebuild all outdated packages"); - table.format("vcpkg x-history ", "(Experimental) Shows the history of CONTROL versions of a package"); - table.format("vcpkg hash [alg]", "Hash a file by specific algorithm, default SHA512"); + table.format("vcpkg remove --outdated", msg::format(msgHelpRemoveOutdatedCommand)); + table.format("vcpkg upgrade", msg::format(msgHelpUpgradeCommand)); + table.format("vcpkg x-history ", msg::format(msgHelpHistoryCommand)); + table.format("vcpkg hash [alg]", msg::format(msgHelpHashCommand)); table.format("vcpkg help topics", msg::format(msgHelpTopicsCommand)); table.format("vcpkg help ", msg::format(msgHelpTopicCommand)); table.format("vcpkg list", msg::format(msgHelpListCommand)); table.blank(); Commands::Integrate::append_helpstring(table); table.blank(); - table.format("vcpkg export ... [opt]...", "Exports a package"); + table.format("vcpkg export ... [opt]...", msg::format(msgHelpExportCommand)); table.format("vcpkg edit ", - "Open up a port for editing (uses " + format_environment_variable("EDITOR") + ", default 'code')"); - table.format("vcpkg create [archivename]", "Create a new package"); - table.format("vcpkg x-init-registry ", "Initializes a registry in the directory "); - table.format("vcpkg format-manifest --all", - "Formats all vcpkg.json files. Run this before committing to vcpkg."); - table.format("vcpkg owns ", "Search for files in installed packages"); - table.format("vcpkg depend-info ...", "Display a list of dependencies for packages"); - table.format("vcpkg env", "Creates a clean shell environment for development or compiling"); - table.format("vcpkg version", "Display version information"); - table.format("vcpkg contact", "Display contact information to send feedback"); + msg::format(msgHelpEditCommand, msg::env_var = format_environment_variable("EDITOR"))); + table.format("vcpkg create [archivename]", msg::format(msgHelpCreateCommand)); + table.format("vcpkg x-init-registry ", msg::format(msgHelpInitializeRegistryCommand)); + table.format("vcpkg format-manifest --all", msg::format(msgHelpFormatManifestCommand)); + table.format("vcpkg owns ", msg::format(msgHelpOwnsCommand)); + table.format("vcpkg depend-info ...", msg::format(msgHelpDependInfoCommand)); + table.format("vcpkg env", msg::format(msgHelpEnvCommand)); + table.format("vcpkg version", msg::format(msgHelpVersionCommand)); + table.format("vcpkg contact", msg::format(msgHelpContactCommand)); table.blank(); table.header("Options"); VcpkgCmdArguments::append_common_options(table); table.blank(); - table.format("@response_file", "Specify a response file to provide additional parameters"); + table.format("@response_file", msg::format(msgHelpResponseFileCommand)); table.blank(); - table.example("For more help (including examples) see the accompanying README.md and docs folder."); - print2(table.m_str); + table.example(msg::format(msgHelpExampleCommand)); + + msg::println(LocalizedString::from_raw(table.m_str)); } void print_usage(const CommandStructure& command_structure) @@ -644,28 +721,28 @@ namespace vcpkg return Strings::concat("--", arg, joiner, value); }; - table.format(opt(TRIPLET_ARG, "=", ""), "Specify the target architecture triplet. See 'vcpkg help triplet'"); - table.format("", "(default: " + format_environment_variable("VCPKG_DEFAULT_TRIPLET") + ')'); - table.format(opt(HOST_TRIPLET_ARG, "=", ""), - "Specify the host architecture triplet. See 'vcpkg help triplet'"); - table.format("", "(default: " + format_environment_variable("VCPKG_DEFAULT_HOST_TRIPLET") + ')'); - table.format(opt(OVERLAY_PORTS_ARG, "=", ""), "Specify directories to be used when searching for ports"); - table.format("", "(also: " + format_environment_variable("VCPKG_OVERLAY_PORTS") + ')'); - table.format(opt(OVERLAY_TRIPLETS_ARG, "=", ""), "Specify directories containing triplets files"); - table.format("", "(also: " + format_environment_variable("VCPKG_OVERLAY_TRIPLETS") + ')'); - table.format(opt(BINARY_SOURCES_ARG, "=", ""), - "Add sources for binary caching. See 'vcpkg help binarycaching'"); - table.format(opt(ASSET_SOURCES_ARG, "=", ""), - "Add sources for asset caching. See 'vcpkg help assetcaching'"); - table.format(opt(DOWNLOADS_ROOT_DIR_ARG, "=", ""), "Specify the downloads root directory"); - table.format("", "(default: " + format_environment_variable("VCPKG_DOWNLOADS") + ')'); - table.format(opt(VCPKG_ROOT_DIR_ARG, "=", ""), "Specify the vcpkg root directory"); - table.format("", "(default: " + format_environment_variable("VCPKG_ROOT") + ')'); - table.format(opt(BUILDTREES_ROOT_DIR_ARG, "=", ""), - "(Experimental) Specify the buildtrees root directory"); - table.format(opt(INSTALL_ROOT_DIR_ARG, "=", ""), "(Experimental) Specify the install root directory"); - table.format(opt(PACKAGES_ROOT_DIR_ARG, "=", ""), "(Experimental) Specify the packages root directory"); - table.format(opt(JSON_SWITCH, "", ""), "(Experimental) Request JSON output"); + table.format( + opt(TRIPLET_ARG, "=", ""), + msg::format(msgSpecifyTargetArch, msg::env_var = format_environment_variable("VCPKG_DEFAULT_TRIPLET"))); + table.format( + opt(HOST_TRIPLET_ARG, "=", ""), + msg::format(msgSpecifyHostArch, msg::env_var = format_environment_variable("VCPKG_DEFAULT_HOST_TRIPLET"))); + table.format(opt(OVERLAY_PORTS_ARG, "=", ""), + msg::format(msgSpecifyDirectoriesWhenSearching, + msg::env_var = format_environment_variable("VCPKG_OVERLAY_PORTS"))); + table.format(opt(OVERLAY_TRIPLETS_ARG, "=", ""), + msg::format(msgSpecifyDirectoriesContaining, + msg::env_var = format_environment_variable("VCPKG_OVERLAY_TRIPLETS"))); + table.format(opt(BINARY_SOURCES_ARG, "=", ""), msg::format(msgBinarySourcesArg)); + table.format(opt(ASSET_SOURCES_ARG, "=", ""), msg::format(msgAssetSourcesArg)); + table.format(opt(DOWNLOADS_ROOT_DIR_ARG, "=", ""), + msg::format(msgDownloadRootsDir, msg::env_var = format_environment_variable("VCPKG_DOWNLOADS"))); + table.format(opt(VCPKG_ROOT_DIR_ARG, "=", ""), + msg::format(msgVcpkgRootsDir, msg::env_var = format_environment_variable("VCPKG_ROOT"))); + table.format(opt(BUILDTREES_ROOT_DIR_ARG, "=", ""), msg::format(msgBuildTreesRootDir)); + table.format(opt(INSTALL_ROOT_DIR_ARG, "=", ""), msg::format(msgInstallRootDir)); + table.format(opt(PACKAGES_ROOT_DIR_ARG, "=", ""), msg::format(msgPackageRootDir)); + table.format(opt(JSON_SWITCH, "", ""), msg::format(msgJsonSwitch)); } static void from_env(const std::function(ZStringView)>& f, From f4f2cee2a2d1b38324d4888a5c9c3f17ea430b73 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Mon, 11 Jul 2022 17:34:39 -0700 Subject: [PATCH 03/61] Adding messages --- locales/messages.en.json | 17 ++++++++++ locales/messages.json | 28 +++++++++++++++++ src/vcpkg/vcpkgcmdarguments.cpp | 55 ++++++++++++++++++++++----------- 3 files changed, 82 insertions(+), 18 deletions(-) diff --git a/locales/messages.en.json b/locales/messages.en.json index bc5fb137ae..e7c95e6b57 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -35,9 +35,11 @@ "AlreadyInstalled": "{spec} is already installed", "AlreadyInstalledNotHead": "{spec} is already installed -- not building from HEAD", "AnotherInstallationInProgress": "Another installation is in progress on the machine, sleeping 6s before retrying.", + "AssetSourcesArg": "Add sources for asset caching. See 'vcpkg help assetcaching'.", "AttemptingToFetchPackagesFromVendor": "Attempting to fetch {count} package(s) from {vendor}", "AuthenticationMayRequireManualAction": "One or more {vendor} credential providers requested manual action. Add the binary source 'interactive' to allow interactivity.", "AutoSettingEnvVar": "-- Automatically setting {env_var} environment variables to \"{url}\".", + "BinarySourcesArg": "Add sources for binary caching. See 'vcpkg help binarycaching'.", "BothYesAndNoOptionSpecifiedError": "cannot specify both --no-{option} and --{option}.", "BuildAlreadyInstalled": "{spec} is already installed; please remove {spec} before attempting to build it.", "BuildDependenciesMissing": "The build command requires all dependencies to be already installed.\nThe following dependencies are missing:", @@ -52,6 +54,7 @@ "BuildResultSucceeded": "SUCCEEDED", "BuildResultSummaryHeader": "SUMMARY FOR {triplet}", "BuildResultSummaryLine": "{build_result}: {count}", + "BuildTreesRootDir": "(Experimental) Specify the buildtrees root directory.", "BuildTroubleshootingMessage1": "Please ensure you're using the latest port files with `git pull` and `vcpkg update`.\nThen check for known issues at:", "BuildTroubleshootingMessage2": "You can submit a new issue at:", "BuildTroubleshootingMessage3": "Include '[{package_name}] Build error' in your bug report title, the following version information in your bug description, and attach any relevant failure logs from above.", @@ -73,14 +76,17 @@ "CmakeTargetsExcluded": "note: {count} additional targets are not displayed.", "CommandFailed": "command:\n{command_line}\nfailed with the following results:", "CompressFolderFailed": "Failed to compress folder '{path}':", + "ConflictingValuesForOption": "conflicting values specified for --'{value}'.", "CouldNotDeduceNugetIdAndVersion": "Could not deduce nuget id and version from filename: {path}", "CurlReportedUnexpectedResults": "curl has reported unexpected results to vcpkg and vcpkg cannot continue.\nPlease review the following text for sensitive information and open an issue on the Microsoft/vcpkg GitHub to help fix this problem!\ncmd: {command_line}\n=== curl output ===\n{actual}\n=== end curl output ===", "DefaultPathToBinaries": "Based on your system settings, the default path to store binaries is \n '{path}'. This consults %LOCALAPPDATA%/%APPDATA% on Windows and $XDG_CACHE_HOME or $HOME on other platforms.", "DetectCompilerHash": "Detecting compiler hash for triplet \"{triplet}\"...", "DownloadAvailable": "A downloadable copy of this tool is available and can be used by unsetting {env_var}.", + "DownloadRootsDir": "Specify the downloads root directory.\n(default: '{env_var}')", "DownloadedSources": "Downloaded sources for {spec}", "DownloadingVcpkgCeBundle": "Downloading vcpkg-ce bundle {version}...", "DownloadingVcpkgCeBundleLatest": "Downloading latest vcpkg-ce bundle...", + "DuplicateOptions": "--'{value}' specified multiple times.", "ElapsedForPackage": "Elapsed time to handle {spec}: {elapsed}", "EmptyLicenseExpression": "SPDX license expression was empty.", "EnvStrFailedToExtract": "could not expand the environment string:", @@ -106,6 +112,7 @@ "ExpectedFailOrSkip": "expected 'fail', 'skip', or 'pass' here", "ExpectedPortName": "expected a port name here", "ExpectedTripletName": "expected a triplet name here", + "ExpectedValueForOption": "expected value after '{value}.'", "ExtendedDocumenationAtUrl": "Extended documentation available at '{url}'.", "FailedToProvisionCe": "Failed to provision vcpkg-ce.", "FailedToRunToolToDetermineVersion": "Failed to run {path} to determine the {tool_name} version.", @@ -154,6 +161,7 @@ "IllegalFeatures": "List of features is not allowed in this context", "IllegalPlatformSpec": "Platform qualifier is not allowed in this context", "InfoSetEnvVar": "You can also set the environment variable '{env_var}' to your editor of choice.", + "InstallRootDir": "(Experimental) Specify the install root directory.", "InstallWithSystemManager": "You may be able to install this tool via your system package manager.", "InstallWithSystemManagerMono": "Ubuntu 18.04 users may need a newer version of mono, available at {url}.", "InstallWithSystemManagerPkg": "You may be able to install this tool via your system package manager ({command_line}).", @@ -178,6 +186,7 @@ "JsonErrorFailedToParse": "failed to parse {path}:", "JsonErrorFailedToRead": "failed to read {path}: {error_msg}", "JsonErrorMustBeAnObject": "Expected {path} to be an object.", + "JsonSwitch": "(Experimental) Request JSON output.", "LaunchingProgramFailed": "Launching {tool_name}:", "LicenseExpressionContainsExtraPlus": "SPDX license expression contains an extra '+'. These are only allowed directly after a license identifier.", "LicenseExpressionContainsInvalidCharacter": "SPDX license expression contains an invalid character (0x{value:02X} '{value}').", @@ -205,6 +214,7 @@ "NoLocalizationForMessages": "No localized messages for the following: ", "NoRegistryForPort": "no registry configured for port {package_name}", "NoteMessage": "note: ", + "PackageRootDir": "(Experimental) Specify the packages root directory.", "PackingVendorFailed": "Packing {vendor} failed. Use --debug for more information.", "ParseControlErrorInfoInvalidFields": "The following fields were not expected:", "ParseControlErrorInfoMissingFields": "The following fields were missing:", @@ -225,16 +235,22 @@ "SeeURL": "See {url} for more information.", "SettingEnvVar": "-- Setting \"{env_var}\" environment variables to \"{url}\".", "SourceFieldPortNameMismatch": "The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json file has the name {package_name} and does not match the port directory {path}.", + "SpecifyDirectoriesContaining": "Specifiy directories containing triplets files.\n(also: '{env_var}')", + "SpecifyDirectoriesWhenSearching": "Specify directories to be used when searching for ports.\n(also: '{env_var}')", + "SpecifyHostArch": "Specify the host architecture triplet. See 'vcpkg help triplet'.\n(default: '{env_var}')", + "SpecifyTargetArch": "Specify the target architecture triplet. See 'vcpkg help triplet'.\n(default: '{env_var}')", "StoredBinaryCache": "Stored binary cache: '{path}'", "SystemApiErrorMessage": "calling {system_api} failed with {exit_code} ({error_msg})", "ToolFetchFailed": "Could not fetch {tool_name}.", "ToolInWin10": "This utility is bundled with Windows 10 or later.", + "TwoFeatureFlagsSpecified": "Both '{value}' and -'{value}' were specified as feature flags.", "UnexpectedErrorDuringBulkDownload": "an unexpected error occurred during bulk download.", "UnexpectedToolOutput": "{tool_name} ({path}) produced unexpected output when attempting to determine the version:", "UnknownBaselineFileContent": "unrecognizable baseline entry; expected 'port:triplet=(fail|skip|pass)'", "UnknownBinaryProviderType": "unknown binary provider type: valid providers are 'clear', 'default', 'nuget', 'nugetconfig','nugettimeout', 'interactive', 'x-azblob', 'x-gcs', 'x-aws', 'x-aws-config', 'http', and 'files'", "UnknownTool": "vcpkg does not have a definition of this tool for this platform.", "UnknownVariablesInTemplate": "invalid argument: url template '{value}' contains unknown variables: {list}", + "UnsupportedShortOptions": "short options are not supported: '{value}'", "UnsupportedSystemName": "Could not map VCPKG_CMAKE_SYSTEM_NAME '{system_name}' to a vcvarsall platform. Supported system names are '', 'Windows' and 'WindowsStore'.", "UnsupportedToolchain": "in triplet {triplet}: Unable to find a valid toolchain for requested target architecture {arch}.\nThe selected Visual Studio instance is at: {path}\nThe available toolchain combinations are: {list}", "UpdateBaselineAddBaselineNoManifest": "the --{option} switch was passed, but there is no manifest file to add a `builtin-baseline` field to.", @@ -259,6 +275,7 @@ "VcpkgDisallowedClassicMode": "Could not locate a manifest (vcpkg.json) above the current working directory.\nThis vcpkg distribution does not have a classic mode instance.", "VcpkgHasCrashed": "vcpkg has crashed. Please create an issue at https://github.com/microsoft/vcpkg containing a brief summary of what you were trying to do and the following information.", "VcpkgInvalidCommand": "invalid command: {command_name}", + "VcpkgRootsDir": "Specify the vcpkg root directory.\n(default: '{env_var}')", "VcpkgSendMetricsButDisabled": "passed --sendmetrics, but metrics are disabled.", "VersionCommandHeader": "vcpkg package management program version {version}\n\nSee LICENSE.txt for license information.", "VersionConstraintViolated": "dependency {spec} was expected to be at least version {expected_version}, but is currently {actual_version}.", diff --git a/locales/messages.json b/locales/messages.json index 5c3f4b7e44..f36a877ee0 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -63,12 +63,14 @@ "AlreadyInstalledNotHead": "{spec} is already installed -- not building from HEAD", "_AlreadyInstalledNotHead.comment": "'HEAD' means the most recent version of source code An example of {spec} is zlib:x64-windows.", "AnotherInstallationInProgress": "Another installation is in progress on the machine, sleeping 6s before retrying.", + "AssetSourcesArg": "Add sources for asset caching. See 'vcpkg help assetcaching'.", "AttemptingToFetchPackagesFromVendor": "Attempting to fetch {count} package(s) from {vendor}", "_AttemptingToFetchPackagesFromVendor.comment": "An example of {count} is 42. An example of {vendor} is Azure.", "AuthenticationMayRequireManualAction": "One or more {vendor} credential providers requested manual action. Add the binary source 'interactive' to allow interactivity.", "_AuthenticationMayRequireManualAction.comment": "An example of {vendor} is Azure.", "AutoSettingEnvVar": "-- Automatically setting {env_var} environment variables to \"{url}\".", "_AutoSettingEnvVar.comment": "An example of env_var is \"HTTP(S)_PROXY\"'--' at the beginning must be preserved An example of {env_var} is VCPKG_DEFAULT_TRIPLET. An example of {url} is https://github.com/microsoft/vcpkg.", + "BinarySourcesArg": "Add sources for binary caching. See 'vcpkg help binarycaching'.", "BothYesAndNoOptionSpecifiedError": "cannot specify both --no-{option} and --{option}.", "_BothYesAndNoOptionSpecifiedError.comment": "An example of {option} is editable.", "BuildAlreadyInstalled": "{spec} is already installed; please remove {spec} before attempting to build it.", @@ -96,6 +98,7 @@ "_BuildResultSummaryHeader.comment": "Displayed before a list of a summary installation results. An example of {triplet} is x64-windows.", "BuildResultSummaryLine": "{build_result}: {count}", "_BuildResultSummaryLine.comment": "Displayed to show a count of results of a build_result in a summary. An example of {build_result} is One of the BuildResultXxx messages (such as BuildResultSucceeded/SUCCEEDED). An example of {count} is 42.", + "BuildTreesRootDir": "(Experimental) Specify the buildtrees root directory.", "BuildTroubleshootingMessage1": "Please ensure you're using the latest port files with `git pull` and `vcpkg update`.\nThen check for known issues at:", "_BuildTroubleshootingMessage1.comment": "First part of build troubleshooting message, printed before the URI to look for existing bugs.", "BuildTroubleshootingMessage2": "You can submit a new issue at:", @@ -134,6 +137,8 @@ "_CommandFailed.comment": "An example of {command_line} is vcpkg install zlib.", "CompressFolderFailed": "Failed to compress folder '{path}':", "_CompressFolderFailed.comment": "An example of {path} is /foo/bar.", + "ConflictingValuesForOption": "conflicting values specified for --'{value}'.", + "_ConflictingValuesForOption.comment": "'{value}' is a command option.", "CouldNotDeduceNugetIdAndVersion": "Could not deduce nuget id and version from filename: {path}", "_CouldNotDeduceNugetIdAndVersion.comment": "An example of {path} is /foo/bar.", "CurlReportedUnexpectedResults": "curl has reported unexpected results to vcpkg and vcpkg cannot continue.\nPlease review the following text for sensitive information and open an issue on the Microsoft/vcpkg GitHub to help fix this problem!\ncmd: {command_line}\n=== curl output ===\n{actual}\n=== end curl output ===", @@ -144,12 +149,16 @@ "_DetectCompilerHash.comment": "An example of {triplet} is x64-windows.", "DownloadAvailable": "A downloadable copy of this tool is available and can be used by unsetting {env_var}.", "_DownloadAvailable.comment": "An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", + "DownloadRootsDir": "Specify the downloads root directory.\n(default: '{env_var}')", + "_DownloadRootsDir.comment": "An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", "DownloadedSources": "Downloaded sources for {spec}", "_DownloadedSources.comment": "An example of {spec} is zlib:x64-windows.", "DownloadingVcpkgCeBundle": "Downloading vcpkg-ce bundle {version}...", "_DownloadingVcpkgCeBundle.comment": "An example of {version} is 1.3.8.", "DownloadingVcpkgCeBundleLatest": "Downloading latest vcpkg-ce bundle...", "_DownloadingVcpkgCeBundleLatest.comment": "This message is normally displayed only in development.", + "DuplicateOptions": "--'{value}' specified multiple times.", + "_DuplicateOptions.comment": "'{value}' is a command option.", "ElapsedForPackage": "Elapsed time to handle {spec}: {elapsed}", "_ElapsedForPackage.comment": "An example of {spec} is zlib:x64-windows. An example of {elapsed} is 3.532 min.", "EmptyLicenseExpression": "SPDX license expression was empty.", @@ -189,6 +198,8 @@ "ExpectedFailOrSkip": "expected 'fail', 'skip', or 'pass' here", "ExpectedPortName": "expected a port name here", "ExpectedTripletName": "expected a triplet name here", + "ExpectedValueForOption": "expected value after '{value}.'", + "_ExpectedValueForOption.comment": "'{value}' is a command option.", "ExtendedDocumenationAtUrl": "Extended documentation available at '{url}'.", "_ExtendedDocumenationAtUrl.comment": "An example of {url} is https://github.com/microsoft/vcpkg.", "FailedToProvisionCe": "Failed to provision vcpkg-ce.", @@ -254,6 +265,7 @@ "IllegalPlatformSpec": "Platform qualifier is not allowed in this context", "InfoSetEnvVar": "You can also set the environment variable '{env_var}' to your editor of choice.", "_InfoSetEnvVar.comment": "In this context 'editor' means IDE An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", + "InstallRootDir": "(Experimental) Specify the install root directory.", "InstallWithSystemManager": "You may be able to install this tool via your system package manager.", "InstallWithSystemManagerMono": "Ubuntu 18.04 users may need a newer version of mono, available at {url}.", "_InstallWithSystemManagerMono.comment": "An example of {url} is https://github.com/microsoft/vcpkg.", @@ -298,6 +310,7 @@ "_JsonErrorFailedToRead.comment": "An example of {path} is /foo/bar. An example of {error_msg} is File Not Found.", "JsonErrorMustBeAnObject": "Expected {path} to be an object.", "_JsonErrorMustBeAnObject.comment": "An example of {path} is /foo/bar.", + "JsonSwitch": "(Experimental) Request JSON output.", "LaunchingProgramFailed": "Launching {tool_name}:", "_LaunchingProgramFailed.comment": "A platform API call failure message is appended after this An example of {tool_name} is aria2.", "LicenseExpressionContainsExtraPlus": "SPDX license expression contains an extra '+'. These are only allowed directly after a license identifier.", @@ -341,6 +354,7 @@ "NoRegistryForPort": "no registry configured for port {package_name}", "_NoRegistryForPort.comment": "An example of {package_name} is zlib.", "NoteMessage": "note: ", + "PackageRootDir": "(Experimental) Specify the packages root directory.", "PackingVendorFailed": "Packing {vendor} failed. Use --debug for more information.", "_PackingVendorFailed.comment": "An example of {vendor} is Azure.", "ParseControlErrorInfoInvalidFields": "The following fields were not expected:", @@ -377,6 +391,14 @@ "_SettingEnvVar.comment": "An example of env_var is \"HTTP(S)_PROXY\"'--' at the beginning must be preserved An example of {env_var} is VCPKG_DEFAULT_TRIPLET. An example of {url} is https://github.com/microsoft/vcpkg.", "SourceFieldPortNameMismatch": "The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json file has the name {package_name} and does not match the port directory {path}.", "_SourceFieldPortNameMismatch.comment": "{package_name} and {path} are both names of installable ports/packages. 'Source', 'CONTROL', 'vcpkg.json', and 'name' references are locale-invariant. An example of {package_name} is zlib. An example of {path} is /foo/bar.", + "SpecifyDirectoriesContaining": "Specifiy directories containing triplets files.\n(also: '{env_var}')", + "_SpecifyDirectoriesContaining.comment": "An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", + "SpecifyDirectoriesWhenSearching": "Specify directories to be used when searching for ports.\n(also: '{env_var}')", + "_SpecifyDirectoriesWhenSearching.comment": "An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", + "SpecifyHostArch": "Specify the host architecture triplet. See 'vcpkg help triplet'.\n(default: '{env_var}')", + "_SpecifyHostArch.comment": "An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", + "SpecifyTargetArch": "Specify the target architecture triplet. See 'vcpkg help triplet'.\n(default: '{env_var}')", + "_SpecifyTargetArch.comment": "An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", "StoredBinaryCache": "Stored binary cache: '{path}'", "_StoredBinaryCache.comment": "An example of {path} is /foo/bar.", "SystemApiErrorMessage": "calling {system_api} failed with {exit_code} ({error_msg})", @@ -384,6 +406,8 @@ "ToolFetchFailed": "Could not fetch {tool_name}.", "_ToolFetchFailed.comment": "An example of {tool_name} is aria2.", "ToolInWin10": "This utility is bundled with Windows 10 or later.", + "TwoFeatureFlagsSpecified": "Both '{value}' and -'{value}' were specified as feature flags.", + "_TwoFeatureFlagsSpecified.comment": "'{value}' is a feature flag.", "UnexpectedErrorDuringBulkDownload": "an unexpected error occurred during bulk download.", "UnexpectedToolOutput": "{tool_name} ({path}) produced unexpected output when attempting to determine the version:", "_UnexpectedToolOutput.comment": "The actual command line output will be appended after this message. An example of {tool_name} is aria2. An example of {path} is /foo/bar.", @@ -392,6 +416,8 @@ "UnknownTool": "vcpkg does not have a definition of this tool for this platform.", "UnknownVariablesInTemplate": "invalid argument: url template '{value}' contains unknown variables: {list}", "_UnknownVariablesInTemplate.comment": "{value} is the value provided by the user and {list} a list of unknown variables seperated by comma", + "UnsupportedShortOptions": "short options are not supported: '{value}'", + "_UnsupportedShortOptions.comment": "'{value}' is the short option given", "UnsupportedSystemName": "Could not map VCPKG_CMAKE_SYSTEM_NAME '{system_name}' to a vcvarsall platform. Supported system names are '', 'Windows' and 'WindowsStore'.", "_UnsupportedSystemName.comment": "An example of {system_name} is Darwin.", "UnsupportedToolchain": "in triplet {triplet}: Unable to find a valid toolchain for requested target architecture {arch}.\nThe selected Visual Studio instance is at: {path}\nThe available toolchain combinations are: {list}", @@ -433,6 +459,8 @@ "_VcpkgHasCrashed.comment": "Printed at the start of a crash report.", "VcpkgInvalidCommand": "invalid command: {command_name}", "_VcpkgInvalidCommand.comment": "An example of {command_name} is install.", + "VcpkgRootsDir": "Specify the vcpkg root directory.\n(default: '{env_var}')", + "_VcpkgRootsDir.comment": "An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", "VcpkgSendMetricsButDisabled": "passed --sendmetrics, but metrics are disabled.", "VersionCommandHeader": "vcpkg package management program version {version}\n\nSee LICENSE.txt for license information.", "_VersionCommandHeader.comment": "An example of {version} is 1.3.8.", diff --git a/src/vcpkg/vcpkgcmdarguments.cpp b/src/vcpkg/vcpkgcmdarguments.cpp index eebaaff0ff..cd0e4df1ff 100644 --- a/src/vcpkg/vcpkgcmdarguments.cpp +++ b/src/vcpkg/vcpkgcmdarguments.cpp @@ -66,11 +66,11 @@ namespace vcpkg SpecifyHostArch, (msg::env_var), "", - "Specify the host architecture triplet. See 'vcpkg help triplet'\n(default: '{env_var}')"); + "Specify the host architecture triplet. See 'vcpkg help triplet'.\n(default: '{env_var}')"); DECLARE_AND_REGISTER_MESSAGE(SpecifyDirectoriesWhenSearching, (msg::env_var), "", - "Specify directories to be used when searching for ports\n(also: '{env_var}')"); + "Specify directories to be used when searching for ports.\n(also: '{env_var}')"); DECLARE_AND_REGISTER_MESSAGE(SpecifyDirectoriesContaining, (msg::env_var), "", @@ -78,24 +78,43 @@ namespace vcpkg DECLARE_AND_REGISTER_MESSAGE(BinarySourcesArg, (), "", - "Add sources for binary caching. See 'vcpkg help binarycaching'"); + "Add sources for binary caching. See 'vcpkg help binarycaching'."); DECLARE_AND_REGISTER_MESSAGE(AssetSourcesArg, (), "", - "Add sources for asset caching. See 'vcpkg help assetcaching'"); + "Add sources for asset caching. See 'vcpkg help assetcaching'."); DECLARE_AND_REGISTER_MESSAGE(DownloadRootsDir, (msg::env_var), "", - "Specify the downloads root directory\n(default: '{env_var}')"); + "Specify the downloads root directory.\n(default: '{env_var}')"); DECLARE_AND_REGISTER_MESSAGE(VcpkgRootsDir, (msg::env_var), "", - "Specify the vcpkg root directory\n(default: '{env_var}')"); - DECLARE_AND_REGISTER_MESSAGE(BuildTreesRootDir, (), "", "(Experimental) Specify the buildtrees root directory"); - DECLARE_AND_REGISTER_MESSAGE(InstallRootDir, (), "", "(Experimental) Specify the install root directory"); - DECLARE_AND_REGISTER_MESSAGE(PackageRootDir, (), "", "(Experimental) Specify the packages root directory"); - DECLARE_AND_REGISTER_MESSAGE(JsonSwitch, (), "", "(Experimental) Request JSON output"); - + "Specify the vcpkg root directory.\n(default: '{env_var}')"); + DECLARE_AND_REGISTER_MESSAGE(BuildTreesRootDir, (), "", "(Experimental) Specify the buildtrees root directory."); + DECLARE_AND_REGISTER_MESSAGE(InstallRootDir, (), "", "(Experimental) Specify the install root directory."); + DECLARE_AND_REGISTER_MESSAGE(PackageRootDir, (), "", "(Experimental) Specify the packages root directory."); + DECLARE_AND_REGISTER_MESSAGE(JsonSwitch, (), "", "(Experimental) Request JSON output."); + DECLARE_AND_REGISTER_MESSAGE(TwoFeatureFlagsSpecified, + (msg::value), + "'{value}' is a feature flag.", + "Both '{value}' and -'{value}' were specified as feature flags."); + DECLARE_AND_REGISTER_MESSAGE(DuplicateOptions, + (msg::value), + "'{value}' is a command option.", + "--'{value}' specified multiple times."); + DECLARE_AND_REGISTER_MESSAGE(ConflictingValuesForOption, + (msg::value), + "'{value}' is a command option.", + "conflicting values specified for --'{value}'."); + DECLARE_AND_REGISTER_MESSAGE(ExpectedValueForOption, + (msg::value), + "'{value}' is a command option.", + "expected value after '{value}.'"); + DECLARE_AND_REGISTER_MESSAGE(UnsupportedShortOptions, + (msg::value), + "'{value}' is the short option given", + "short options are not supported: '{value}'"); static void set_from_feature_flag(const std::vector& flags, StringView flag, Optional& place) { if (!place.has_value()) @@ -112,7 +131,7 @@ namespace vcpkg { if (place.has_value()) { - vcpkg::printf(Color::error, "Error: both %s and -%s were specified as feature flags\n", flag, flag); + msg::println_error(msgTwoFeatureFlagsSpecified, msg::value = flag); LockGuardPtr(g_metrics)->track_property("error", "error feature flag +-" + flag.to_string()); Checks::exit_fail(VCPKG_LINE_INFO); @@ -152,7 +171,7 @@ namespace vcpkg { if (nullptr != option_field) { - vcpkg::printf(Color::error, "Error: --%s specified multiple times\n", option_name); + msg::println_error(msgDuplicateOptions, msg::value = option_name); LockGuardPtr(g_metrics)->track_property("error", "error option specified multiple times"); print_usage(); Checks::exit_fail(VCPKG_LINE_INFO); @@ -165,7 +184,7 @@ namespace vcpkg { if (option_field && option_field != new_setting) { - print2(Color::error, "Error: conflicting values specified for --", option_name, '\n'); + msg::println_error(msgConflictingValuesForOption, msg::value = option_name); LockGuardPtr(g_metrics)->track_property("error", "error conflicting switches"); print_usage(); Checks::exit_fail(VCPKG_LINE_INFO); @@ -179,7 +198,7 @@ namespace vcpkg { if (new_value.size() == 0) { - print2(Color::error, "Error: expected value after ", option_name, '\n'); + msg::println_error(msgExpectedValueForOption, msg::value = option_name); LockGuardPtr(g_metrics)->track_property("error", "error option name"); print_usage(); Checks::exit_fail(VCPKG_LINE_INFO); @@ -194,7 +213,7 @@ namespace vcpkg { if (new_value.size() == 0) { - print2(Color::error, "Error: expected value after ", option_name, '\n'); + msg::println_error(msgExpectedValueForOption, msg::value = option_name); LockGuardPtr(g_metrics)->track_property("error", "error option name"); print_usage(); Checks::exit_fail(VCPKG_LINE_INFO); @@ -261,7 +280,7 @@ namespace vcpkg return TryParseArgumentResult::FoundAndConsumedLookahead; } - print2(Color::error, "Error: expected value after ", option, '\n'); + msg::println_error(msgExpectedValueForOption, msg::value = option); LockGuardPtr(g_metrics)->track_property("error", "error option name"); print_usage(); Checks::exit_fail(VCPKG_LINE_INFO); @@ -336,7 +355,7 @@ namespace vcpkg if (basic_arg.size() >= 2 && basic_arg[0] == '-' && basic_arg[1] != '-') { LockGuardPtr(g_metrics)->track_property("error", "error short options are not supported"); - Checks::exit_with_message(VCPKG_LINE_INFO, "Error: short options are not supported: %s", basic_arg); + Checks::msg_exit_with_message(VCPKG_LINE_INFO, msgUnsupportedShortOptions, msg::value = basic_arg); } if (basic_arg.size() < 2 || basic_arg[0] != '-') From d840466b668dc8b11ed621b24502dffed00ea20c Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Mon, 11 Jul 2022 18:11:19 -0700 Subject: [PATCH 04/61] WIP: Added message --- locales/messages.en.json | 5 ++ locales/messages.json | 10 ++++ src/vcpkg/vcpkgcmdarguments.cpp | 86 ++++++++++++++++++++------------- 3 files changed, 67 insertions(+), 34 deletions(-) diff --git a/locales/messages.en.json b/locales/messages.en.json index e7c95e6b57..fcd2cbce2b 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -86,8 +86,10 @@ "DownloadedSources": "Downloaded sources for {spec}", "DownloadingVcpkgCeBundle": "Downloading vcpkg-ce bundle {version}...", "DownloadingVcpkgCeBundleLatest": "Downloading latest vcpkg-ce bundle...", + "DuplicateCommandOption": "The option '{command_name}'can only be passed once.", "DuplicateOptions": "--'{value}' specified multiple times.", "ElapsedForPackage": "Elapsed time to handle {spec}: {elapsed}", + "EmptyArg": "The option '{command_name}'must be passed a non-empty argument.", "EmptyLicenseExpression": "SPDX license expression was empty.", "EnvStrFailedToExtract": "could not expand the environment string:", "ErrorDetectingCompilerInfo": "while detecting compiler information:\nThe log file content at \"{path}\" is:", @@ -160,6 +162,7 @@ "HelpVersionCommand": "Display version information.", "IllegalFeatures": "List of features is not allowed in this context", "IllegalPlatformSpec": "Platform qualifier is not allowed in this context", + "IncorrectNumberOfArgs": "'{command_name}' requires '{count}' arguments, but '{count}' were provided.", "InfoSetEnvVar": "You can also set the environment variable '{env_var}' to your editor of choice.", "InstallRootDir": "(Experimental) Specify the install root directory.", "InstallWithSystemManager": "You may be able to install this tool via your system package manager.", @@ -211,6 +214,7 @@ "LocalizedMessageMustNotEndWithNewline": "The message named {value} ends with a newline which should be added by formatting rather than by localization.", "MonoInstructions": "This may be caused by an incomplete mono installation. Full mono is available on some systems via `sudo apt install mono-complete`. Ubuntu 18.04 users may need a newer version of mono, available at https://www.mono-project.com/download/stable/", "MsiexecFailedToExtract": "msiexec failed while extracting '{path}' with launch or exit code {exit_code} and message:", + "NoArgumentsForOption": "The option '{command_name}' does not accept an argument.", "NoLocalizationForMessages": "No localized messages for the following: ", "NoRegistryForPort": "no registry configured for port {package_name}", "NoteMessage": "note: ", @@ -248,6 +252,7 @@ "UnexpectedToolOutput": "{tool_name} ({path}) produced unexpected output when attempting to determine the version:", "UnknownBaselineFileContent": "unrecognizable baseline entry; expected 'port:triplet=(fail|skip|pass)'", "UnknownBinaryProviderType": "unknown binary provider type: valid providers are 'clear', 'default', 'nuget', 'nugetconfig','nugettimeout', 'interactive', 'x-azblob', 'x-gcs', 'x-aws', 'x-aws-config', 'http', and 'files'", + "UnknownOptions": "Unknown option(s) for command '{command_name}':", "UnknownTool": "vcpkg does not have a definition of this tool for this platform.", "UnknownVariablesInTemplate": "invalid argument: url template '{value}' contains unknown variables: {list}", "UnsupportedShortOptions": "short options are not supported: '{value}'", diff --git a/locales/messages.json b/locales/messages.json index f36a877ee0..5035461ece 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -157,10 +157,14 @@ "_DownloadingVcpkgCeBundle.comment": "An example of {version} is 1.3.8.", "DownloadingVcpkgCeBundleLatest": "Downloading latest vcpkg-ce bundle...", "_DownloadingVcpkgCeBundleLatest.comment": "This message is normally displayed only in development.", + "DuplicateCommandOption": "The option '{command_name}'can only be passed once.", + "_DuplicateCommandOption.comment": "An example of {command_name} is install.", "DuplicateOptions": "--'{value}' specified multiple times.", "_DuplicateOptions.comment": "'{value}' is a command option.", "ElapsedForPackage": "Elapsed time to handle {spec}: {elapsed}", "_ElapsedForPackage.comment": "An example of {spec} is zlib:x64-windows. An example of {elapsed} is 3.532 min.", + "EmptyArg": "The option '{command_name}'must be passed a non-empty argument.", + "_EmptyArg.comment": "An example of {command_name} is install.", "EmptyLicenseExpression": "SPDX license expression was empty.", "EnvStrFailedToExtract": "could not expand the environment string:", "ErrorDetectingCompilerInfo": "while detecting compiler information:\nThe log file content at \"{path}\" is:", @@ -263,6 +267,8 @@ "HelpVersionCommand": "Display version information.", "IllegalFeatures": "List of features is not allowed in this context", "IllegalPlatformSpec": "Platform qualifier is not allowed in this context", + "IncorrectNumberOfArgs": "'{command_name}' requires '{count}' arguments, but '{count}' were provided.", + "_IncorrectNumberOfArgs.comment": "An example of {command_name} is install. An example of {count} is 42. An example of {count} is 42.", "InfoSetEnvVar": "You can also set the environment variable '{env_var}' to your editor of choice.", "_InfoSetEnvVar.comment": "In this context 'editor' means IDE An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", "InstallRootDir": "(Experimental) Specify the install root directory.", @@ -350,6 +356,8 @@ "MonoInstructions": "This may be caused by an incomplete mono installation. Full mono is available on some systems via `sudo apt install mono-complete`. Ubuntu 18.04 users may need a newer version of mono, available at https://www.mono-project.com/download/stable/", "MsiexecFailedToExtract": "msiexec failed while extracting '{path}' with launch or exit code {exit_code} and message:", "_MsiexecFailedToExtract.comment": "An example of {path} is /foo/bar. An example of {exit_code} is 127.", + "NoArgumentsForOption": "The option '{command_name}' does not accept an argument.", + "_NoArgumentsForOption.comment": "An example of {command_name} is install.", "NoLocalizationForMessages": "No localized messages for the following: ", "NoRegistryForPort": "no registry configured for port {package_name}", "_NoRegistryForPort.comment": "An example of {package_name} is zlib.", @@ -413,6 +421,8 @@ "_UnexpectedToolOutput.comment": "The actual command line output will be appended after this message. An example of {tool_name} is aria2. An example of {path} is /foo/bar.", "UnknownBaselineFileContent": "unrecognizable baseline entry; expected 'port:triplet=(fail|skip|pass)'", "UnknownBinaryProviderType": "unknown binary provider type: valid providers are 'clear', 'default', 'nuget', 'nugetconfig','nugettimeout', 'interactive', 'x-azblob', 'x-gcs', 'x-aws', 'x-aws-config', 'http', and 'files'", + "UnknownOptions": "Unknown option(s) for command '{command_name}':", + "_UnknownOptions.comment": "An example of {command_name} is install.", "UnknownTool": "vcpkg does not have a definition of this tool for this platform.", "UnknownVariablesInTemplate": "invalid argument: url template '{value}' contains unknown variables: {list}", "_UnknownVariablesInTemplate.comment": "{value} is the value provided by the user and {list} a list of unknown variables seperated by comma", diff --git a/src/vcpkg/vcpkgcmdarguments.cpp b/src/vcpkg/vcpkgcmdarguments.cpp index cd0e4df1ff..98450a59f6 100644 --- a/src/vcpkg/vcpkgcmdarguments.cpp +++ b/src/vcpkg/vcpkgcmdarguments.cpp @@ -115,6 +115,32 @@ namespace vcpkg (msg::value), "'{value}' is the short option given", "short options are not supported: '{value}'"); + DECLARE_AND_REGISTER_MESSAGE(IncorrectNumberOfArgs, + (msg::command_name, msg::count, msg::count), + "", + "'{command_name}' requires '{count}' arguments, but '{count}' were provided."); + DECLARE_AND_REGISTER_MESSAGE(NoArgumentsForOption, + (msg::command_name), + "", + "The option '{command_name}' does not accept an argument."); + DECLARE_AND_REGISTER_MESSAGE(DuplicateCommandOption, + (msg::command_name), + "", + "The option '{command_name}'can only be passed once."); + DECLARE_AND_REGISTER_MESSAGE(EmptyArg, + (msg::command_name), + "", + "The option '{command_name}'must be passed a non-empty argument."); + DECLARE_AND_REGISTER_MESSAGE(UnknownOptions, + (msg::command_name), + "", + "Unknown option(s) for command '{command_name}':"); + DECLARE_AND_REGISTER_MESSAGE( + SpecifiedFeatureTurnedOff, + (msg::command_name, msg::command_name), + "", + "'{command_name}' feature specifically turned off, but --'{command_name}' was specified."); + DECLARE_AND_REGISTER_MESSAGE(DefaultFlag, (msg::command_name), "", "Defaulting to '{command_name}' being on."); static void set_from_feature_flag(const std::vector& flags, StringView flag, Optional& place) { if (!place.has_value()) @@ -498,11 +524,10 @@ namespace vcpkg { if (actual_arg_count != command_structure.minimum_arity) { - vcpkg::printf(Color::error, - "Error: '%s' requires %u arguments, but %u were provided.\n", - this->command, - command_structure.minimum_arity, - actual_arg_count); + msg::println_error(msgIncorrectNumberOfArgs, + msg::command_name = this->command, + msg::count = command_structure.minimum_arity, + msg::count = actual_arg_count); failed = true; } } @@ -510,20 +535,18 @@ namespace vcpkg { if (actual_arg_count < command_structure.minimum_arity) { - vcpkg::printf(Color::error, - "Error: '%s' requires at least %u arguments, but %u were provided\n", - this->command, - command_structure.minimum_arity, - actual_arg_count); + msg::println_error(msgIncorrectNumberOfArgs, + msg::command_name = this->command, + msg::count = command_structure.minimum_arity, + msg::count = actual_arg_count); failed = true; } if (actual_arg_count > command_structure.maximum_arity) { - vcpkg::printf(Color::error, - "Error: '%s' requires at most %u arguments, but %u were provided\n", - this->command, - command_structure.maximum_arity, - actual_arg_count); + msg::println_error(msgIncorrectNumberOfArgs, + msg::command_name = this->command, + msg::count = command_structure.minimum_arity, + msg::count = actual_arg_count); failed = true; } } @@ -553,7 +576,7 @@ namespace vcpkg if (option_it != options_copy.end()) { // This means that the switch was passed like '--a=xyz' - vcpkg::printf(Color::error, "Error: The option '--%s' does not accept an argument.\n", switch_.name); + msg::println_error(msgNoArgumentsForOption, msg::command_name = switch_.name); options_copy.erase(option_it); failed = true; } @@ -572,14 +595,13 @@ namespace vcpkg if (value.size() > 1) { - vcpkg::printf(Color::error, "Error: The option '%s' can only be passed once.\n", option.name); + msg::println_error(msgDuplicateCommandOption, msg::command_name = option.name); failed = true; } else if (value.front().empty()) { // Fail when not given a value, e.g.: "vcpkg install sqlite3 --additional-ports=" - vcpkg::printf( - Color::error, "Error: The option '--%s' must be passed a non-empty argument.\n", option.name); + msg::println_error(msgEmptyArg, msg::command_name = option.name); failed = true; } else @@ -592,7 +614,7 @@ namespace vcpkg if (switch_it != switches_copy.end()) { // This means that the option was passed like '--a' - vcpkg::printf(Color::error, "Error: The option '--%s' must be passed an argument.\n", option.name); + msg::println_error(msgEmptyArg, msg::command_name = option.name); switches_copy.erase(switch_it); failed = true; } @@ -608,9 +630,7 @@ namespace vcpkg { if (v.empty()) { - vcpkg::printf(Color::error, - "Error: The option '--%s' must be passed non-empty arguments.\n", - option.name); + msg::println_error(msgEmptyArg, msg::command_name = option.name); failed = true; } else @@ -624,7 +644,7 @@ namespace vcpkg if (switch_it != switches_copy.end()) { // This means that the option was passed like '--a' - vcpkg::printf(Color::error, "Error: The option '--%s' must be passed an argument.\n", option.name); + msg::println_error(msgEmptyArg, msg::command_name = option.name); switches_copy.erase(switch_it); failed = true; } @@ -632,16 +652,16 @@ namespace vcpkg if (!switches_copy.empty() || !options_copy.empty()) { - vcpkg::printf(Color::error, "Unknown option(s) for command '%s':\n", this->command); + auto message = msg::format(msgUnknownOptions, msg::command_name = this->command); for (auto&& switch_ : switches_copy) { - print2(" '--", switch_, "'\n"); + message.append_indent().append_raw("\'--" + switch_ + "\'\n"); } for (auto&& option : options_copy) { - print2(" '--", option.first, "'\n"); + message.append_indent().append_raw("\'--" + option.first + "\'\n"); } - print2("\n"); + failed = true; } @@ -731,7 +751,7 @@ namespace vcpkg } VcpkgCmdArguments::append_common_options(table); - print2(table.m_str); + msg::println(LocalizedString::from_raw(table.m_str)); } void VcpkgCmdArguments::append_common_options(HelpTableFormatter& table) @@ -934,11 +954,9 @@ namespace vcpkg { if (el.is_inconsistent) { - vcpkg::printf(Color::warning, - "Warning: %s feature specifically turned off, but --%s was specified.\n", - el.flag, - el.option); - vcpkg::printf(Color::warning, "Warning: Defaulting to %s being on.\n", el.flag); + msg::println_warning( + msgSpecifiedFeatureTurnedOff, msg::command_name = el.flag, msg::command_name = el.option); + msg::println_warning(msgDefaultFlag, msg::command_name = el.flag); LockGuardPtr(g_metrics)->track_property( "warning", Strings::format("warning %s alongside %s", el.flag, el.option)); } From dd2786e5fbede865bc3e5a405aa3e804926d378a Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Tue, 12 Jul 2022 11:18:21 -0700 Subject: [PATCH 05/61] WIP --- locales/messages.en.json | 2 ++ locales/messages.json | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/locales/messages.en.json b/locales/messages.en.json index fcd2cbce2b..8ea00345c0 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -79,6 +79,7 @@ "ConflictingValuesForOption": "conflicting values specified for --'{value}'.", "CouldNotDeduceNugetIdAndVersion": "Could not deduce nuget id and version from filename: {path}", "CurlReportedUnexpectedResults": "curl has reported unexpected results to vcpkg and vcpkg cannot continue.\nPlease review the following text for sensitive information and open an issue on the Microsoft/vcpkg GitHub to help fix this problem!\ncmd: {command_line}\n=== curl output ===\n{actual}\n=== end curl output ===", + "DefaultFlag": "Defaulting to '{command_name}' being on.", "DefaultPathToBinaries": "Based on your system settings, the default path to store binaries is \n '{path}'. This consults %LOCALAPPDATA%/%APPDATA% on Windows and $XDG_CACHE_HOME or $HOME on other platforms.", "DetectCompilerHash": "Detecting compiler hash for triplet \"{triplet}\"...", "DownloadAvailable": "A downloadable copy of this tool is available and can be used by unsetting {env_var}.", @@ -239,6 +240,7 @@ "SeeURL": "See {url} for more information.", "SettingEnvVar": "-- Setting \"{env_var}\" environment variables to \"{url}\".", "SourceFieldPortNameMismatch": "The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json file has the name {package_name} and does not match the port directory {path}.", + "SpecifiedFeatureTurnedOff": "'{command_name}' feature specifically turned off, but --'{command_name}' was specified.", "SpecifyDirectoriesContaining": "Specifiy directories containing triplets files.\n(also: '{env_var}')", "SpecifyDirectoriesWhenSearching": "Specify directories to be used when searching for ports.\n(also: '{env_var}')", "SpecifyHostArch": "Specify the host architecture triplet. See 'vcpkg help triplet'.\n(default: '{env_var}')", diff --git a/locales/messages.json b/locales/messages.json index 5035461ece..151ecd2a5e 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -143,6 +143,8 @@ "_CouldNotDeduceNugetIdAndVersion.comment": "An example of {path} is /foo/bar.", "CurlReportedUnexpectedResults": "curl has reported unexpected results to vcpkg and vcpkg cannot continue.\nPlease review the following text for sensitive information and open an issue on the Microsoft/vcpkg GitHub to help fix this problem!\ncmd: {command_line}\n=== curl output ===\n{actual}\n=== end curl output ===", "_CurlReportedUnexpectedResults.comment": "{command_line} is the command line to call curl.exe, {actual} is the console output of curl.exe locale-invariant download results. An example of {command_line} is vcpkg install zlib.", + "DefaultFlag": "Defaulting to '{command_name}' being on.", + "_DefaultFlag.comment": "An example of {command_name} is install.", "DefaultPathToBinaries": "Based on your system settings, the default path to store binaries is \n '{path}'. This consults %LOCALAPPDATA%/%APPDATA% on Windows and $XDG_CACHE_HOME or $HOME on other platforms.", "_DefaultPathToBinaries.comment": "An example of {path} is /foo/bar.", "DetectCompilerHash": "Detecting compiler hash for triplet \"{triplet}\"...", @@ -399,6 +401,8 @@ "_SettingEnvVar.comment": "An example of env_var is \"HTTP(S)_PROXY\"'--' at the beginning must be preserved An example of {env_var} is VCPKG_DEFAULT_TRIPLET. An example of {url} is https://github.com/microsoft/vcpkg.", "SourceFieldPortNameMismatch": "The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json file has the name {package_name} and does not match the port directory {path}.", "_SourceFieldPortNameMismatch.comment": "{package_name} and {path} are both names of installable ports/packages. 'Source', 'CONTROL', 'vcpkg.json', and 'name' references are locale-invariant. An example of {package_name} is zlib. An example of {path} is /foo/bar.", + "SpecifiedFeatureTurnedOff": "'{command_name}' feature specifically turned off, but --'{command_name}' was specified.", + "_SpecifiedFeatureTurnedOff.comment": "An example of {command_name} is install. An example of {command_name} is install.", "SpecifyDirectoriesContaining": "Specifiy directories containing triplets files.\n(also: '{env_var}')", "_SpecifyDirectoriesContaining.comment": "An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", "SpecifyDirectoriesWhenSearching": "Specify directories to be used when searching for ports.\n(also: '{env_var}')", From d85eafb199d0f914081df9b50c032efd3fb76251 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Tue, 12 Jul 2022 12:41:30 -0700 Subject: [PATCH 06/61] Moved messages to messages.h/cpp --- include/vcpkg/base/messages.h | 103 +++++++++++++++++++++++++ src/vcpkg/base/messages.cpp | 49 ++++++++++++ src/vcpkg/vcpkgcmdarguments.cpp | 131 +------------------------------- 3 files changed, 153 insertions(+), 130 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index b046fc8ec8..0042fcf982 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -1211,4 +1211,107 @@ namespace vcpkg "The message named {value} starts with warning:, it must be changed to prepend " "WarningMessage in code instead."); DECLARE_MESSAGE(WarningsTreatedAsErrors, (), "", "previous warnings being interpreted as errors"); + DECLARE_MESSAGE(HelpSearchCommand, (), "", "Search for packages available to be built."); + DECLARE_MESSAGE(HelpInstallCommand, (), "", "Install a package."); + DECLARE_MESSAGE(HelpRemoveCommand, (), "", "Uninstall a package."); + DECLARE_MESSAGE(HelpListCommand, (), "", "List installed packages."); + DECLARE_MESSAGE(HelpUpdateCommand, (), "", "List Packages that can be updated."); + DECLARE_MESSAGE(HelpTopicsCommand, (), "", "Display the list of help topics."); + DECLARE_MESSAGE(HelpTopicCommand, (), "", "Display help for a specific topic."); + DECLARE_MESSAGE(HelpRemoveOutdatedCommand, (), "", "Uninstall all out-of-date packages."); + DECLARE_MESSAGE(HelpUpgradeCommand, (), "", "Rebuild all outdated packages."); + DECLARE_MESSAGE(HelpHistoryCommand, (), "", "(Experimental) Show the history of CONTROL versions of a package."); + DECLARE_MESSAGE(HelpHashCommand, (), "", "Hash a file by specific algorithm, default SHA512."); + + DECLARE_MESSAGE(HelpExportCommand, (), "", "Exports a package."); + DECLARE_MESSAGE(HelpEditCommand, + (msg::env_var), + "", + "Open up a port for editing (uses '{env_var}' default 'code'."); + DECLARE_MESSAGE(HelpCreateCommand, (), "", "Create a new package."); + DECLARE_MESSAGE(HelpInitializeRegistryCommand, (), "", "Initializes a registry in the directory ."); + DECLARE_MESSAGE(HelpFormatManifestCommand, + (), + "", + "Formats all vcpkg.json files. Run this before committing to vcpkg."); + DECLARE_MESSAGE(HelpOwnsCommand, (), "", "Search for files in installed packages."); + DECLARE_MESSAGE(HelpDependInfoCommand, (), "", "Display a list of dependencies for packages."); + DECLARE_MESSAGE(HelpEnvCommand, (), "", "Creates a clean shell environment for development or compiling."); + DECLARE_MESSAGE(HelpVersionCommand, (), "", "Display version information."); + DECLARE_MESSAGE(HelpContactCommand, (), "", "Display contact information to send feedback."); + DECLARE_MESSAGE(HelpResponseFileCommand, (), "", "Specify a response file to provide additional parameters."); + DECLARE_MESSAGE(HelpExampleCommand, + (), + "", + "For more help (including examples) see the accompanying README.md and docs folder."); + + DECLARE_MESSAGE(SpecifyTargetArch, + (msg::env_var), + "", + "Specify the target architecture triplet. See 'vcpkg help triplet'.\n(default: '{env_var}')"); + DECLARE_MESSAGE(SpecifyHostArch, + (msg::env_var), + "", + "Specify the host architecture triplet. See 'vcpkg help triplet'.\n(default: '{env_var}')"); + DECLARE_MESSAGE(SpecifyDirectoriesWhenSearching, + (msg::env_var), + "", + "Specify directories to be used when searching for ports.\n(also: '{env_var}')"); + DECLARE_MESSAGE(SpecifyDirectoriesContaining, + (msg::env_var), + "", + "Specifiy directories containing triplets files.\n(also: '{env_var}')"); + DECLARE_MESSAGE(BinarySourcesArg, (), "", "Add sources for binary caching. See 'vcpkg help binarycaching'."); + DECLARE_MESSAGE(AssetSourcesArg, (), "", "Add sources for asset caching. See 'vcpkg help assetcaching'."); + DECLARE_MESSAGE(DownloadRootsDir, + (msg::env_var), + "", + "Specify the downloads root directory.\n(default: '{env_var}')"); + DECLARE_MESSAGE(VcpkgRootsDir, (msg::env_var), "", "Specify the vcpkg root directory.\n(default: '{env_var}')"); + DECLARE_MESSAGE(BuildTreesRootDir, (), "", "(Experimental) Specify the buildtrees root directory."); + DECLARE_MESSAGE(InstallRootDir, (), "", "(Experimental) Specify the install root directory."); + DECLARE_MESSAGE(PackageRootDir, (), "", "(Experimental) Specify the packages root directory."); + DECLARE_MESSAGE(JsonSwitch, (), "", "(Experimental) Request JSON output."); + DECLARE_MESSAGE(TwoFeatureFlagsSpecified, + (msg::value), + "'{value}' is a feature flag.", + "Both '{value}' and -'{value}' were specified as feature flags."); + DECLARE_MESSAGE(DuplicateOptions, + (msg::value), + "'{value}' is a command option.", + "--'{value}' specified multiple times."); + DECLARE_MESSAGE(ConflictingValuesForOption, + (msg::value), + "'{value}' is a command option.", + "conflicting values specified for --'{value}'."); + DECLARE_MESSAGE(ExpectedValueForOption, + (msg::value), + "'{value}' is a command option.", + "expected value after '{value}.'"); + DECLARE_MESSAGE(UnsupportedShortOptions, + (msg::value), + "'{value}' is the short option given", + "short options are not supported: '{value}'"); + DECLARE_MESSAGE(IncorrectNumberOfArgs, + (msg::command_name, msg::count, msg::count), + "", + "'{command_name}' requires '{count}' arguments, but '{count}' were provided."); + DECLARE_MESSAGE(NoArgumentsForOption, + (msg::command_name), + "", + "The option '{command_name}' does not accept an argument."); + DECLARE_MESSAGE(DuplicateCommandOption, + (msg::command_name), + "", + "The option '{command_name}'can only be passed once."); + DECLARE_MESSAGE(EmptyArg, + (msg::command_name), + "", + "The option '{command_name}'must be passed a non-empty argument."); + DECLARE_MESSAGE(UnknownOptions, (msg::command_name), "", "Unknown option(s) for command '{command_name}':"); + DECLARE_MESSAGE(SpecifiedFeatureTurnedOff, + (msg::command_name, msg::command_name), + "", + "'{command_name}' feature specifically turned off, but --'{command_name}' was specified."); + DECLARE_MESSAGE(DefaultFlag, (msg::command_name), "", "Defaulting to '{command_name}' being on."); } diff --git a/src/vcpkg/base/messages.cpp b/src/vcpkg/base/messages.cpp index e3acc1bde7..a48bda4bd2 100644 --- a/src/vcpkg/base/messages.cpp +++ b/src/vcpkg/base/messages.cpp @@ -643,4 +643,53 @@ namespace vcpkg REGISTER_MESSAGE(WaitingToTakeFilesystemLock); REGISTER_MESSAGE(WarningMessageMustUsePrintWarning); REGISTER_MESSAGE(WarningsTreatedAsErrors); + + REGISTER_MESSAGE(HelpSearchCommand); + REGISTER_MESSAGE(HelpInstallCommand); + REGISTER_MESSAGE(HelpRemoveCommand); + REGISTER_MESSAGE(HelpListCommand); + REGISTER_MESSAGE(HelpUpdateCommand); + REGISTER_MESSAGE(HelpTopicsCommand); + REGISTER_MESSAGE(HelpTopicCommand); + REGISTER_MESSAGE(HelpRemoveOutdatedCommand); + REGISTER_MESSAGE(HelpUpgradeCommand); + REGISTER_MESSAGE(HelpHistoryCommand); + REGISTER_MESSAGE(HelpHashCommand); + REGISTER_MESSAGE(HelpExportCommand); + REGISTER_MESSAGE(HelpEditCommand); + REGISTER_MESSAGE(HelpCreateCommand); + REGISTER_MESSAGE(HelpInitializeRegistryCommand); + REGISTER_MESSAGE(HelpFormatManifestCommand); + REGISTER_MESSAGE(HelpOwnsCommand); + REGISTER_MESSAGE(HelpEnvCommand); + REGISTER_MESSAGE(HelpVersionCommand); + REGISTER_MESSAGE(HelpContactCommand); + REGISTER_MESSAGE(HelpResponseFileCommand); + REGISTER_MESSAGE(HelpExampleCommand); + REGISTER_MESSAGE(SpecifyTargetArch); + REGISTER_MESSAGE(SpecifyHostArch); + + REGISTER_MESSAGE(SpecifyDirectoriesWhenSearching); + REGISTER_MESSAGE(SpecifyDirectoriesContaining); + REGISTER_MESSAGE(BinarySourcesArg); + REGISTER_MESSAGE(AssetSourcesArg); + REGISTER_MESSAGE(DownloadRootsDir); + REGISTER_MESSAGE(VcpkgRootsDir); + REGISTER_MESSAGE(BuildTreesRootDir); + REGISTER_MESSAGE(InstallRootDir); + REGISTER_MESSAGE(PackageRootDir); + REGISTER_MESSAGE(JsonSwitch); + REGISTER_MESSAGE(TwoFeatureFlagsSpecified); + REGISTER_MESSAGE(DuplicateOptions); + REGISTER_MESSAGE(ConflictingValuesForOption); + REGISTER_MESSAGE(ExpectedValueForOption); + REGISTER_MESSAGE(UnsupportedShortOptions); + REGISTER_MESSAGE(IncorrectNumberOfArgs); + REGISTER_MESSAGE(NoArgumentsForOption); + REGISTER_MESSAGE(DuplicateCommandOption); + REGISTER_MESSAGE(EmptyArg); + REGISTER_MESSAGE(UnknownOptions); + REGISTER_MESSAGE(SpecifiedFeatureTurnedOff); + REGISTER_MESSAGE(DefaultFlag); + REGISTER_MESSAGE(HelpDependInfoCommand); } diff --git a/src/vcpkg/vcpkgcmdarguments.cpp b/src/vcpkg/vcpkgcmdarguments.cpp index 98450a59f6..8022aa980b 100644 --- a/src/vcpkg/vcpkgcmdarguments.cpp +++ b/src/vcpkg/vcpkgcmdarguments.cpp @@ -11,136 +11,7 @@ namespace vcpkg { - DECLARE_AND_REGISTER_MESSAGE(HelpSearchCommand, (), "", "Search for packages available to be built."); - DECLARE_AND_REGISTER_MESSAGE(HelpInstallCommand, (), "", "Install a package."); - DECLARE_AND_REGISTER_MESSAGE(HelpRemoveCommand, (), "", "Uninstall a package."); - DECLARE_AND_REGISTER_MESSAGE(HelpListCommand, (), "", "List installed packages."); - DECLARE_AND_REGISTER_MESSAGE(HelpUpdateCommand, (), "", "List Packages that can be updated."); - DECLARE_AND_REGISTER_MESSAGE(HelpTopicsCommand, (), "", "Display the list of help topics."); - DECLARE_AND_REGISTER_MESSAGE(HelpTopicCommand, (), "", "Display help for a specific topic."); - DECLARE_AND_REGISTER_MESSAGE(HelpRemoveOutdatedCommand, (), "", "Uninstall all out-of-date packages."); - DECLARE_AND_REGISTER_MESSAGE(HelpUpgradeCommand, (), "", "Rebuild all outdated packages."); - DECLARE_AND_REGISTER_MESSAGE(HelpHistoryCommand, - (), - "", - "(Experimental) Show the history of CONTROL versions of a package."); - DECLARE_AND_REGISTER_MESSAGE(HelpHashCommand, (), "", "Hash a file by specific algorithm, default SHA512."); - - DECLARE_AND_REGISTER_MESSAGE(HelpExportCommand, (), "", "Exports a package."); - DECLARE_AND_REGISTER_MESSAGE(HelpEditCommand, - (msg::env_var), - "", - "Open up a port for editing (uses '{env_var}' default 'code'."); - DECLARE_AND_REGISTER_MESSAGE(HelpCreateCommand, (), "", "Create a new package."); - DECLARE_AND_REGISTER_MESSAGE(HelpInitializeRegistryCommand, - (), - "", - "Initializes a registry in the directory ."); - DECLARE_AND_REGISTER_MESSAGE(HelpFormatManifestCommand, - (), - "", - "Formats all vcpkg.json files. Run this before committing to vcpkg."); - DECLARE_AND_REGISTER_MESSAGE(HelpOwnsCommand, (), "", "Search for files in installed packages."); - DECLARE_AND_REGISTER_MESSAGE(HelpDependInfoCommand, (), "", "Display a list of dependencies for packages."); - DECLARE_AND_REGISTER_MESSAGE(HelpEnvCommand, - (), - "", - "Creates a clean shell environment for development or compiling."); - DECLARE_AND_REGISTER_MESSAGE(HelpVersionCommand, (), "", "Display version information."); - DECLARE_AND_REGISTER_MESSAGE(HelpContactCommand, (), "", "Display contact information to send feedback."); - DECLARE_AND_REGISTER_MESSAGE(HelpResponseFileCommand, - (), - "", - "Specify a response file to provide additional parameters."); - DECLARE_AND_REGISTER_MESSAGE(HelpExampleCommand, - (), - "", - "For more help (including examples) see the accompanying README.md and docs folder."); - - DECLARE_AND_REGISTER_MESSAGE( - SpecifyTargetArch, - (msg::env_var), - "", - "Specify the target architecture triplet. See 'vcpkg help triplet'.\n(default: '{env_var}')"); - DECLARE_AND_REGISTER_MESSAGE( - SpecifyHostArch, - (msg::env_var), - "", - "Specify the host architecture triplet. See 'vcpkg help triplet'.\n(default: '{env_var}')"); - DECLARE_AND_REGISTER_MESSAGE(SpecifyDirectoriesWhenSearching, - (msg::env_var), - "", - "Specify directories to be used when searching for ports.\n(also: '{env_var}')"); - DECLARE_AND_REGISTER_MESSAGE(SpecifyDirectoriesContaining, - (msg::env_var), - "", - "Specifiy directories containing triplets files.\n(also: '{env_var}')"); - DECLARE_AND_REGISTER_MESSAGE(BinarySourcesArg, - (), - "", - "Add sources for binary caching. See 'vcpkg help binarycaching'."); - DECLARE_AND_REGISTER_MESSAGE(AssetSourcesArg, - (), - "", - "Add sources for asset caching. See 'vcpkg help assetcaching'."); - DECLARE_AND_REGISTER_MESSAGE(DownloadRootsDir, - (msg::env_var), - "", - "Specify the downloads root directory.\n(default: '{env_var}')"); - DECLARE_AND_REGISTER_MESSAGE(VcpkgRootsDir, - (msg::env_var), - "", - "Specify the vcpkg root directory.\n(default: '{env_var}')"); - DECLARE_AND_REGISTER_MESSAGE(BuildTreesRootDir, (), "", "(Experimental) Specify the buildtrees root directory."); - DECLARE_AND_REGISTER_MESSAGE(InstallRootDir, (), "", "(Experimental) Specify the install root directory."); - DECLARE_AND_REGISTER_MESSAGE(PackageRootDir, (), "", "(Experimental) Specify the packages root directory."); - DECLARE_AND_REGISTER_MESSAGE(JsonSwitch, (), "", "(Experimental) Request JSON output."); - DECLARE_AND_REGISTER_MESSAGE(TwoFeatureFlagsSpecified, - (msg::value), - "'{value}' is a feature flag.", - "Both '{value}' and -'{value}' were specified as feature flags."); - DECLARE_AND_REGISTER_MESSAGE(DuplicateOptions, - (msg::value), - "'{value}' is a command option.", - "--'{value}' specified multiple times."); - DECLARE_AND_REGISTER_MESSAGE(ConflictingValuesForOption, - (msg::value), - "'{value}' is a command option.", - "conflicting values specified for --'{value}'."); - DECLARE_AND_REGISTER_MESSAGE(ExpectedValueForOption, - (msg::value), - "'{value}' is a command option.", - "expected value after '{value}.'"); - DECLARE_AND_REGISTER_MESSAGE(UnsupportedShortOptions, - (msg::value), - "'{value}' is the short option given", - "short options are not supported: '{value}'"); - DECLARE_AND_REGISTER_MESSAGE(IncorrectNumberOfArgs, - (msg::command_name, msg::count, msg::count), - "", - "'{command_name}' requires '{count}' arguments, but '{count}' were provided."); - DECLARE_AND_REGISTER_MESSAGE(NoArgumentsForOption, - (msg::command_name), - "", - "The option '{command_name}' does not accept an argument."); - DECLARE_AND_REGISTER_MESSAGE(DuplicateCommandOption, - (msg::command_name), - "", - "The option '{command_name}'can only be passed once."); - DECLARE_AND_REGISTER_MESSAGE(EmptyArg, - (msg::command_name), - "", - "The option '{command_name}'must be passed a non-empty argument."); - DECLARE_AND_REGISTER_MESSAGE(UnknownOptions, - (msg::command_name), - "", - "Unknown option(s) for command '{command_name}':"); - DECLARE_AND_REGISTER_MESSAGE( - SpecifiedFeatureTurnedOff, - (msg::command_name, msg::command_name), - "", - "'{command_name}' feature specifically turned off, but --'{command_name}' was specified."); - DECLARE_AND_REGISTER_MESSAGE(DefaultFlag, (msg::command_name), "", "Defaulting to '{command_name}' being on."); + static void set_from_feature_flag(const std::vector& flags, StringView flag, Optional& place) { if (!place.has_value()) From 9400523367293ec4ce239e2eb6d523869f7574c8 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Tue, 12 Jul 2022 12:44:22 -0700 Subject: [PATCH 07/61] Sorted Messages --- include/vcpkg/base/messages.h | 204 +++++++++++++++++----------------- src/vcpkg/base/messages.cpp | 96 ++++++++-------- 2 files changed, 148 insertions(+), 152 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index 0042fcf982..235d60b793 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -496,6 +496,7 @@ namespace vcpkg (), "", "Another installation is in progress on the machine, sleeping 6s before retrying."); + DECLARE_MESSAGE(AssetSourcesArg, (), "", "Add sources for asset caching. See 'vcpkg help assetcaching'."); DECLARE_MESSAGE(AttemptingToFetchPackagesFromVendor, (msg::count, msg::vendor), "", @@ -510,6 +511,7 @@ namespace vcpkg "An example of env_var is \"HTTP(S)_PROXY\"" "'--' at the beginning must be preserved", "-- Automatically setting {env_var} environment variables to \"{url}\"."); + DECLARE_MESSAGE(BinarySourcesArg, (), "", "Add sources for binary caching. See 'vcpkg help binarycaching'."); DECLARE_MESSAGE(BuildAlreadyInstalled, (msg::spec), "", @@ -584,6 +586,7 @@ namespace vcpkg (msg::build_result, msg::count), "Displayed to show a count of results of a build_result in a summary.", "{build_result}: {count}"); + DECLARE_MESSAGE(BuildTreesRootDir, (), "", "(Experimental) Specify the buildtrees root directory."); DECLARE_MESSAGE(BuildTroubleshootingMessage1, (), "First part of build troubleshooting message, printed before the URI to look for existing bugs.", @@ -646,6 +649,10 @@ namespace vcpkg "{command_line}\n" "failed with the following results:"); DECLARE_MESSAGE(CompressFolderFailed, (msg::path), "", "Failed to compress folder '{path}':"); + DECLARE_MESSAGE(ConflictingValuesForOption, + (msg::value), + "'{value}' is a command option.", + "conflicting values specified for --'{value}'."); DECLARE_MESSAGE(CouldNotDeduceNugetIdAndVersion, (msg::path), "", @@ -661,6 +668,7 @@ namespace vcpkg "=== curl output ===\n" "{actual}\n" "=== end curl output ==="); + DECLARE_MESSAGE(DefaultFlag, (msg::command_name), "", "Defaulting to '{command_name}' being on."); DECLARE_MESSAGE(DefaultPathToBinaries, (msg::path), "", @@ -677,6 +685,22 @@ namespace vcpkg (), "This message is normally displayed only in development.", "Downloading latest vcpkg-ce bundle..."); + DECLARE_MESSAGE(DownloadRootsDir, + (msg::env_var), + "", + "Specify the downloads root directory.\n(default: '{env_var}')"); + DECLARE_MESSAGE(DuplicateCommandOption, + (msg::command_name), + "", + "The option '{command_name}'can only be passed once."); + DECLARE_MESSAGE(DuplicateOptions, + (msg::value), + "'{value}' is a command option.", + "--'{value}' specified multiple times."); + DECLARE_MESSAGE(EmptyArg, + (msg::command_name), + "", + "The option '{command_name}'must be passed a non-empty argument."); DECLARE_MESSAGE(EmptyLicenseExpression, (), "", "SPDX license expression was empty."); DECLARE_MESSAGE(EnvStrFailedToExtract, (), "", "could not expand the environment string:"); DECLARE_MESSAGE(ErrorDetectingCompilerInfo, @@ -750,6 +774,10 @@ namespace vcpkg DECLARE_MESSAGE(ExpectedFailOrSkip, (), "", "expected 'fail', 'skip', or 'pass' here"); DECLARE_MESSAGE(ExpectedPortName, (), "", "expected a port name here"); DECLARE_MESSAGE(ExpectedTripletName, (), "", "expected a triplet name here"); + DECLARE_MESSAGE(ExpectedValueForOption, + (msg::value), + "'{value}' is a command option.", + "expected value after '{value}.'"); DECLARE_MESSAGE(ExtendedDocumenationAtUrl, (msg::url), "", "Extended documentation available at '{url}'."); DECLARE_MESSAGE(FailedToProvisionCe, (), "", "Failed to provision vcpkg-ce."); DECLARE_MESSAGE(FailedToRunToolToDetermineVersion, @@ -814,8 +842,44 @@ namespace vcpkg (msg::package_name), "'header' refers to C/C++ .h files", "{package_name} is header-only and can be used from CMake via:"); + DECLARE_MESSAGE(HelpContactCommand, (), "", "Display contact information to send feedback."); + DECLARE_MESSAGE(HelpCreateCommand, (), "", "Create a new package."); + DECLARE_MESSAGE(HelpDependInfoCommand, (), "", "Display a list of dependencies for packages."); + DECLARE_MESSAGE(HelpEditCommand, + (msg::env_var), + "", + "Open up a port for editing (uses '{env_var}' default 'code'."); + DECLARE_MESSAGE(HelpEnvCommand, (), "", "Creates a clean shell environment for development or compiling."); + DECLARE_MESSAGE(HelpExampleCommand, + (), + "", + "For more help (including examples) see the accompanying README.md and docs folder."); + DECLARE_MESSAGE(HelpExportCommand, (), "", "Exports a package."); + DECLARE_MESSAGE(HelpFormatManifestCommand, + (), + "", + "Formats all vcpkg.json files. Run this before committing to vcpkg."); + DECLARE_MESSAGE(HelpHashCommand, (), "", "Hash a file by specific algorithm, default SHA512."); + DECLARE_MESSAGE(HelpHistoryCommand, (), "", "(Experimental) Show the history of CONTROL versions of a package."); + DECLARE_MESSAGE(HelpInitializeRegistryCommand, (), "", "Initializes a registry in the directory ."); + DECLARE_MESSAGE(HelpInstallCommand, (), "", "Install a package."); + DECLARE_MESSAGE(HelpListCommand, (), "", "List installed packages."); + DECLARE_MESSAGE(HelpOwnsCommand, (), "", "Search for files in installed packages."); + DECLARE_MESSAGE(HelpRemoveCommand, (), "", "Uninstall a package."); + DECLARE_MESSAGE(HelpRemoveOutdatedCommand, (), "", "Uninstall all out-of-date packages."); + DECLARE_MESSAGE(HelpResponseFileCommand, (), "", "Specify a response file to provide additional parameters."); + DECLARE_MESSAGE(HelpSearchCommand, (), "", "Search for packages available to be built."); + DECLARE_MESSAGE(HelpTopicCommand, (), "", "Display help for a specific topic."); + DECLARE_MESSAGE(HelpTopicsCommand, (), "", "Display the list of help topics."); + DECLARE_MESSAGE(HelpUpdateCommand, (), "", "List Packages that can be updated."); + DECLARE_MESSAGE(HelpUpgradeCommand, (), "", "Rebuild all outdated packages."); + DECLARE_MESSAGE(HelpVersionCommand, (), "", "Display version information."); DECLARE_MESSAGE(IllegalFeatures, (), "", "List of features is not allowed in this context"); DECLARE_MESSAGE(IllegalPlatformSpec, (), "", "Platform qualifier is not allowed in this context"); + DECLARE_MESSAGE(IncorrectNumberOfArgs, + (msg::command_name, msg::count, msg::count), + "", + "'{command_name}' requires '{count}' arguments, but '{count}' were provided."); DECLARE_MESSAGE(InfoSetEnvVar, (msg::env_var), "In this context 'editor' means IDE", @@ -828,6 +892,7 @@ namespace vcpkg (msg::action_index, msg::count, msg::spec), "", "Installing {action_index}/{count} {spec}..."); + DECLARE_MESSAGE(InstallRootDir, (), "", "(Experimental) Specify the install root directory."); DECLARE_MESSAGE(InstallWithSystemManager, (), "", @@ -899,6 +964,7 @@ namespace vcpkg DECLARE_MESSAGE(JsonErrorFailedToParse, (msg::path), "", "failed to parse {path}:"); DECLARE_MESSAGE(JsonErrorFailedToRead, (msg::path, msg::error_msg), "", "failed to read {path}: {error_msg}"); DECLARE_MESSAGE(JsonErrorMustBeAnObject, (msg::path), "", "Expected {path} to be an object."); + DECLARE_MESSAGE(JsonSwitch, (), "", "(Experimental) Request JSON output."); DECLARE_MESSAGE(LaunchingProgramFailed, (msg::tool_name), "A platform API call failure message is appended after this", @@ -1001,8 +1067,13 @@ namespace vcpkg (msg::path, msg::exit_code), "", "msiexec failed while extracting '{path}' with launch or exit code {exit_code} and message:"); + DECLARE_MESSAGE(NoArgumentsForOption, + (msg::command_name), + "", + "The option '{command_name}' does not accept an argument."); DECLARE_MESSAGE(NoLocalizationForMessages, (), "", "No localized messages for the following: "); DECLARE_MESSAGE(NoRegistryForPort, (msg::package_name), "", "no registry configured for port {package_name}"); + DECLARE_MESSAGE(PackageRootDir, (), "", "(Experimental) Specify the packages root directory."); DECLARE_MESSAGE(PackingVendorFailed, (msg::vendor), "", @@ -1066,6 +1137,26 @@ namespace vcpkg "'CONTROL', 'vcpkg.json', and 'name' references are locale-invariant.", "The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json " "file has the name {package_name} and does not match the port directory {path}."); + DECLARE_MESSAGE(SpecifiedFeatureTurnedOff, + (msg::command_name, msg::command_name), + "", + "'{command_name}' feature specifically turned off, but --'{command_name}' was specified."); + DECLARE_MESSAGE(SpecifyDirectoriesContaining, + (msg::env_var), + "", + "Specifiy directories containing triplets files.\n(also: '{env_var}')"); + DECLARE_MESSAGE(SpecifyDirectoriesWhenSearching, + (msg::env_var), + "", + "Specify directories to be used when searching for ports.\n(also: '{env_var}')"); + DECLARE_MESSAGE(SpecifyHostArch, + (msg::env_var), + "", + "Specify the host architecture triplet. See 'vcpkg help triplet'.\n(default: '{env_var}')"); + DECLARE_MESSAGE(SpecifyTargetArch, + (msg::env_var), + "", + "Specify the target architecture triplet. See 'vcpkg help triplet'.\n(default: '{env_var}')"); DECLARE_MESSAGE(StoredBinaryCache, (msg::path), "", "Stored binary cache: '{path}'"); DECLARE_MESSAGE(SystemApiErrorMessage, (msg::system_api, msg::exit_code, msg::error_msg), @@ -1073,6 +1164,10 @@ namespace vcpkg "calling {system_api} failed with {exit_code} ({error_msg})"); DECLARE_MESSAGE(ToolFetchFailed, (msg::tool_name), "", "Could not fetch {tool_name}."); DECLARE_MESSAGE(ToolInWin10, (), "", "This utility is bundled with Windows 10 or later."); + DECLARE_MESSAGE(TwoFeatureFlagsSpecified, + (msg::value), + "'{value}' is a feature flag.", + "Both '{value}' and -'{value}' were specified as feature flags."); DECLARE_MESSAGE(UnexpectedErrorDuringBulkDownload, (), "", "an unexpected error occurred during bulk download."); DECLARE_MESSAGE(UnexpectedToolOutput, (msg::tool_name, msg::path), @@ -1088,12 +1183,17 @@ namespace vcpkg "unknown binary provider type: valid providers are 'clear', 'default', 'nuget', " "'nugetconfig','nugettimeout', 'interactive', 'x-azblob', 'x-gcs', 'x-aws', " "'x-aws-config', 'http', and 'files'"); + DECLARE_MESSAGE(UnknownOptions, (msg::command_name), "", "Unknown option(s) for command '{command_name}':"); DECLARE_MESSAGE(UnknownTool, (), "", "vcpkg does not have a definition of this tool for this platform."); DECLARE_MESSAGE( UnknownVariablesInTemplate, (msg::value, msg::list), "{value} is the value provided by the user and {list} a list of unknown variables seperated by comma", "invalid argument: url template '{value}' contains unknown variables: {list}"); + DECLARE_MESSAGE(UnsupportedShortOptions, + (msg::value), + "'{value}' is the short option given", + "short options are not supported: '{value}'"); DECLARE_MESSAGE(UnsupportedSystemName, (msg::system_name), "", @@ -1171,6 +1271,7 @@ namespace vcpkg "vcpkg has crashed. Please create an issue at https://github.com/microsoft/vcpkg containing a brief summary of " "what you were trying to do and the following information."); DECLARE_MESSAGE(VcpkgInvalidCommand, (msg::command_name), "", "invalid command: {command_name}"); + DECLARE_MESSAGE(VcpkgRootsDir, (msg::env_var), "", "Specify the vcpkg root directory.\n(default: '{env_var}')"); DECLARE_MESSAGE(VcpkgSendMetricsButDisabled, (), "", "passed --sendmetrics, but metrics are disabled."); DECLARE_MESSAGE(VersionCommandHeader, (msg::version), @@ -1211,107 +1312,4 @@ namespace vcpkg "The message named {value} starts with warning:, it must be changed to prepend " "WarningMessage in code instead."); DECLARE_MESSAGE(WarningsTreatedAsErrors, (), "", "previous warnings being interpreted as errors"); - DECLARE_MESSAGE(HelpSearchCommand, (), "", "Search for packages available to be built."); - DECLARE_MESSAGE(HelpInstallCommand, (), "", "Install a package."); - DECLARE_MESSAGE(HelpRemoveCommand, (), "", "Uninstall a package."); - DECLARE_MESSAGE(HelpListCommand, (), "", "List installed packages."); - DECLARE_MESSAGE(HelpUpdateCommand, (), "", "List Packages that can be updated."); - DECLARE_MESSAGE(HelpTopicsCommand, (), "", "Display the list of help topics."); - DECLARE_MESSAGE(HelpTopicCommand, (), "", "Display help for a specific topic."); - DECLARE_MESSAGE(HelpRemoveOutdatedCommand, (), "", "Uninstall all out-of-date packages."); - DECLARE_MESSAGE(HelpUpgradeCommand, (), "", "Rebuild all outdated packages."); - DECLARE_MESSAGE(HelpHistoryCommand, (), "", "(Experimental) Show the history of CONTROL versions of a package."); - DECLARE_MESSAGE(HelpHashCommand, (), "", "Hash a file by specific algorithm, default SHA512."); - - DECLARE_MESSAGE(HelpExportCommand, (), "", "Exports a package."); - DECLARE_MESSAGE(HelpEditCommand, - (msg::env_var), - "", - "Open up a port for editing (uses '{env_var}' default 'code'."); - DECLARE_MESSAGE(HelpCreateCommand, (), "", "Create a new package."); - DECLARE_MESSAGE(HelpInitializeRegistryCommand, (), "", "Initializes a registry in the directory ."); - DECLARE_MESSAGE(HelpFormatManifestCommand, - (), - "", - "Formats all vcpkg.json files. Run this before committing to vcpkg."); - DECLARE_MESSAGE(HelpOwnsCommand, (), "", "Search for files in installed packages."); - DECLARE_MESSAGE(HelpDependInfoCommand, (), "", "Display a list of dependencies for packages."); - DECLARE_MESSAGE(HelpEnvCommand, (), "", "Creates a clean shell environment for development or compiling."); - DECLARE_MESSAGE(HelpVersionCommand, (), "", "Display version information."); - DECLARE_MESSAGE(HelpContactCommand, (), "", "Display contact information to send feedback."); - DECLARE_MESSAGE(HelpResponseFileCommand, (), "", "Specify a response file to provide additional parameters."); - DECLARE_MESSAGE(HelpExampleCommand, - (), - "", - "For more help (including examples) see the accompanying README.md and docs folder."); - - DECLARE_MESSAGE(SpecifyTargetArch, - (msg::env_var), - "", - "Specify the target architecture triplet. See 'vcpkg help triplet'.\n(default: '{env_var}')"); - DECLARE_MESSAGE(SpecifyHostArch, - (msg::env_var), - "", - "Specify the host architecture triplet. See 'vcpkg help triplet'.\n(default: '{env_var}')"); - DECLARE_MESSAGE(SpecifyDirectoriesWhenSearching, - (msg::env_var), - "", - "Specify directories to be used when searching for ports.\n(also: '{env_var}')"); - DECLARE_MESSAGE(SpecifyDirectoriesContaining, - (msg::env_var), - "", - "Specifiy directories containing triplets files.\n(also: '{env_var}')"); - DECLARE_MESSAGE(BinarySourcesArg, (), "", "Add sources for binary caching. See 'vcpkg help binarycaching'."); - DECLARE_MESSAGE(AssetSourcesArg, (), "", "Add sources for asset caching. See 'vcpkg help assetcaching'."); - DECLARE_MESSAGE(DownloadRootsDir, - (msg::env_var), - "", - "Specify the downloads root directory.\n(default: '{env_var}')"); - DECLARE_MESSAGE(VcpkgRootsDir, (msg::env_var), "", "Specify the vcpkg root directory.\n(default: '{env_var}')"); - DECLARE_MESSAGE(BuildTreesRootDir, (), "", "(Experimental) Specify the buildtrees root directory."); - DECLARE_MESSAGE(InstallRootDir, (), "", "(Experimental) Specify the install root directory."); - DECLARE_MESSAGE(PackageRootDir, (), "", "(Experimental) Specify the packages root directory."); - DECLARE_MESSAGE(JsonSwitch, (), "", "(Experimental) Request JSON output."); - DECLARE_MESSAGE(TwoFeatureFlagsSpecified, - (msg::value), - "'{value}' is a feature flag.", - "Both '{value}' and -'{value}' were specified as feature flags."); - DECLARE_MESSAGE(DuplicateOptions, - (msg::value), - "'{value}' is a command option.", - "--'{value}' specified multiple times."); - DECLARE_MESSAGE(ConflictingValuesForOption, - (msg::value), - "'{value}' is a command option.", - "conflicting values specified for --'{value}'."); - DECLARE_MESSAGE(ExpectedValueForOption, - (msg::value), - "'{value}' is a command option.", - "expected value after '{value}.'"); - DECLARE_MESSAGE(UnsupportedShortOptions, - (msg::value), - "'{value}' is the short option given", - "short options are not supported: '{value}'"); - DECLARE_MESSAGE(IncorrectNumberOfArgs, - (msg::command_name, msg::count, msg::count), - "", - "'{command_name}' requires '{count}' arguments, but '{count}' were provided."); - DECLARE_MESSAGE(NoArgumentsForOption, - (msg::command_name), - "", - "The option '{command_name}' does not accept an argument."); - DECLARE_MESSAGE(DuplicateCommandOption, - (msg::command_name), - "", - "The option '{command_name}'can only be passed once."); - DECLARE_MESSAGE(EmptyArg, - (msg::command_name), - "", - "The option '{command_name}'must be passed a non-empty argument."); - DECLARE_MESSAGE(UnknownOptions, (msg::command_name), "", "Unknown option(s) for command '{command_name}':"); - DECLARE_MESSAGE(SpecifiedFeatureTurnedOff, - (msg::command_name, msg::command_name), - "", - "'{command_name}' feature specifically turned off, but --'{command_name}' was specified."); - DECLARE_MESSAGE(DefaultFlag, (msg::command_name), "", "Defaulting to '{command_name}' being on."); } diff --git a/src/vcpkg/base/messages.cpp b/src/vcpkg/base/messages.cpp index a48bda4bd2..390ae0b187 100644 --- a/src/vcpkg/base/messages.cpp +++ b/src/vcpkg/base/messages.cpp @@ -441,9 +441,11 @@ namespace vcpkg REGISTER_MESSAGE(AlreadyInstalled); REGISTER_MESSAGE(AlreadyInstalledNotHead); REGISTER_MESSAGE(AnotherInstallationInProgress); + REGISTER_MESSAGE(AssetSourcesArg); REGISTER_MESSAGE(AttemptingToFetchPackagesFromVendor); REGISTER_MESSAGE(AuthenticationMayRequireManualAction); REGISTER_MESSAGE(AutoSettingEnvVar); + REGISTER_MESSAGE(BinarySourcesArg); REGISTER_MESSAGE(BuildAlreadyInstalled); REGISTER_MESSAGE(BuildDependenciesMissing); REGISTER_MESSAGE(BuildingFromHead); @@ -461,6 +463,7 @@ namespace vcpkg REGISTER_MESSAGE(BuildResultSucceeded); REGISTER_MESSAGE(BuildResultSummaryHeader); REGISTER_MESSAGE(BuildResultSummaryLine); + REGISTER_MESSAGE(BuildTreesRootDir); REGISTER_MESSAGE(BuildTroubleshootingMessage1); REGISTER_MESSAGE(BuildTroubleshootingMessage2); REGISTER_MESSAGE(BuildTroubleshootingMessage3); @@ -478,14 +481,20 @@ namespace vcpkg REGISTER_MESSAGE(CMakeTargetsUsageHeuristicMessage); REGISTER_MESSAGE(CommandFailed); REGISTER_MESSAGE(CompressFolderFailed); + REGISTER_MESSAGE(ConflictingValuesForOption); REGISTER_MESSAGE(CouldNotDeduceNugetIdAndVersion); REGISTER_MESSAGE(CurlReportedUnexpectedResults); + REGISTER_MESSAGE(DefaultFlag); REGISTER_MESSAGE(DefaultPathToBinaries); REGISTER_MESSAGE(DetectCompilerHash); REGISTER_MESSAGE(DownloadAvailable); REGISTER_MESSAGE(DownloadedSources); REGISTER_MESSAGE(DownloadingVcpkgCeBundle); REGISTER_MESSAGE(DownloadingVcpkgCeBundleLatest); + REGISTER_MESSAGE(DownloadRootsDir); + REGISTER_MESSAGE(DuplicateCommandOption); + REGISTER_MESSAGE(DuplicateOptions); + REGISTER_MESSAGE(EmptyArg); REGISTER_MESSAGE(EmptyLicenseExpression); REGISTER_MESSAGE(EnvStrFailedToExtract); REGISTER_MESSAGE(ErrorDetectingCompilerInfo); @@ -509,6 +518,7 @@ namespace vcpkg REGISTER_MESSAGE(ExpectedFailOrSkip); REGISTER_MESSAGE(ExpectedPortName); REGISTER_MESSAGE(ExpectedTripletName); + REGISTER_MESSAGE(ExpectedValueForOption); REGISTER_MESSAGE(ExtendedDocumenationAtUrl); REGISTER_MESSAGE(FailedToProvisionCe); REGISTER_MESSAGE(FailedToRunToolToDetermineVersion); @@ -530,11 +540,36 @@ namespace vcpkg REGISTER_MESSAGE(GitUnexpectedCommandOutput); REGISTER_MESSAGE(HashFileFailureToRead); REGISTER_MESSAGE(HeaderOnlyUsage); + REGISTER_MESSAGE(HelpContactCommand); + REGISTER_MESSAGE(HelpCreateCommand); + REGISTER_MESSAGE(HelpDependInfoCommand); + REGISTER_MESSAGE(HelpEditCommand); + REGISTER_MESSAGE(HelpEnvCommand); + REGISTER_MESSAGE(HelpExampleCommand); + REGISTER_MESSAGE(HelpExportCommand); + REGISTER_MESSAGE(HelpFormatManifestCommand); + REGISTER_MESSAGE(HelpHashCommand); + REGISTER_MESSAGE(HelpHistoryCommand); + REGISTER_MESSAGE(HelpInitializeRegistryCommand); + REGISTER_MESSAGE(HelpInstallCommand); + REGISTER_MESSAGE(HelpListCommand); + REGISTER_MESSAGE(HelpOwnsCommand); + REGISTER_MESSAGE(HelpRemoveCommand); + REGISTER_MESSAGE(HelpRemoveOutdatedCommand); + REGISTER_MESSAGE(HelpResponseFileCommand); + REGISTER_MESSAGE(HelpSearchCommand); + REGISTER_MESSAGE(HelpTopicCommand); + REGISTER_MESSAGE(HelpTopicsCommand); + REGISTER_MESSAGE(HelpUpdateCommand); + REGISTER_MESSAGE(HelpUpgradeCommand); + REGISTER_MESSAGE(HelpVersionCommand); REGISTER_MESSAGE(IllegalFeatures); REGISTER_MESSAGE(IllegalPlatformSpec); + REGISTER_MESSAGE(IncorrectNumberOfArgs); REGISTER_MESSAGE(InfoSetEnvVar); REGISTER_MESSAGE(InstallingFromLocation); REGISTER_MESSAGE(InstallingPackage); + REGISTER_MESSAGE(InstallRootDir); REGISTER_MESSAGE(InstallWithSystemManager); REGISTER_MESSAGE(InstallWithSystemManagerMono); REGISTER_MESSAGE(InstallWithSystemManagerPkg); @@ -555,6 +590,7 @@ namespace vcpkg REGISTER_MESSAGE(JsonErrorFailedToParse); REGISTER_MESSAGE(JsonErrorFailedToRead); REGISTER_MESSAGE(JsonErrorMustBeAnObject); + REGISTER_MESSAGE(JsonSwitch); REGISTER_MESSAGE(LaunchingProgramFailed); REGISTER_MESSAGE(LicenseExpressionContainsExtraPlus); REGISTER_MESSAGE(LicenseExpressionContainsInvalidCharacter); @@ -579,8 +615,10 @@ namespace vcpkg REGISTER_MESSAGE(LocalizedMessageMustNotEndWithNewline); REGISTER_MESSAGE(MonoInstructions); REGISTER_MESSAGE(MsiexecFailedToExtract); + REGISTER_MESSAGE(NoArgumentsForOption); REGISTER_MESSAGE(NoLocalizationForMessages); REGISTER_MESSAGE(NoRegistryForPort); + REGISTER_MESSAGE(PackageRootDir); REGISTER_MESSAGE(PackingVendorFailed); REGISTER_MESSAGE(ParseControlErrorInfoInvalidFields); REGISTER_MESSAGE(ParseControlErrorInfoMissingFields); @@ -599,16 +637,24 @@ namespace vcpkg REGISTER_MESSAGE(ResultsHeader); REGISTER_MESSAGE(SettingEnvVar); REGISTER_MESSAGE(SourceFieldPortNameMismatch); + REGISTER_MESSAGE(SpecifiedFeatureTurnedOff); + REGISTER_MESSAGE(SpecifyDirectoriesContaining); + REGISTER_MESSAGE(SpecifyDirectoriesWhenSearching); + REGISTER_MESSAGE(SpecifyHostArch); + REGISTER_MESSAGE(SpecifyTargetArch); REGISTER_MESSAGE(StoredBinaryCache); REGISTER_MESSAGE(SystemApiErrorMessage); REGISTER_MESSAGE(ToolFetchFailed); REGISTER_MESSAGE(ToolInWin10); + REGISTER_MESSAGE(TwoFeatureFlagsSpecified); REGISTER_MESSAGE(UnexpectedErrorDuringBulkDownload); REGISTER_MESSAGE(UnexpectedToolOutput); REGISTER_MESSAGE(UnknownBaselineFileContent); REGISTER_MESSAGE(UnknownBinaryProviderType); + REGISTER_MESSAGE(UnknownOptions); REGISTER_MESSAGE(UnknownTool); REGISTER_MESSAGE(UnknownVariablesInTemplate); + REGISTER_MESSAGE(UnsupportedShortOptions); REGISTER_MESSAGE(UnsupportedSystemName); REGISTER_MESSAGE(UnsupportedToolchain); REGISTER_MESSAGE(UpdateBaselineAddBaselineNoManifest); @@ -629,6 +675,7 @@ namespace vcpkg REGISTER_MESSAGE(VcpkgDisallowedClassicMode); REGISTER_MESSAGE(VcpkgHasCrashed); REGISTER_MESSAGE(VcpkgInvalidCommand); + REGISTER_MESSAGE(VcpkgRootsDir); REGISTER_MESSAGE(VcpkgSendMetricsButDisabled); REGISTER_MESSAGE(VersionCommandHeader); REGISTER_MESSAGE(VersionConstraintViolated); @@ -643,53 +690,4 @@ namespace vcpkg REGISTER_MESSAGE(WaitingToTakeFilesystemLock); REGISTER_MESSAGE(WarningMessageMustUsePrintWarning); REGISTER_MESSAGE(WarningsTreatedAsErrors); - - REGISTER_MESSAGE(HelpSearchCommand); - REGISTER_MESSAGE(HelpInstallCommand); - REGISTER_MESSAGE(HelpRemoveCommand); - REGISTER_MESSAGE(HelpListCommand); - REGISTER_MESSAGE(HelpUpdateCommand); - REGISTER_MESSAGE(HelpTopicsCommand); - REGISTER_MESSAGE(HelpTopicCommand); - REGISTER_MESSAGE(HelpRemoveOutdatedCommand); - REGISTER_MESSAGE(HelpUpgradeCommand); - REGISTER_MESSAGE(HelpHistoryCommand); - REGISTER_MESSAGE(HelpHashCommand); - REGISTER_MESSAGE(HelpExportCommand); - REGISTER_MESSAGE(HelpEditCommand); - REGISTER_MESSAGE(HelpCreateCommand); - REGISTER_MESSAGE(HelpInitializeRegistryCommand); - REGISTER_MESSAGE(HelpFormatManifestCommand); - REGISTER_MESSAGE(HelpOwnsCommand); - REGISTER_MESSAGE(HelpEnvCommand); - REGISTER_MESSAGE(HelpVersionCommand); - REGISTER_MESSAGE(HelpContactCommand); - REGISTER_MESSAGE(HelpResponseFileCommand); - REGISTER_MESSAGE(HelpExampleCommand); - REGISTER_MESSAGE(SpecifyTargetArch); - REGISTER_MESSAGE(SpecifyHostArch); - - REGISTER_MESSAGE(SpecifyDirectoriesWhenSearching); - REGISTER_MESSAGE(SpecifyDirectoriesContaining); - REGISTER_MESSAGE(BinarySourcesArg); - REGISTER_MESSAGE(AssetSourcesArg); - REGISTER_MESSAGE(DownloadRootsDir); - REGISTER_MESSAGE(VcpkgRootsDir); - REGISTER_MESSAGE(BuildTreesRootDir); - REGISTER_MESSAGE(InstallRootDir); - REGISTER_MESSAGE(PackageRootDir); - REGISTER_MESSAGE(JsonSwitch); - REGISTER_MESSAGE(TwoFeatureFlagsSpecified); - REGISTER_MESSAGE(DuplicateOptions); - REGISTER_MESSAGE(ConflictingValuesForOption); - REGISTER_MESSAGE(ExpectedValueForOption); - REGISTER_MESSAGE(UnsupportedShortOptions); - REGISTER_MESSAGE(IncorrectNumberOfArgs); - REGISTER_MESSAGE(NoArgumentsForOption); - REGISTER_MESSAGE(DuplicateCommandOption); - REGISTER_MESSAGE(EmptyArg); - REGISTER_MESSAGE(UnknownOptions); - REGISTER_MESSAGE(SpecifiedFeatureTurnedOff); - REGISTER_MESSAGE(DefaultFlag); - REGISTER_MESSAGE(HelpDependInfoCommand); } From 7829c562a03bb2fa437c0ce8497f5ac4ccbef9be Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Tue, 12 Jul 2022 13:07:53 -0700 Subject: [PATCH 08/61] WIP: Add msg --- include/vcpkg/base/messages.h | 2 ++ locales/messages.en.json | 1 + locales/messages.json | 2 ++ src/vcpkg/base/messages.cpp | 1 + src/vcpkg/binaryparagraph.cpp | 2 +- 5 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index b046fc8ec8..48d5b8f92a 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -1211,4 +1211,6 @@ namespace vcpkg "The message named {value} starts with warning:, it must be changed to prepend " "WarningMessage in code instead."); DECLARE_MESSAGE(WarningsTreatedAsErrors, (), "", "previous warnings being interpreted as errors"); + DECLARE_MESSAGE(ErrorParsingBinaryParagraph, (msg::spec), "", "while parsing the Binary Paragraph for {spec}"); + } diff --git a/locales/messages.en.json b/locales/messages.en.json index a38d698aba..574a0213df 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -95,6 +95,7 @@ "ErrorNoVSInstanceAt": "at \"{path}\"", "ErrorNoVSInstanceFullVersion": "with toolset version prefix {version}", "ErrorNoVSInstanceVersion": "with toolset version {version}", + "ErrorParsingBinaryParagraph": "while parsing the Binary Paragraph for {spec}", "ErrorRequireBaseline": "this vcpkg instance requires a manifest with a specified baseline in order to interact with ports. Please add 'builtin-baseline' to the manifest or add a 'vcpkg-configuration.json' that redefines the default registry.", "ErrorRequirePackagesList": "`vcpkg install` requires a list of packages to install in classic mode.", "ErrorUnableToDetectCompilerInfo": "vcpkg was unable to detect the active compiler's information. See above for the CMake failure output.", diff --git a/locales/messages.json b/locales/messages.json index 3a063c0288..07c927c4f1 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -173,6 +173,8 @@ "_ErrorNoVSInstanceFullVersion.comment": "An example of {version} is 1.3.8.", "ErrorNoVSInstanceVersion": "with toolset version {version}", "_ErrorNoVSInstanceVersion.comment": "An example of {version} is 1.3.8.", + "ErrorParsingBinaryParagraph": "while parsing the Binary Paragraph for {spec}", + "_ErrorParsingBinaryParagraph.comment": "An example of {spec} is zlib:x64-windows.", "ErrorRequireBaseline": "this vcpkg instance requires a manifest with a specified baseline in order to interact with ports. Please add 'builtin-baseline' to the manifest or add a 'vcpkg-configuration.json' that redefines the default registry.", "ErrorRequirePackagesList": "`vcpkg install` requires a list of packages to install in classic mode.", "ErrorUnableToDetectCompilerInfo": "vcpkg was unable to detect the active compiler's information. See above for the CMake failure output.", diff --git a/src/vcpkg/base/messages.cpp b/src/vcpkg/base/messages.cpp index e3acc1bde7..334757e463 100644 --- a/src/vcpkg/base/messages.cpp +++ b/src/vcpkg/base/messages.cpp @@ -643,4 +643,5 @@ namespace vcpkg REGISTER_MESSAGE(WaitingToTakeFilesystemLock); REGISTER_MESSAGE(WarningMessageMustUsePrintWarning); REGISTER_MESSAGE(WarningsTreatedAsErrors); + REGISTER_MESSAGE(ErrorParsingBinaryParagraph); } diff --git a/src/vcpkg/binaryparagraph.cpp b/src/vcpkg/binaryparagraph.cpp index d1439a9fd5..b2c2620943 100644 --- a/src/vcpkg/binaryparagraph.cpp +++ b/src/vcpkg/binaryparagraph.cpp @@ -90,7 +90,7 @@ namespace vcpkg if (const auto err = parser.error_info(this->spec.to_string())) { - print2(Color::error, "Error: while parsing the Binary Paragraph for ", this->spec, '\n'); + msg::println_error(msgErrorParsingBinaryParagraph, msg::spec = this->spec); print_error_message(err); Checks::exit_fail(VCPKG_LINE_INFO); } From 102f2ec220c0cdc0d9488d0b4062cf5a45d1dc99 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Tue, 12 Jul 2022 14:57:45 -0700 Subject: [PATCH 09/61] Localizing messages --- include/vcpkg/base/messages.h | 49 ++++++++++++++++++- locales/messages.en.json | 3 ++ locales/messages.json | 6 +++ src/vcpkg/base/messages.cpp | 3 ++ src/vcpkg/binaryparagraph.cpp | 89 ++++++++++++----------------------- 5 files changed, 89 insertions(+), 61 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index 48d5b8f92a..cbfe99533d 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -1212,5 +1212,52 @@ namespace vcpkg "WarningMessage in code instead."); DECLARE_MESSAGE(WarningsTreatedAsErrors, (), "", "previous warnings being interpreted as errors"); DECLARE_MESSAGE(ErrorParsingBinaryParagraph, (msg::spec), "", "while parsing the Binary Paragraph for {spec}"); - + DECLARE_MESSAGE(MultiArch, (msg::option), "", "Multi-Arch must be 'same' but was {option}"); + DECLARE_MESSAGE(FailedToParseBinParagraph, + (msg::url, msg::error_msg, msg::value), + "'{error_msg}' is the error message for failing to parse the Binary Paragraph, '{value}' is the " + "Binary Paragraph", + "[sanity check] Failed to parse a serialized binary paragraph.\nPlease open an issue at {url}, " + "with the following output:\n{error_msg}\n=== Serialized BinaryParagraph ===\n{value}"); + DECLARE_MESSAGE( + SerializedDoesNotMatchOriginalBinPar, + (msg::url, + msg::spec, + msg::version, + msg::version, + msg::value, + msg::value, + msg::value, + msg::value, + msg::value, + msg::value, + msg::value, + msg::spec, + msg::version, + msg::version, + msg::value, + msg::value, + msg::value, + msg::value, + msg::value, + msg::value, + msg::value), + "{value} is the original BinaryParagraph description.\n{value} is the original BinaryParagraph " + "maintainers.\n{value} is the original BinaryParagraph feature.\n{value} is the original BinaryParagraph " + "default_features.\n{value} is the original " + "BinaryParagraph dependencies.\n{value} is the original BinaryParagraph abi.\n{value} is the original " + "BinaryParagraph type.\n{value} is the serialized BinaryParagraph description.\n{value} is the serialized " + "BinaryParagraph " + "maintainers.\n{value} is the serialized BinaryParagraph feature.\n{value} is the serialized BinaryParagraph " + "default_features.\n{value} is the serialized " + "BinaryParagraph dependencies.\n{value} is the serialized BinaryParagraph abi.\n{value} is the serialized " + "BinaryParagraph type.", + "[sanity check] The serialized binary paragraph was different from the original binary " + "paragraph.\nPlease open an issue at {url}, with the following output:\n=== Original " + "BinaryParagraph ===\nspec: '{spec}'\nversion: '{version}'\nport_version: {version}\ndescription: " + "['{value}']\nmaintainers: ['{value}']\nfeature: '{value}'\ndefault feature: ['{value}']\ndependencies: " + "['{value}']\nabi: '{value}'\ntype: {value}\n\n=== Serialized BinaryParagraph ===\nspec: " + "'{spec}'\nversion: '{version}'\nport_version: {version}\ndescription: " + "['{value}']\nmaintainers: ['{value}']\nfeature: '{value}'\ndefault feature: ['{value}']\ndependencies: " + "['{value}']\nabi: '{value}'\ntype: {value}"); } diff --git a/locales/messages.en.json b/locales/messages.en.json index 574a0213df..7509fe042d 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -108,6 +108,7 @@ "ExpectedPortName": "expected a port name here", "ExpectedTripletName": "expected a triplet name here", "ExtendedDocumenationAtUrl": "Extended documentation available at '{url}'.", + "FailedToParseBinParagraph": "[sanity check] Failed to parse a serialized binary paragraph.\nPlease open an issue at {url}, with the following output:\n{error_msg}\n=== Serialized BinaryParagraph ===\n{value}", "FailedToProvisionCe": "Failed to provision vcpkg-ce.", "FailedToRunToolToDetermineVersion": "Failed to run {path} to determine the {tool_name} version.", "FailedToStoreBackToMirror": "failed to store back to mirror:", @@ -180,6 +181,7 @@ "LocalizedMessageMustNotEndWithNewline": "The message named {value} ends with a newline which should be added by formatting rather than by localization.", "MonoInstructions": "This may be caused by an incomplete mono installation. Full mono is available on some systems via `sudo apt install mono-complete`. Ubuntu 18.04 users may need a newer version of mono, available at https://www.mono-project.com/download/stable/", "MsiexecFailedToExtract": "msiexec failed while extracting '{path}' with launch or exit code {exit_code} and message:", + "MultiArch": "Multi-Arch must be 'same' but was {option}", "NoLocalizationForMessages": "No localized messages for the following: ", "NoRegistryForPort": "no registry configured for port {package_name}", "NoteMessage": "note: ", @@ -201,6 +203,7 @@ "RestoredPackagesFromVendor": "Restored {count} package(s) from {value} in {elapsed}. Use --debug to see more details.", "ResultsHeader": "RESULTS", "SeeURL": "See {url} for more information.", + "SerializedDoesNotMatchOriginalBinPar": "[sanity check] The serialized binary paragraph was different from the original binary paragraph.\nPlease open an issue at {url}, with the following output:\n=== Original BinaryParagraph ===\nspec: '{spec}'\nversion: '{version}'\nport_version: {version}\ndescription: ['{value}']\nmaintainers: ['{value}']\nfeature: '{value}'\ndefault feature: ['{value}']\ndependencies: ['{value}']\nabi: '{value}'\ntype: {value}\n\n=== Serialized BinaryParagraph ===\nspec: '{spec}'\nversion: '{version}'\nport_version: {version}\ndescription: ['{value}']\nmaintainers: ['{value}']\nfeature: '{value}'\ndefault feature: ['{value}']\ndependencies: ['{value}']\nabi: '{value}'\ntype: {value}", "SettingEnvVar": "-- Setting \"{env_var}\" environment variables to \"{url}\".", "SourceFieldPortNameMismatch": "The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json file has the name {package_name} and does not match the port directory {path}.", "StoredBinaryCache": "Stored binary cache: '{path}'", diff --git a/locales/messages.json b/locales/messages.json index 07c927c4f1..e2ee063c9f 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -193,6 +193,8 @@ "ExpectedTripletName": "expected a triplet name here", "ExtendedDocumenationAtUrl": "Extended documentation available at '{url}'.", "_ExtendedDocumenationAtUrl.comment": "An example of {url} is https://github.com/microsoft/vcpkg.", + "FailedToParseBinParagraph": "[sanity check] Failed to parse a serialized binary paragraph.\nPlease open an issue at {url}, with the following output:\n{error_msg}\n=== Serialized BinaryParagraph ===\n{value}", + "_FailedToParseBinParagraph.comment": "'{error_msg}' is the error message for failing to parse the Binary Paragraph, '{value}' is the Binary Paragraph An example of {url} is https://github.com/microsoft/vcpkg. An example of {error_msg} is File Not Found.", "FailedToProvisionCe": "Failed to provision vcpkg-ce.", "FailedToRunToolToDetermineVersion": "Failed to run {path} to determine the {tool_name} version.", "_FailedToRunToolToDetermineVersion.comment": "Additional information, such as the command line output, if any, will be appended on the line after this message An example of {tool_name} is aria2. An example of {path} is /foo/bar.", @@ -315,6 +317,8 @@ "MonoInstructions": "This may be caused by an incomplete mono installation. Full mono is available on some systems via `sudo apt install mono-complete`. Ubuntu 18.04 users may need a newer version of mono, available at https://www.mono-project.com/download/stable/", "MsiexecFailedToExtract": "msiexec failed while extracting '{path}' with launch or exit code {exit_code} and message:", "_MsiexecFailedToExtract.comment": "An example of {path} is /foo/bar. An example of {exit_code} is 127.", + "MultiArch": "Multi-Arch must be 'same' but was {option}", + "_MultiArch.comment": "An example of {option} is editable.", "NoLocalizationForMessages": "No localized messages for the following: ", "NoRegistryForPort": "no registry configured for port {package_name}", "_NoRegistryForPort.comment": "An example of {package_name} is zlib.", @@ -351,6 +355,8 @@ "_ResultsHeader.comment": "Displayed before a list of installation results.", "SeeURL": "See {url} for more information.", "_SeeURL.comment": "An example of {url} is https://github.com/microsoft/vcpkg.", + "SerializedDoesNotMatchOriginalBinPar": "[sanity check] The serialized binary paragraph was different from the original binary paragraph.\nPlease open an issue at {url}, with the following output:\n=== Original BinaryParagraph ===\nspec: '{spec}'\nversion: '{version}'\nport_version: {version}\ndescription: ['{value}']\nmaintainers: ['{value}']\nfeature: '{value}'\ndefault feature: ['{value}']\ndependencies: ['{value}']\nabi: '{value}'\ntype: {value}\n\n=== Serialized BinaryParagraph ===\nspec: '{spec}'\nversion: '{version}'\nport_version: {version}\ndescription: ['{value}']\nmaintainers: ['{value}']\nfeature: '{value}'\ndefault feature: ['{value}']\ndependencies: ['{value}']\nabi: '{value}'\ntype: {value}", + "_SerializedDoesNotMatchOriginalBinPar.comment": "{value} is the original BinaryParagraph description.\n{value} is the original BinaryParagraph maintainers.\n{value} is the original BinaryParagraph feature.\n{value} is the original BinaryParagraph default_features.\n{value} is the original BinaryParagraph dependencies.\n{value} is the original BinaryParagraph abi.\n{value} is the original BinaryParagraph type.\n{value} is the serialized BinaryParagraph description.\n{value} is the serialized BinaryParagraph maintainers.\n{value} is the serialized BinaryParagraph feature.\n{value} is the serialized BinaryParagraph default_features.\n{value} is the serialized BinaryParagraph dependencies.\n{value} is the serialized BinaryParagraph abi.\n{value} is the serialized BinaryParagraph type. An example of {url} is https://github.com/microsoft/vcpkg. An example of {spec} is zlib:x64-windows. An example of {version} is 1.3.8. An example of {version} is 1.3.8. An example of {spec} is zlib:x64-windows. An example of {version} is 1.3.8. An example of {version} is 1.3.8.", "SettingEnvVar": "-- Setting \"{env_var}\" environment variables to \"{url}\".", "_SettingEnvVar.comment": "An example of env_var is \"HTTP(S)_PROXY\"'--' at the beginning must be preserved An example of {env_var} is VCPKG_DEFAULT_TRIPLET. An example of {url} is https://github.com/microsoft/vcpkg.", "SourceFieldPortNameMismatch": "The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json file has the name {package_name} and does not match the port directory {path}.", diff --git a/src/vcpkg/base/messages.cpp b/src/vcpkg/base/messages.cpp index 334757e463..06ffdd385c 100644 --- a/src/vcpkg/base/messages.cpp +++ b/src/vcpkg/base/messages.cpp @@ -644,4 +644,7 @@ namespace vcpkg REGISTER_MESSAGE(WarningMessageMustUsePrintWarning); REGISTER_MESSAGE(WarningsTreatedAsErrors); REGISTER_MESSAGE(ErrorParsingBinaryParagraph); + REGISTER_MESSAGE(MultiArch); + REGISTER_MESSAGE(FailedToParseBinParagraph); + REGISTER_MESSAGE(SerializedDoesNotMatchOriginalBinPar); } diff --git a/src/vcpkg/binaryparagraph.cpp b/src/vcpkg/binaryparagraph.cpp index b2c2620943..0d10ddd4ac 100644 --- a/src/vcpkg/binaryparagraph.cpp +++ b/src/vcpkg/binaryparagraph.cpp @@ -96,7 +96,7 @@ namespace vcpkg } // prefer failing above when possible because it gives better information - Checks::check_exit(VCPKG_LINE_INFO, multi_arch == "same", "Multi-Arch must be 'same' but was %s", multi_arch); + Checks::msg_check_exit(VCPKG_LINE_INFO, multi_arch == "same", msgMultiArch, msg::option = multi_arch); canonicalize(); } @@ -280,71 +280,40 @@ namespace vcpkg out_str.substr(initial_end), "vcpkg::serialize(const BinaryParagraph&, std::string&)"); if (!parsed_paragraph) { - Checks::exit_maybe_upgrade(VCPKG_LINE_INFO, - R"([sanity check] Failed to parse a serialized binary paragraph. -Please open an issue at https://github.com/microsoft/vcpkg, with the following output: - Error: %s - -=== Serialized BinaryParagraph === -%s - )", - parsed_paragraph.error(), - my_paragraph); + Checks::msg_exit_maybe_upgrade(VCPKG_LINE_INFO, + msgFailedToParseBinParagraph, + msg::url = "https://github.com/microsoft/vcpkg", + msg::error_msg = parsed_paragraph.error(), + msg ::value = my_paragraph); } auto binary_paragraph = BinaryParagraph(*parsed_paragraph.get()); if (binary_paragraph != pgh) { const auto& join_str = R"(", ")"; - Checks::exit_maybe_upgrade( - VCPKG_LINE_INFO, - R"([sanity check] The serialized binary paragraph was different from the original binary paragraph. -Please open an issue at https://github.com/microsoft/vcpkg, with the following output: - -=== Original BinaryParagraph === -spec: "%s" -version: "%s" -port_version: %d -description: ["%s"] -maintainers: ["%s"] -feature: "%s" -default_features: ["%s"] -dependencies: ["%s"] -abi: "%s" -type: %s - -=== Serialized BinaryParagraph === -spec: "%s" -version: "%s" -port_version: %d -description: ["%s"] -maintainers: ["%s"] -feature: "%s" -default_features: ["%s"] -dependencies: ["%s"] -abi: "%s" -type: %s -)", - pgh.spec.to_string(), - pgh.version, - pgh.port_version, - Strings::join(join_str, pgh.description), - Strings::join(join_str, pgh.maintainers), - pgh.feature, - Strings::join(join_str, pgh.default_features), - Strings::join(join_str, pgh.dependencies), - pgh.abi, - Type::to_string(pgh.type), - binary_paragraph.spec.to_string(), - binary_paragraph.version, - binary_paragraph.port_version, - Strings::join(join_str, binary_paragraph.description), - Strings::join(join_str, binary_paragraph.maintainers), - binary_paragraph.feature, - Strings::join(join_str, binary_paragraph.default_features), - Strings::join(join_str, binary_paragraph.dependencies), - binary_paragraph.abi, - Type::to_string(binary_paragraph.type)); + Checks::msg_exit_maybe_upgrade(VCPKG_LINE_INFO, + msgSerializedDoesNotMatchOriginalBinPar, + msg::url = "https://github.com/microsoft/vcpkg", + msg::spec = pgh.spec, + msg::version = pgh.version, + msg::version = pgh.port_version, + msg::value = Strings::join(join_str, pgh.description), + msg::value = Strings::join(join_str, pgh.maintainers), + msg::value = pgh.feature, + msg::value = Strings::join(join_str, pgh.default_features), + msg::value = Strings::join(join_str, pgh.dependencies), + msg::value = pgh.abi, + msg::value = Type::to_string(pgh.type), + msg::spec = binary_paragraph.spec, + msg::version = binary_paragraph.version, + msg::version = binary_paragraph.port_version, + msg::value = Strings::join(join_str, binary_paragraph.description), + msg::value = Strings::join(join_str, binary_paragraph.maintainers), + msg::value = binary_paragraph.feature, + msg::value = Strings::join(join_str, binary_paragraph.default_features), + msg::value = Strings::join(join_str, binary_paragraph.dependencies), + msg::value = binary_paragraph.abi, + msg::value = Type::to_string(binary_paragraph.type)); } } } From 38cd9e753887386484214ecdd97c6a4b37128974 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Tue, 12 Jul 2022 15:11:57 -0700 Subject: [PATCH 10/61] Localizing messages in sourceparagraph.cpp --- include/vcpkg/base/messages.h | 1 + locales/messages.en.json | 1 + locales/messages.json | 2 ++ src/vcpkg/base/messages.cpp | 1 + src/vcpkg/sourceparagraph.cpp | 4 ++-- 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index cbfe99533d..de65c8a96f 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -1260,4 +1260,5 @@ namespace vcpkg "'{spec}'\nversion: '{version}'\nport_version: {version}\ndescription: " "['{value}']\nmaintainers: ['{value}']\nfeature: '{value}'\ndefault feature: ['{value}']\ndependencies: " "['{value}']\nabi: '{value}'\ntype: {value}"); + DECLARE_MESSAGE(SeeDocumentation, (msg::url), "", "See {url} for more information"); } diff --git a/locales/messages.en.json b/locales/messages.en.json index 7509fe042d..fd0b4d901f 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -202,6 +202,7 @@ "RestoredPackage": "Restored package from '{path}'", "RestoredPackagesFromVendor": "Restored {count} package(s) from {value} in {elapsed}. Use --debug to see more details.", "ResultsHeader": "RESULTS", + "SeeDocumentation": "See {url} for more information", "SeeURL": "See {url} for more information.", "SerializedDoesNotMatchOriginalBinPar": "[sanity check] The serialized binary paragraph was different from the original binary paragraph.\nPlease open an issue at {url}, with the following output:\n=== Original BinaryParagraph ===\nspec: '{spec}'\nversion: '{version}'\nport_version: {version}\ndescription: ['{value}']\nmaintainers: ['{value}']\nfeature: '{value}'\ndefault feature: ['{value}']\ndependencies: ['{value}']\nabi: '{value}'\ntype: {value}\n\n=== Serialized BinaryParagraph ===\nspec: '{spec}'\nversion: '{version}'\nport_version: {version}\ndescription: ['{value}']\nmaintainers: ['{value}']\nfeature: '{value}'\ndefault feature: ['{value}']\ndependencies: ['{value}']\nabi: '{value}'\ntype: {value}", "SettingEnvVar": "-- Setting \"{env_var}\" environment variables to \"{url}\".", diff --git a/locales/messages.json b/locales/messages.json index e2ee063c9f..e0800218d5 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -353,6 +353,8 @@ "_RestoredPackagesFromVendor.comment": "{value} may be either a 'vendor' like 'Azure' or 'NuGet', or a file path like C:\\example or /usr/example An example of {count} is 42. An example of {elapsed} is 3.532 min.", "ResultsHeader": "RESULTS", "_ResultsHeader.comment": "Displayed before a list of installation results.", + "SeeDocumentation": "See {url} for more information", + "_SeeDocumentation.comment": "An example of {url} is https://github.com/microsoft/vcpkg.", "SeeURL": "See {url} for more information.", "_SeeURL.comment": "An example of {url} is https://github.com/microsoft/vcpkg.", "SerializedDoesNotMatchOriginalBinPar": "[sanity check] The serialized binary paragraph was different from the original binary paragraph.\nPlease open an issue at {url}, with the following output:\n=== Original BinaryParagraph ===\nspec: '{spec}'\nversion: '{version}'\nport_version: {version}\ndescription: ['{value}']\nmaintainers: ['{value}']\nfeature: '{value}'\ndefault feature: ['{value}']\ndependencies: ['{value}']\nabi: '{value}'\ntype: {value}\n\n=== Serialized BinaryParagraph ===\nspec: '{spec}'\nversion: '{version}'\nport_version: {version}\ndescription: ['{value}']\nmaintainers: ['{value}']\nfeature: '{value}'\ndefault feature: ['{value}']\ndependencies: ['{value}']\nabi: '{value}'\ntype: {value}", diff --git a/src/vcpkg/base/messages.cpp b/src/vcpkg/base/messages.cpp index 06ffdd385c..8bcc90f8c6 100644 --- a/src/vcpkg/base/messages.cpp +++ b/src/vcpkg/base/messages.cpp @@ -647,4 +647,5 @@ namespace vcpkg REGISTER_MESSAGE(MultiArch); REGISTER_MESSAGE(FailedToParseBinParagraph); REGISTER_MESSAGE(SerializedDoesNotMatchOriginalBinPar); + REGISTER_MESSAGE(SeeDocumentation); } diff --git a/src/vcpkg/sourceparagraph.cpp b/src/vcpkg/sourceparagraph.cpp index 8d9b522682..1217576277 100644 --- a/src/vcpkg/sourceparagraph.cpp +++ b/src/vcpkg/sourceparagraph.cpp @@ -1211,8 +1211,8 @@ namespace vcpkg { Strings::append(ret, " ", err, "\n"); } - print2("See ", docs::registries_url, " for more information.\n"); - print2("See ", docs::manifests_url, " for more information.\n"); + msg::println(msgSeeDocumentation, msg::url = docs::registries_url); + msg::println(msgSeeDocumentation, msg::url = docs::manifests_url); return std::move(ret); } else From 9e3ce1e84d0b7f303602e3b7d52fd61254ee7860 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Wed, 13 Jul 2022 19:14:58 -0700 Subject: [PATCH 11/61] LM --- include/vcpkg/base/messages.h | 9 ++++++++- locales/messages.en.json | 4 +++- locales/messages.json | 7 +++++-- src/vcpkg/base/messages.cpp | 3 ++- src/vcpkg/commands.porthistory.cpp | 2 +- src/vcpkg/registries.cpp | 2 +- src/vcpkg/sourceparagraph.cpp | 9 ++++----- src/vcpkg/vcpkgpaths.cpp | 2 +- 8 files changed, 25 insertions(+), 13 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index 50a8796b3c..05b7439362 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -1253,5 +1253,12 @@ namespace vcpkg "'{spec}'\nversion: '{version}'\nport_version: {version}\ndescription: " "['{value}']\nmaintainers: ['{value}']\nfeature: '{value}'\ndefault feature: ['{value}']\ndependencies: " "['{value}']\nabi: '{value}'\ntype: {value}"); - DECLARE_MESSAGE(SeeDocumentation, (msg::url), "", "See {url} for more information"); + DECLARE_MESSAGE(ListOfValidFieldsForControlFiles, + (), + "", + "This is the list of valid fields for CONTROL files (case-sensitive):"); + DECLARE_MESSAGE(SuggestUpdateVcpkg, + (msg::command_line), + "", + "You may need to update the vcpkg binary; try running {command_line} to update."); } diff --git a/locales/messages.en.json b/locales/messages.en.json index 6896f2eb01..99921f5acc 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -108,6 +108,7 @@ "ExpectedPortName": "expected a port name here", "ExpectedTripletName": "expected a triplet name here", "ExtendedDocumentationAtUrl": "Extended documentation available at '{url}'.", + "FailedToParseBinParagraph": "[sanity check] Failed to parse a serialized binary paragraph.\nPlease open an issue at {url}, with the following output:\n{error_msg}\n=== Serialized BinaryParagraph ===\n{value}", "FailedToProvisionCe": "Failed to provision vcpkg-ce.", "FailedToRunToolToDetermineVersion": "Failed to run {path} to determine the {tool_name} version.", "FailedToStoreBackToMirror": "failed to store back to mirror:", @@ -173,6 +174,7 @@ "LicenseExpressionImbalancedParens": "There was a close parenthesis without an opening parenthesis.", "LicenseExpressionUnknownException": "Unknown license exception identifier '{value}'. Known values are listed at https://spdx.org/licenses/exceptions-index.html", "LicenseExpressionUnknownLicense": "Unknown license identifier '{value}'. Known values are listed at https://spdx.org/licenses/", + "ListOfValidFieldsForControlFiles": "This is the list of valid fields for CONTROL files (case-sensitive):", "LoadingCommunityTriplet": "-- [COMMUNITY] Loading triplet configuration from: {path}", "LoadingOverlayTriplet": "-- [OVERLAY] Loading triplet configuration from: {path}", "LocalizedMessageMustNotContainIndents": "The message named {value} contains what appears to be indenting which must be changed to use LocalizedString::append_indent instead.", @@ -200,12 +202,12 @@ "RestoredPackage": "Restored package from '{path}'", "RestoredPackagesFromVendor": "Restored {count} package(s) from {value} in {elapsed}. Use --debug to see more details.", "ResultsHeader": "RESULTS", - "SeeDocumentation": "See {url} for more information", "SeeURL": "See {url} for more information.", "SerializedDoesNotMatchOriginalBinPar": "[sanity check] The serialized binary paragraph was different from the original binary paragraph.\nPlease open an issue at {url}, with the following output:\n=== Original BinaryParagraph ===\nspec: '{spec}'\nversion: '{version}'\nport_version: {version}\ndescription: ['{value}']\nmaintainers: ['{value}']\nfeature: '{value}'\ndefault feature: ['{value}']\ndependencies: ['{value}']\nabi: '{value}'\ntype: {value}\n\n=== Serialized BinaryParagraph ===\nspec: '{spec}'\nversion: '{version}'\nport_version: {version}\ndescription: ['{value}']\nmaintainers: ['{value}']\nfeature: '{value}'\ndefault feature: ['{value}']\ndependencies: ['{value}']\nabi: '{value}'\ntype: {value}", "SettingEnvVar": "-- Setting \"{env_var}\" environment variables to \"{url}\".", "SourceFieldPortNameMismatch": "The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json file has the name {package_name} and does not match the port directory {path}.", "StoredBinaryCache": "Stored binary cache: '{path}'", + "SuggestUpdateVcpkg": "You may need to update the vcpkg binary; try running {command_line} to update.", "SystemApiErrorMessage": "calling {system_api} failed with {exit_code} ({error_msg})", "ToolFetchFailed": "Could not fetch {tool_name}.", "ToolInWin10": "This utility is bundled with Windows 10 or later.", diff --git a/locales/messages.json b/locales/messages.json index f4164462f8..51b151d0a9 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -193,6 +193,8 @@ "ExpectedTripletName": "expected a triplet name here", "ExtendedDocumentationAtUrl": "Extended documentation available at '{url}'.", "_ExtendedDocumentationAtUrl.comment": "An example of {url} is https://github.com/microsoft/vcpkg.", + "FailedToParseBinParagraph": "[sanity check] Failed to parse a serialized binary paragraph.\nPlease open an issue at {url}, with the following output:\n{error_msg}\n=== Serialized BinaryParagraph ===\n{value}", + "_FailedToParseBinParagraph.comment": "'{error_msg}' is the error message for failing to parse the Binary Paragraph, '{value}' is the Binary Paragraph An example of {url} is https://github.com/microsoft/vcpkg. An example of {error_msg} is File Not Found.", "FailedToProvisionCe": "Failed to provision vcpkg-ce.", "FailedToRunToolToDetermineVersion": "Failed to run {path} to determine the {tool_name} version.", "_FailedToRunToolToDetermineVersion.comment": "Additional information, such as the command line output, if any, will be appended on the line after this message An example of {tool_name} is aria2. An example of {path} is /foo/bar.", @@ -302,6 +304,7 @@ "_LicenseExpressionUnknownException.comment": "Example of {value} is 'unknownexception'", "LicenseExpressionUnknownLicense": "Unknown license identifier '{value}'. Known values are listed at https://spdx.org/licenses/", "_LicenseExpressionUnknownLicense.comment": "Example of {value} is 'unknownlicense'", + "ListOfValidFieldsForControlFiles": "This is the list of valid fields for CONTROL files (case-sensitive):", "LoadingCommunityTriplet": "-- [COMMUNITY] Loading triplet configuration from: {path}", "_LoadingCommunityTriplet.comment": "'-- [COMMUNITY]' at the beginning must be preserved An example of {path} is /foo/bar.", "LoadingOverlayTriplet": "-- [OVERLAY] Loading triplet configuration from: {path}", @@ -349,8 +352,6 @@ "_RestoredPackagesFromVendor.comment": "{value} may be either a 'vendor' like 'Azure' or 'NuGet', or a file path like C:\\example or /usr/example An example of {count} is 42. An example of {elapsed} is 3.532 min.", "ResultsHeader": "RESULTS", "_ResultsHeader.comment": "Displayed before a list of installation results.", - "SeeDocumentation": "See {url} for more information", - "_SeeDocumentation.comment": "An example of {url} is https://github.com/microsoft/vcpkg.", "SeeURL": "See {url} for more information.", "_SeeURL.comment": "An example of {url} is https://github.com/microsoft/vcpkg.", "SerializedDoesNotMatchOriginalBinPar": "[sanity check] The serialized binary paragraph was different from the original binary paragraph.\nPlease open an issue at {url}, with the following output:\n=== Original BinaryParagraph ===\nspec: '{spec}'\nversion: '{version}'\nport_version: {version}\ndescription: ['{value}']\nmaintainers: ['{value}']\nfeature: '{value}'\ndefault feature: ['{value}']\ndependencies: ['{value}']\nabi: '{value}'\ntype: {value}\n\n=== Serialized BinaryParagraph ===\nspec: '{spec}'\nversion: '{version}'\nport_version: {version}\ndescription: ['{value}']\nmaintainers: ['{value}']\nfeature: '{value}'\ndefault feature: ['{value}']\ndependencies: ['{value}']\nabi: '{value}'\ntype: {value}", @@ -361,6 +362,8 @@ "_SourceFieldPortNameMismatch.comment": "{package_name} and {path} are both names of installable ports/packages. 'Source', 'CONTROL', 'vcpkg.json', and 'name' references are locale-invariant. An example of {package_name} is zlib. An example of {path} is /foo/bar.", "StoredBinaryCache": "Stored binary cache: '{path}'", "_StoredBinaryCache.comment": "An example of {path} is /foo/bar.", + "SuggestUpdateVcpkg": "You may need to update the vcpkg binary; try running {command_line} to update.", + "_SuggestUpdateVcpkg.comment": "An example of {command_line} is vcpkg install zlib.", "SystemApiErrorMessage": "calling {system_api} failed with {exit_code} ({error_msg})", "_SystemApiErrorMessage.comment": "An example of {system_api} is CreateProcessW. An example of {exit_code} is 127. An example of {error_msg} is File Not Found.", "ToolFetchFailed": "Could not fetch {tool_name}.", diff --git a/src/vcpkg/base/messages.cpp b/src/vcpkg/base/messages.cpp index 31e36bebd5..c94fab18ec 100644 --- a/src/vcpkg/base/messages.cpp +++ b/src/vcpkg/base/messages.cpp @@ -646,5 +646,6 @@ namespace vcpkg REGISTER_MESSAGE(MultiArch); REGISTER_MESSAGE(FailedToParseBinParagraph); REGISTER_MESSAGE(SerializedDoesNotMatchOriginalBinPar); - REGISTER_MESSAGE(SeeDocumentation); + REGISTER_MESSAGE(ListOfValidFieldsForControlFiles); + REGISTER_MESSAGE(SuggestUpdateVcpkg); } diff --git a/src/vcpkg/commands.porthistory.cpp b/src/vcpkg/commands.porthistory.cpp index f74282d498..3ab8b359cd 100644 --- a/src/vcpkg/commands.porthistory.cpp +++ b/src/vcpkg/commands.porthistory.cpp @@ -112,7 +112,7 @@ namespace vcpkg::Commands::PortHistory if (auto output = maybe_output.get()) { auto commits = Util::fmap( - Strings::split(*output, '\n'), [](const std::string& line) -> auto{ + Strings::split(*output, '\n'), [](const std::string& line) -> auto { auto parts = Strings::split(line, ' '); return std::make_pair(parts[0], parts[1]); }); diff --git a/src/vcpkg/registries.cpp b/src/vcpkg/registries.cpp index f1388a0f2e..ab90bcd77a 100644 --- a/src/vcpkg/registries.cpp +++ b/src/vcpkg/registries.cpp @@ -1186,7 +1186,7 @@ namespace vcpkg if (auto pversions = maybe_versions.get()) { return Util::fmap( - *pversions, [](auto&& entry) -> auto{ + *pversions, [](auto&& entry) -> auto { return std::make_pair(SchemedVersion{entry.scheme, entry.version}, entry.git_tree); }); } diff --git a/src/vcpkg/sourceparagraph.cpp b/src/vcpkg/sourceparagraph.cpp index 1217576277..d14ffca905 100644 --- a/src/vcpkg/sourceparagraph.cpp +++ b/src/vcpkg/sourceparagraph.cpp @@ -1211,8 +1211,8 @@ namespace vcpkg { Strings::append(ret, " ", err, "\n"); } - msg::println(msgSeeDocumentation, msg::url = docs::registries_url); - msg::println(msgSeeDocumentation, msg::url = docs::manifests_url); + msg::println(msgExtendedDocumentationAtUrl, msg::url = docs::registries_url); + msg::println(msgExtendedDocumentationAtUrl, msg::url = docs::manifests_url); return std::move(ret); } else @@ -1383,7 +1383,7 @@ namespace vcpkg [](const std::unique_ptr& ppcei) { return !ppcei->extra_fields.empty(); })) { Strings::append(message, - "This is the list of valid fields for CONTROL files (case-sensitive): \n\n ", + msg::format(msgListOfValidFieldsForControlFiles).data(), Strings::join("\n ", get_list_of_valid_fields()), "\n\n"); #if defined(_WIN32) @@ -1391,8 +1391,7 @@ namespace vcpkg #else auto bootstrap = "./bootstrap-vcpkg.sh"; #endif - Strings::append( - message, "You may need to update the vcpkg binary; try running ", bootstrap, " to update.\n\n"); + Strings::append(message, msg::format(msgSuggestUpdateVcpkg, msg::command_line = bootstrap).data()); } } diff --git a/src/vcpkg/vcpkgpaths.cpp b/src/vcpkg/vcpkgpaths.cpp index bd5188a71e..c9dca0690b 100644 --- a/src/vcpkg/vcpkgpaths.cpp +++ b/src/vcpkg/vcpkgpaths.cpp @@ -877,7 +877,7 @@ namespace vcpkg const Path VcpkgPaths::get_triplet_file_path(Triplet triplet) const { return m_pimpl->m_triplets_cache.get_lazy( - triplet, [&]() -> auto{ + triplet, [&]() -> auto { for (const auto& triplet_dir : m_pimpl->triplets_dirs) { auto path = triplet_dir / (triplet.canonical_name() + ".cmake"); From db7051093bd08da130d5b0a994f66ceb40046829 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Thu, 14 Jul 2022 12:26:00 -0700 Subject: [PATCH 12/61] Formatting change --- include/vcpkg/base/messages.h | 2 +- locales/messages.en.json | 2 ++ locales/messages.json | 3 +-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index ab7129839b..7fc792fce5 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -876,7 +876,7 @@ namespace vcpkg DECLARE_MESSAGE(InfoSetEnvVar, (msg::env_var), "In this context 'editor' means IDE", - "You can also set the environment variable {env_var} to your editor of choice."); + "You can also set the environment variable '{env_var}' to your editor of choice."); DECLARE_MESSAGE(InstallingFromLocation, (msg::path), "'--' at the beginning must be preserved", diff --git a/locales/messages.en.json b/locales/messages.en.json index bb6485a5ec..86936bd858 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -76,8 +76,10 @@ "CmakeTargetsExcluded": "note: {count} additional targets are not displayed.", "CommandFailed": "command:\n{command_line}\nfailed with the following results:", "CompressFolderFailed": "Failed to compress folder \"{path}\":", + "ConflictingValuesForOption": "conflicting values specified for --'{value}'.", "CouldNotDeduceNugetIdAndVersion": "Could not deduce nuget id and version from filename: {path}", "CurlReportedUnexpectedResults": "curl has reported unexpected results to vcpkg and vcpkg cannot continue.\nPlease review the following text for sensitive information and open an issue on the Microsoft/vcpkg GitHub to help fix this problem!\ncmd: {command_line}\n=== curl output ===\n{actual}\n=== end curl output ===", + "DefaultFlag": "Defaulting to '{command_name}' being on.", "DefaultPathToBinaries": "Based on your system settings, the default path to store binaries is \"{path}\". This consults %LOCALAPPDATA%/%APPDATA% on Windows and $XDG_CACHE_HOME or $HOME on other platforms.", "DetectCompilerHash": "Detecting compiler hash for triplet {triplet}...", "DownloadAvailable": "A downloadable copy of this tool is available and can be used by unsetting {env_var}.", diff --git a/locales/messages.json b/locales/messages.json index 01b9f8b36d..1ea0d5aa16 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -143,7 +143,6 @@ "_CouldNotDeduceNugetIdAndVersion.comment": "An example of {path} is /foo/bar.", "CurlReportedUnexpectedResults": "curl has reported unexpected results to vcpkg and vcpkg cannot continue.\nPlease review the following text for sensitive information and open an issue on the Microsoft/vcpkg GitHub to help fix this problem!\ncmd: {command_line}\n=== curl output ===\n{actual}\n=== end curl output ===", "_CurlReportedUnexpectedResults.comment": "{command_line} is the command line to call curl.exe, {actual} is the console output of curl.exe locale-invariant download results. An example of {command_line} is vcpkg install zlib.", - "DefaultFlag": "Defaulting to '{command_name}' being on.", "_DefaultFlag.comment": "An example of {command_name} is install.", "DefaultPathToBinaries": "Based on your system settings, the default path to store binaries is \"{path}\". This consults %LOCALAPPDATA%/%APPDATA% on Windows and $XDG_CACHE_HOME or $HOME on other platforms.", @@ -270,7 +269,7 @@ "IllegalPlatformSpec": "Platform qualifier is not allowed in this context", "IncorrectNumberOfArgs": "'{command_name}' requires '{count}' arguments, but '{count}' were provided.", "_IncorrectNumberOfArgs.comment": "An example of {command_name} is install. An example of {count} is 42. An example of {count} is 42.", - "InfoSetEnvVar": "You can also set the environment variable {env_var} to your editor of choice.", + "InfoSetEnvVar": "You can also set the environment variable '{env_var}' to your editor of choice.", "_InfoSetEnvVar.comment": "In this context 'editor' means IDE An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", "InstallRootDir": "(Experimental) Specify the install root directory.", "InstallWithSystemManager": "You may be able to install this tool via your system package manager.", From 85f6db3a56964c26d83bebfe619911679bce4cfa Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Fri, 15 Jul 2022 10:47:36 -0700 Subject: [PATCH 13/61] Split large message in binaryparagraph.cpp --- include/vcpkg/base/messages.h | 46 ++++++++++--------------------- locales/messages.en.json | 5 +++- locales/messages.json | 8 ++++-- src/vcpkg/base/messages.cpp | 5 +++- src/vcpkg/binaryparagraph.cpp | 52 +++++++++++++++++++---------------- 5 files changed, 58 insertions(+), 58 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index 05b7439362..eb723301b1 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -1212,20 +1212,16 @@ namespace vcpkg "Binary Paragraph", "[sanity check] Failed to parse a serialized binary paragraph.\nPlease open an issue at {url}, " "with the following output:\n{error_msg}\n=== Serialized BinaryParagraph ===\n{value}"); + DECLARE_MESSAGE(MismatchedBinaryParagraphs, + (msg::url), + "", + "[sanity check] The serialized binary paragraph was different from the original binary " + "paragraph.\nPlease open an issue at {url}, with the following output:"); + DECLARE_MESSAGE(OriginalBinaryParagraphHeader, (), "", "\n=== Original Binary Paragraph ==="); + DECLARE_MESSAGE(SerializedBinaryParagraphHeader, (), "", "\n=== Serialized Binary Paragraph ==="); DECLARE_MESSAGE( - SerializedDoesNotMatchOriginalBinPar, - (msg::url, - msg::spec, - msg::version, - msg::version, - msg::value, - msg::value, - msg::value, - msg::value, - msg::value, - msg::value, - msg::value, - msg::spec, + BinaryParagraphDescription, + (msg::spec, msg::version, msg::version, msg::value, @@ -1235,24 +1231,12 @@ namespace vcpkg msg::value, msg::value, msg::value), - "{value} is the original BinaryParagraph description.\n{value} is the original BinaryParagraph " - "maintainers.\n{value} is the original BinaryParagraph feature.\n{value} is the original BinaryParagraph " - "default_features.\n{value} is the original " - "BinaryParagraph dependencies.\n{value} is the original BinaryParagraph abi.\n{value} is the original " - "BinaryParagraph type.\n{value} is the serialized BinaryParagraph description.\n{value} is the serialized " - "BinaryParagraph " - "maintainers.\n{value} is the serialized BinaryParagraph feature.\n{value} is the serialized BinaryParagraph " - "default_features.\n{value} is the serialized " - "BinaryParagraph dependencies.\n{value} is the serialized BinaryParagraph abi.\n{value} is the serialized " - "BinaryParagraph type.", - "[sanity check] The serialized binary paragraph was different from the original binary " - "paragraph.\nPlease open an issue at {url}, with the following output:\n=== Original " - "BinaryParagraph ===\nspec: '{spec}'\nversion: '{version}'\nport_version: {version}\ndescription: " - "['{value}']\nmaintainers: ['{value}']\nfeature: '{value}'\ndefault feature: ['{value}']\ndependencies: " - "['{value}']\nabi: '{value}'\ntype: {value}\n\n=== Serialized BinaryParagraph ===\nspec: " - "'{spec}'\nversion: '{version}'\nport_version: {version}\ndescription: " - "['{value}']\nmaintainers: ['{value}']\nfeature: '{value}'\ndefault feature: ['{value}']\ndependencies: " - "['{value}']\nabi: '{value}'\ntype: {value}"); + "['{value}'] is the paragraph description.\n['{value}'] is the paragraph's maintainers.\n'{value}' is the " + "paragraph's feature.\n['{value}'] is the paragraphs default_feature.\n['{value}'] is the paragraphs " + "dependencies.\n'{value}' is the paragraphs abi.\n'{value}' is the paragraphs type.", + "\nspec: '{spec}'\n\nversion: {version}\nport_version: {version}\ndescription: " + "['{value}']\nmaintainers: ['{value}']\nfeature: '{value}'\ndefault_feature: " + "['{value}']\ndependencies: ['{value}']\nabi: '{value}'\ntype: {value}"); DECLARE_MESSAGE(ListOfValidFieldsForControlFiles, (), "", diff --git a/locales/messages.en.json b/locales/messages.en.json index 99921f5acc..a45674e68d 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -38,6 +38,7 @@ "AttemptingToFetchPackagesFromVendor": "Attempting to fetch {count} package(s) from {vendor}", "AuthenticationMayRequireManualAction": "One or more {vendor} credential providers requested manual action. Add the binary source 'interactive' to allow interactivity.", "AutoSettingEnvVar": "-- Automatically setting {env_var} environment variables to \"{url}\".", + "BinaryParagraphDescription": "\nspec: '{spec}'\n\nversion: {version}\nport_version: {version}\ndescription: ['{value}']\nmaintainers: ['{value}']\nfeature: '{value}'\ndefault_feature: ['{value}']\ndependencies: ['{value}']\nabi: '{value}'\ntype: {value}", "BothYesAndNoOptionSpecifiedError": "cannot specify both --no-{option} and --{option}.", "BuildAlreadyInstalled": "{spec} is already installed; please remove {spec} before attempting to build it.", "BuildDependenciesMissing": "The build command requires all dependencies to be already installed.\nThe following dependencies are missing:", @@ -179,12 +180,14 @@ "LoadingOverlayTriplet": "-- [OVERLAY] Loading triplet configuration from: {path}", "LocalizedMessageMustNotContainIndents": "The message named {value} contains what appears to be indenting which must be changed to use LocalizedString::append_indent instead.", "LocalizedMessageMustNotEndWithNewline": "The message named {value} ends with a newline which should be added by formatting rather than by localization.", + "MismatchedBinaryParagraphs": "[sanity check] The serialized binary paragraph was different from the original binary paragraph.\nPlease open an issue at {url}, with the following output:", "MonoInstructions": "This may be caused by an incomplete mono installation. Full mono is available on some systems via `sudo apt install mono-complete`. Ubuntu 18.04 users may need a newer version of mono, available at https://www.mono-project.com/download/stable/", "MsiexecFailedToExtract": "msiexec failed while extracting '{path}' with launch or exit code {exit_code} and message:", "MultiArch": "Multi-Arch must be 'same' but was {option}", "NoLocalizationForMessages": "No localized messages for the following: ", "NoRegistryForPort": "no registry configured for port {package_name}", "NoteMessage": "note: ", + "OriginalBinaryParagraphHeader": "\n=== Original Binary Paragraph ===", "PackingVendorFailed": "Packing {vendor} failed. Use --debug for more information.", "ParseControlErrorInfoInvalidFields": "The following fields were not expected:", "ParseControlErrorInfoMissingFields": "The following fields were missing:", @@ -203,7 +206,7 @@ "RestoredPackagesFromVendor": "Restored {count} package(s) from {value} in {elapsed}. Use --debug to see more details.", "ResultsHeader": "RESULTS", "SeeURL": "See {url} for more information.", - "SerializedDoesNotMatchOriginalBinPar": "[sanity check] The serialized binary paragraph was different from the original binary paragraph.\nPlease open an issue at {url}, with the following output:\n=== Original BinaryParagraph ===\nspec: '{spec}'\nversion: '{version}'\nport_version: {version}\ndescription: ['{value}']\nmaintainers: ['{value}']\nfeature: '{value}'\ndefault feature: ['{value}']\ndependencies: ['{value}']\nabi: '{value}'\ntype: {value}\n\n=== Serialized BinaryParagraph ===\nspec: '{spec}'\nversion: '{version}'\nport_version: {version}\ndescription: ['{value}']\nmaintainers: ['{value}']\nfeature: '{value}'\ndefault feature: ['{value}']\ndependencies: ['{value}']\nabi: '{value}'\ntype: {value}", + "SerializedBinaryParagraphHeader": "\n=== Serialized Binary Paragraph ===", "SettingEnvVar": "-- Setting \"{env_var}\" environment variables to \"{url}\".", "SourceFieldPortNameMismatch": "The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json file has the name {package_name} and does not match the port directory {path}.", "StoredBinaryCache": "Stored binary cache: '{path}'", diff --git a/locales/messages.json b/locales/messages.json index 51b151d0a9..99cbb8d365 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -69,6 +69,8 @@ "_AuthenticationMayRequireManualAction.comment": "An example of {vendor} is Azure.", "AutoSettingEnvVar": "-- Automatically setting {env_var} environment variables to \"{url}\".", "_AutoSettingEnvVar.comment": "An example of env_var is \"HTTP(S)_PROXY\"'--' at the beginning must be preserved An example of {env_var} is VCPKG_DEFAULT_TRIPLET. An example of {url} is https://github.com/microsoft/vcpkg.", + "BinaryParagraphDescription": "\nspec: '{spec}'\n\nversion: {version}\nport_version: {version}\ndescription: ['{value}']\nmaintainers: ['{value}']\nfeature: '{value}'\ndefault_feature: ['{value}']\ndependencies: ['{value}']\nabi: '{value}'\ntype: {value}", + "_BinaryParagraphDescription.comment": "['{value}'] is the paragraph description.\n['{value}'] is the paragraph's maintainers.\n'{value}' is the paragraph's feature.\n['{value}'] is the paragraphs default_feature.\n['{value}'] is the paragraphs dependencies.\n'{value}' is the paragraphs abi.\n'{value}' is the paragraphs type. An example of {spec} is zlib:x64-windows. An example of {version} is 1.3.8. An example of {version} is 1.3.8.", "BothYesAndNoOptionSpecifiedError": "cannot specify both --no-{option} and --{option}.", "_BothYesAndNoOptionSpecifiedError.comment": "An example of {option} is editable.", "BuildAlreadyInstalled": "{spec} is already installed; please remove {spec} before attempting to build it.", @@ -313,6 +315,8 @@ "_LocalizedMessageMustNotContainIndents.comment": "{value} is is a localized message name like LocalizedMessageMustNotContainIndents. The 'LocalizedString::append_indent' part is locale-invariant.", "LocalizedMessageMustNotEndWithNewline": "The message named {value} ends with a newline which should be added by formatting rather than by localization.", "_LocalizedMessageMustNotEndWithNewline.comment": "{value} is a localized message name like LocalizedMessageMustNotEndWithNewline", + "MismatchedBinaryParagraphs": "[sanity check] The serialized binary paragraph was different from the original binary paragraph.\nPlease open an issue at {url}, with the following output:", + "_MismatchedBinaryParagraphs.comment": "An example of {url} is https://github.com/microsoft/vcpkg.", "MonoInstructions": "This may be caused by an incomplete mono installation. Full mono is available on some systems via `sudo apt install mono-complete`. Ubuntu 18.04 users may need a newer version of mono, available at https://www.mono-project.com/download/stable/", "MsiexecFailedToExtract": "msiexec failed while extracting '{path}' with launch or exit code {exit_code} and message:", "_MsiexecFailedToExtract.comment": "An example of {path} is /foo/bar. An example of {exit_code} is 127.", @@ -322,6 +326,7 @@ "NoRegistryForPort": "no registry configured for port {package_name}", "_NoRegistryForPort.comment": "An example of {package_name} is zlib.", "NoteMessage": "note: ", + "OriginalBinaryParagraphHeader": "\n=== Original Binary Paragraph ===", "PackingVendorFailed": "Packing {vendor} failed. Use --debug for more information.", "_PackingVendorFailed.comment": "An example of {vendor} is Azure.", "ParseControlErrorInfoInvalidFields": "The following fields were not expected:", @@ -354,8 +359,7 @@ "_ResultsHeader.comment": "Displayed before a list of installation results.", "SeeURL": "See {url} for more information.", "_SeeURL.comment": "An example of {url} is https://github.com/microsoft/vcpkg.", - "SerializedDoesNotMatchOriginalBinPar": "[sanity check] The serialized binary paragraph was different from the original binary paragraph.\nPlease open an issue at {url}, with the following output:\n=== Original BinaryParagraph ===\nspec: '{spec}'\nversion: '{version}'\nport_version: {version}\ndescription: ['{value}']\nmaintainers: ['{value}']\nfeature: '{value}'\ndefault feature: ['{value}']\ndependencies: ['{value}']\nabi: '{value}'\ntype: {value}\n\n=== Serialized BinaryParagraph ===\nspec: '{spec}'\nversion: '{version}'\nport_version: {version}\ndescription: ['{value}']\nmaintainers: ['{value}']\nfeature: '{value}'\ndefault feature: ['{value}']\ndependencies: ['{value}']\nabi: '{value}'\ntype: {value}", - "_SerializedDoesNotMatchOriginalBinPar.comment": "{value} is the original BinaryParagraph description.\n{value} is the original BinaryParagraph maintainers.\n{value} is the original BinaryParagraph feature.\n{value} is the original BinaryParagraph default_features.\n{value} is the original BinaryParagraph dependencies.\n{value} is the original BinaryParagraph abi.\n{value} is the original BinaryParagraph type.\n{value} is the serialized BinaryParagraph description.\n{value} is the serialized BinaryParagraph maintainers.\n{value} is the serialized BinaryParagraph feature.\n{value} is the serialized BinaryParagraph default_features.\n{value} is the serialized BinaryParagraph dependencies.\n{value} is the serialized BinaryParagraph abi.\n{value} is the serialized BinaryParagraph type. An example of {url} is https://github.com/microsoft/vcpkg. An example of {spec} is zlib:x64-windows. An example of {version} is 1.3.8. An example of {version} is 1.3.8. An example of {spec} is zlib:x64-windows. An example of {version} is 1.3.8. An example of {version} is 1.3.8.", + "SerializedBinaryParagraphHeader": "\n=== Serialized Binary Paragraph ===", "SettingEnvVar": "-- Setting \"{env_var}\" environment variables to \"{url}\".", "_SettingEnvVar.comment": "An example of env_var is \"HTTP(S)_PROXY\"'--' at the beginning must be preserved An example of {env_var} is VCPKG_DEFAULT_TRIPLET. An example of {url} is https://github.com/microsoft/vcpkg.", "SourceFieldPortNameMismatch": "The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json file has the name {package_name} and does not match the port directory {path}.", diff --git a/src/vcpkg/base/messages.cpp b/src/vcpkg/base/messages.cpp index c94fab18ec..d6cd57deb5 100644 --- a/src/vcpkg/base/messages.cpp +++ b/src/vcpkg/base/messages.cpp @@ -645,7 +645,10 @@ namespace vcpkg REGISTER_MESSAGE(ErrorParsingBinaryParagraph); REGISTER_MESSAGE(MultiArch); REGISTER_MESSAGE(FailedToParseBinParagraph); - REGISTER_MESSAGE(SerializedDoesNotMatchOriginalBinPar); REGISTER_MESSAGE(ListOfValidFieldsForControlFiles); REGISTER_MESSAGE(SuggestUpdateVcpkg); + REGISTER_MESSAGE(MismatchedBinaryParagraphs); + REGISTER_MESSAGE(OriginalBinaryParagraphHeader); + REGISTER_MESSAGE(SerializedBinaryParagraphHeader); + REGISTER_MESSAGE(BinaryParagraphDescription); } diff --git a/src/vcpkg/binaryparagraph.cpp b/src/vcpkg/binaryparagraph.cpp index 0d10ddd4ac..74d8bdd230 100644 --- a/src/vcpkg/binaryparagraph.cpp +++ b/src/vcpkg/binaryparagraph.cpp @@ -291,29 +291,35 @@ namespace vcpkg if (binary_paragraph != pgh) { const auto& join_str = R"(", ")"; - Checks::msg_exit_maybe_upgrade(VCPKG_LINE_INFO, - msgSerializedDoesNotMatchOriginalBinPar, - msg::url = "https://github.com/microsoft/vcpkg", - msg::spec = pgh.spec, - msg::version = pgh.version, - msg::version = pgh.port_version, - msg::value = Strings::join(join_str, pgh.description), - msg::value = Strings::join(join_str, pgh.maintainers), - msg::value = pgh.feature, - msg::value = Strings::join(join_str, pgh.default_features), - msg::value = Strings::join(join_str, pgh.dependencies), - msg::value = pgh.abi, - msg::value = Type::to_string(pgh.type), - msg::spec = binary_paragraph.spec, - msg::version = binary_paragraph.version, - msg::version = binary_paragraph.port_version, - msg::value = Strings::join(join_str, binary_paragraph.description), - msg::value = Strings::join(join_str, binary_paragraph.maintainers), - msg::value = binary_paragraph.feature, - msg::value = Strings::join(join_str, binary_paragraph.default_features), - msg::value = Strings::join(join_str, binary_paragraph.dependencies), - msg::value = binary_paragraph.abi, - msg::value = Type::to_string(binary_paragraph.type)); + Checks::msg_exit_maybe_upgrade( + VCPKG_LINE_INFO, + msg::format(msgMismatchedBinaryParagraphs, msg::url = "https://github.com/microsoft/vcpkg") + .append_raw("\n") + .append(msgOriginalBinaryParagraphHeader) + .append(msgBinaryParagraphDescription, + msg::spec = pgh.spec, + msg::version = pgh.version, + msg::version = pgh.port_version, + msg::value = Strings::join(join_str, pgh.description), + msg::value = Strings::join(join_str, pgh.maintainers), + msg::value = pgh.feature, + msg::value = Strings::join(join_str, pgh.default_features), + msg::value = Strings::join(join_str, pgh.dependencies), + msg::value = pgh.abi, + msg::value = Type::to_string(pgh.type)) + .append_raw("\n") + .append(msgSerializedBinaryParagraphHeader) + .append(msgBinaryParagraphDescription, + msg::spec = binary_paragraph.spec, + msg::version = binary_paragraph.version, + msg::version = binary_paragraph.port_version, + msg::value = Strings::join(join_str, binary_paragraph.description), + msg::value = Strings::join(join_str, binary_paragraph.maintainers), + msg::value = binary_paragraph.feature, + msg::value = Strings::join(join_str, binary_paragraph.default_features), + msg::value = Strings::join(join_str, binary_paragraph.dependencies), + msg::value = binary_paragraph.abi, + msg::value = Type::to_string(binary_paragraph.type))); } } } From 642aaeea03dabf16e12fb3ec9fbf36d88562489b Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Fri, 15 Jul 2022 11:30:25 -0700 Subject: [PATCH 14/61] All messages are localized. --- include/vcpkg/base/messages.h | 14 ++++++++++++-- locales/messages.en.json | 1 + locales/messages.json | 4 ++++ src/vcpkg/base/messages.cpp | 1 + src/vcpkg/sourceparagraph.cpp | 14 +++++++------- 5 files changed, 25 insertions(+), 9 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index eb723301b1..86cf2abd4a 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -1217,8 +1217,14 @@ namespace vcpkg "", "[sanity check] The serialized binary paragraph was different from the original binary " "paragraph.\nPlease open an issue at {url}, with the following output:"); - DECLARE_MESSAGE(OriginalBinaryParagraphHeader, (), "", "\n=== Original Binary Paragraph ==="); - DECLARE_MESSAGE(SerializedBinaryParagraphHeader, (), "", "\n=== Serialized Binary Paragraph ==="); + DECLARE_MESSAGE(OriginalBinaryParagraphHeader, + (), + "The binary paragraph description is expected after this.", + "\n=== Original Binary Paragraph ==="); + DECLARE_MESSAGE(SerializedBinaryParagraphHeader, + (), + "The binary paragraph description is expected after this.", + "\n=== Serialized Binary Paragraph ==="); DECLARE_MESSAGE( BinaryParagraphDescription, (msg::spec, @@ -1245,4 +1251,8 @@ namespace vcpkg (msg::command_line), "", "You may need to update the vcpkg binary; try running {command_line} to update."); + DECLARE_MESSAGE(ErrorWhileParsing, + (msg::value), + "'{value}' is the file name.", + "Errors occurred while parsing '{value}'."); } diff --git a/locales/messages.en.json b/locales/messages.en.json index a45674e68d..58adb7763f 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -103,6 +103,7 @@ "ErrorVcvarsUnsupported": "in triplet {triplet}: Use of Visual Studio's Developer Prompt is unsupported on non-Windows hosts.\nDefine 'VCPKG_CMAKE_SYSTEM_NAME' or 'VCPKG_CHAINLOAD_TOOLCHAIN_FILE' in the triplet file.", "ErrorVsCodeNotFound": "Visual Studio Code was not found and the environment variable {env_var} is not set or invalid.", "ErrorVsCodeNotFoundPathExamined": "The following paths were examined:", + "ErrorWhileParsing": "Errors occurred while parsing '{value}'.", "ExcludedPackage": "Excluded {spec}", "ExpectedCharacterHere": "expected '{expected}' here", "ExpectedFailOrSkip": "expected 'fail', 'skip', or 'pass' here", diff --git a/locales/messages.json b/locales/messages.json index 99cbb8d365..6a2c29bc88 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -186,6 +186,8 @@ "ErrorVsCodeNotFound": "Visual Studio Code was not found and the environment variable {env_var} is not set or invalid.", "_ErrorVsCodeNotFound.comment": "An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", "ErrorVsCodeNotFoundPathExamined": "The following paths were examined:", + "ErrorWhileParsing": "Errors occurred while parsing '{value}'.", + "_ErrorWhileParsing.comment": "'{value}' is the file name.", "ExcludedPackage": "Excluded {spec}", "_ExcludedPackage.comment": "An example of {spec} is zlib:x64-windows.", "ExpectedCharacterHere": "expected '{expected}' here", @@ -327,6 +329,7 @@ "_NoRegistryForPort.comment": "An example of {package_name} is zlib.", "NoteMessage": "note: ", "OriginalBinaryParagraphHeader": "\n=== Original Binary Paragraph ===", + "_OriginalBinaryParagraphHeader.comment": "The binary paragraph description is expected after this.", "PackingVendorFailed": "Packing {vendor} failed. Use --debug for more information.", "_PackingVendorFailed.comment": "An example of {vendor} is Azure.", "ParseControlErrorInfoInvalidFields": "The following fields were not expected:", @@ -360,6 +363,7 @@ "SeeURL": "See {url} for more information.", "_SeeURL.comment": "An example of {url} is https://github.com/microsoft/vcpkg.", "SerializedBinaryParagraphHeader": "\n=== Serialized Binary Paragraph ===", + "_SerializedBinaryParagraphHeader.comment": "The binary paragraph description is expected after this.", "SettingEnvVar": "-- Setting \"{env_var}\" environment variables to \"{url}\".", "_SettingEnvVar.comment": "An example of env_var is \"HTTP(S)_PROXY\"'--' at the beginning must be preserved An example of {env_var} is VCPKG_DEFAULT_TRIPLET. An example of {url} is https://github.com/microsoft/vcpkg.", "SourceFieldPortNameMismatch": "The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json file has the name {package_name} and does not match the port directory {path}.", diff --git a/src/vcpkg/base/messages.cpp b/src/vcpkg/base/messages.cpp index d6cd57deb5..132c3359c3 100644 --- a/src/vcpkg/base/messages.cpp +++ b/src/vcpkg/base/messages.cpp @@ -651,4 +651,5 @@ namespace vcpkg REGISTER_MESSAGE(OriginalBinaryParagraphHeader); REGISTER_MESSAGE(SerializedBinaryParagraphHeader); REGISTER_MESSAGE(BinaryParagraphDescription); + REGISTER_MESSAGE(ErrorWhileParsing); } diff --git a/src/vcpkg/sourceparagraph.cpp b/src/vcpkg/sourceparagraph.cpp index d14ffca905..896ea80b67 100644 --- a/src/vcpkg/sourceparagraph.cpp +++ b/src/vcpkg/sourceparagraph.cpp @@ -1429,7 +1429,7 @@ namespace vcpkg } if (start_of_chunk != end_of_chunk) { - print2(Color::error, StringView{start_of_chunk, end_of_chunk}); + msg::println_error(LocalizedString::from_raw(StringView{start_of_chunk, end_of_chunk})); start_of_chunk = end_of_chunk; } @@ -1439,11 +1439,10 @@ namespace vcpkg } if (start_of_chunk != end_of_chunk) { - print2(StringView{start_of_chunk, end_of_chunk}); + msg::println_error(LocalizedString::from_raw(StringView{start_of_chunk, end_of_chunk})); start_of_chunk = end_of_chunk; } } - print2('\n'); } Optional SourceControlFile::find_feature(StringView featurename) const @@ -1614,11 +1613,12 @@ namespace vcpkg auto maybe_configuration = reader.visit(*configuration, get_configuration_deserializer()); if (!reader.errors().empty()) { - print2(Color::error, "Errors occurred while parsing ", ManifestDeserializer::VCPKG_CONFIGURATION, "\n"); + msg::println_error(msgErrorWhileParsing, msg::value = ManifestDeserializer::VCPKG_CONFIGURATION); for (auto&& msg : reader.errors()) - print2(" ", msg, '\n'); - - print2("See ", docs::registries_url, " for more information.\n"); + { + msg::println_error(LocalizedString::from_raw("").append_indent().append_raw(msg)); + } + msg::println(msgExtendedDocumentationAtUrl, msg::url = docs::registries_url); Checks::exit_fail(VCPKG_LINE_INFO); } obj.insert(ManifestDeserializer::VCPKG_CONFIGURATION, From 258292bf5489833129315a71bb376591427f58a6 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Fri, 15 Jul 2022 11:33:17 -0700 Subject: [PATCH 15/61] Sorted Messages --- include/vcpkg/base/messages.h | 102 +++++++++++++++++----------------- src/vcpkg/base/messages.cpp | 20 +++---- 2 files changed, 61 insertions(+), 61 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index 86cf2abd4a..95609a064e 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -510,6 +510,24 @@ namespace vcpkg "An example of env_var is \"HTTP(S)_PROXY\"" "'--' at the beginning must be preserved", "-- Automatically setting {env_var} environment variables to \"{url}\"."); + DECLARE_MESSAGE( + BinaryParagraphDescription, + (msg::spec, + msg::version, + msg::version, + msg::value, + msg::value, + msg::value, + msg::value, + msg::value, + msg::value, + msg::value), + "['{value}'] is the paragraph description.\n['{value}'] is the paragraph's maintainers.\n'{value}' is the " + "paragraph's feature.\n['{value}'] is the paragraphs default_feature.\n['{value}'] is the paragraphs " + "dependencies.\n'{value}' is the paragraphs abi.\n'{value}' is the paragraphs type.", + "\nspec: '{spec}'\n\nversion: {version}\nport_version: {version}\ndescription: " + "['{value}']\nmaintainers: ['{value}']\nfeature: '{value}'\ndefault_feature: " + "['{value}']\ndependencies: ['{value}']\nabi: '{value}'\ntype: {value}"); DECLARE_MESSAGE(BuildAlreadyInstalled, (msg::spec), "", @@ -715,6 +733,7 @@ namespace vcpkg DECLARE_MESSAGE(ErrorNoVSInstanceAt, (msg::path), "", "at \"{path}\""); DECLARE_MESSAGE(ErrorNoVSInstanceFullVersion, (msg::version), "", "with toolset version prefix {version}"); DECLARE_MESSAGE(ErrorNoVSInstanceVersion, (msg::version), "", "with toolset version {version}"); + DECLARE_MESSAGE(ErrorParsingBinaryParagraph, (msg::spec), "", "while parsing the Binary Paragraph for {spec}"); DECLARE_MESSAGE(ErrorRequireBaseline, (), "", @@ -741,6 +760,10 @@ namespace vcpkg "", "Visual Studio Code was not found and the environment variable {env_var} is not set or invalid."); DECLARE_MESSAGE(ErrorVsCodeNotFoundPathExamined, (), "", "The following paths were examined:"); + DECLARE_MESSAGE(ErrorWhileParsing, + (msg::value), + "'{value}' is the file name.", + "Errors occurred while parsing '{value}'."); DECLARE_MESSAGE(ExcludedPackage, (msg::spec), "", "Excluded {spec}"); DECLARE_MESSAGE( ExpectedCharacterHere, @@ -751,6 +774,12 @@ namespace vcpkg DECLARE_MESSAGE(ExpectedPortName, (), "", "expected a port name here"); DECLARE_MESSAGE(ExpectedTripletName, (), "", "expected a triplet name here"); DECLARE_MESSAGE(ExtendedDocumentationAtUrl, (msg::url), "", "Extended documentation available at '{url}'."); + DECLARE_MESSAGE(FailedToParseBinParagraph, + (msg::url, msg::error_msg, msg::value), + "'{error_msg}' is the error message for failing to parse the Binary Paragraph, '{value}' is the " + "Binary Paragraph", + "[sanity check] Failed to parse a serialized binary paragraph.\nPlease open an issue at {url}, " + "with the following output:\n{error_msg}\n=== Serialized BinaryParagraph ===\n{value}"); DECLARE_MESSAGE(FailedToProvisionCe, (), "", "Failed to provision vcpkg-ce."); DECLARE_MESSAGE(FailedToRunToolToDetermineVersion, (msg::tool_name, msg::path), @@ -965,6 +994,10 @@ namespace vcpkg (msg::value), "Example of {value} is 'unknownlicense'", "Unknown license identifier '{value}'. Known values are listed at https://spdx.org/licenses/"); + DECLARE_MESSAGE(ListOfValidFieldsForControlFiles, + (), + "", + "This is the list of valid fields for CONTROL files (case-sensitive):"); DECLARE_MESSAGE(LoadingCommunityTriplet, (msg::path), "'-- [COMMUNITY]' at the beginning must be preserved", @@ -984,6 +1017,11 @@ namespace vcpkg "{value} is a localized message name like LocalizedMessageMustNotEndWithNewline", "The message named {value} ends with a newline which should be added by formatting " "rather than by localization."); + DECLARE_MESSAGE(MismatchedBinaryParagraphs, + (msg::url), + "", + "[sanity check] The serialized binary paragraph was different from the original binary " + "paragraph.\nPlease open an issue at {url}, with the following output:"); DECLARE_MESSAGE(MonoInstructions, (), "", @@ -994,8 +1032,13 @@ namespace vcpkg (msg::path, msg::exit_code), "", "msiexec failed while extracting '{path}' with launch or exit code {exit_code} and message:"); + DECLARE_MESSAGE(MultiArch, (msg::option), "", "Multi-Arch must be 'same' but was {option}"); DECLARE_MESSAGE(NoLocalizationForMessages, (), "", "No localized messages for the following: "); DECLARE_MESSAGE(NoRegistryForPort, (msg::package_name), "", "no registry configured for port {package_name}"); + DECLARE_MESSAGE(OriginalBinaryParagraphHeader, + (), + "The binary paragraph description is expected after this.", + "\n=== Original Binary Paragraph ==="); DECLARE_MESSAGE(PackingVendorFailed, (msg::vendor), "", @@ -1048,6 +1091,10 @@ namespace vcpkg "{value} may be either a 'vendor' like 'Azure' or 'NuGet', or a file path like C:\\example or /usr/example", "Restored {count} package(s) from {value} in {elapsed}. Use --debug to see more details."); DECLARE_MESSAGE(ResultsHeader, (), "Displayed before a list of installation results.", "RESULTS"); + DECLARE_MESSAGE(SerializedBinaryParagraphHeader, + (), + "The binary paragraph description is expected after this.", + "\n=== Serialized Binary Paragraph ==="); DECLARE_MESSAGE(SettingEnvVar, (msg::env_var, msg::url), "An example of env_var is \"HTTP(S)_PROXY\"" @@ -1060,6 +1107,10 @@ namespace vcpkg "The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json " "file has the name {package_name} and does not match the port directory {path}."); DECLARE_MESSAGE(StoredBinaryCache, (msg::path), "", "Stored binary cache: '{path}'"); + DECLARE_MESSAGE(SuggestUpdateVcpkg, + (msg::command_line), + "", + "You may need to update the vcpkg binary; try running {command_line} to update."); DECLARE_MESSAGE(SystemApiErrorMessage, (msg::system_api, msg::exit_code, msg::error_msg), "", @@ -1204,55 +1255,4 @@ namespace vcpkg "The message named {value} starts with warning:, it must be changed to prepend " "WarningMessage in code instead."); DECLARE_MESSAGE(WarningsTreatedAsErrors, (), "", "previous warnings being interpreted as errors"); - DECLARE_MESSAGE(ErrorParsingBinaryParagraph, (msg::spec), "", "while parsing the Binary Paragraph for {spec}"); - DECLARE_MESSAGE(MultiArch, (msg::option), "", "Multi-Arch must be 'same' but was {option}"); - DECLARE_MESSAGE(FailedToParseBinParagraph, - (msg::url, msg::error_msg, msg::value), - "'{error_msg}' is the error message for failing to parse the Binary Paragraph, '{value}' is the " - "Binary Paragraph", - "[sanity check] Failed to parse a serialized binary paragraph.\nPlease open an issue at {url}, " - "with the following output:\n{error_msg}\n=== Serialized BinaryParagraph ===\n{value}"); - DECLARE_MESSAGE(MismatchedBinaryParagraphs, - (msg::url), - "", - "[sanity check] The serialized binary paragraph was different from the original binary " - "paragraph.\nPlease open an issue at {url}, with the following output:"); - DECLARE_MESSAGE(OriginalBinaryParagraphHeader, - (), - "The binary paragraph description is expected after this.", - "\n=== Original Binary Paragraph ==="); - DECLARE_MESSAGE(SerializedBinaryParagraphHeader, - (), - "The binary paragraph description is expected after this.", - "\n=== Serialized Binary Paragraph ==="); - DECLARE_MESSAGE( - BinaryParagraphDescription, - (msg::spec, - msg::version, - msg::version, - msg::value, - msg::value, - msg::value, - msg::value, - msg::value, - msg::value, - msg::value), - "['{value}'] is the paragraph description.\n['{value}'] is the paragraph's maintainers.\n'{value}' is the " - "paragraph's feature.\n['{value}'] is the paragraphs default_feature.\n['{value}'] is the paragraphs " - "dependencies.\n'{value}' is the paragraphs abi.\n'{value}' is the paragraphs type.", - "\nspec: '{spec}'\n\nversion: {version}\nport_version: {version}\ndescription: " - "['{value}']\nmaintainers: ['{value}']\nfeature: '{value}'\ndefault_feature: " - "['{value}']\ndependencies: ['{value}']\nabi: '{value}'\ntype: {value}"); - DECLARE_MESSAGE(ListOfValidFieldsForControlFiles, - (), - "", - "This is the list of valid fields for CONTROL files (case-sensitive):"); - DECLARE_MESSAGE(SuggestUpdateVcpkg, - (msg::command_line), - "", - "You may need to update the vcpkg binary; try running {command_line} to update."); - DECLARE_MESSAGE(ErrorWhileParsing, - (msg::value), - "'{value}' is the file name.", - "Errors occurred while parsing '{value}'."); } diff --git a/src/vcpkg/base/messages.cpp b/src/vcpkg/base/messages.cpp index 132c3359c3..2cbea7ab09 100644 --- a/src/vcpkg/base/messages.cpp +++ b/src/vcpkg/base/messages.cpp @@ -444,6 +444,7 @@ namespace vcpkg REGISTER_MESSAGE(AttemptingToFetchPackagesFromVendor); REGISTER_MESSAGE(AuthenticationMayRequireManualAction); REGISTER_MESSAGE(AutoSettingEnvVar); + REGISTER_MESSAGE(BinaryParagraphDescription); REGISTER_MESSAGE(BuildAlreadyInstalled); REGISTER_MESSAGE(BuildDependenciesMissing); REGISTER_MESSAGE(BuildingFromHead); @@ -498,18 +499,21 @@ namespace vcpkg REGISTER_MESSAGE(ErrorNoVSInstanceAt); REGISTER_MESSAGE(ErrorNoVSInstanceFullVersion); REGISTER_MESSAGE(ErrorNoVSInstanceVersion); + REGISTER_MESSAGE(ErrorParsingBinaryParagraph); REGISTER_MESSAGE(ErrorRequireBaseline); REGISTER_MESSAGE(ErrorRequirePackagesList); REGISTER_MESSAGE(ErrorUnableToDetectCompilerInfo); REGISTER_MESSAGE(ErrorVcvarsUnsupported); REGISTER_MESSAGE(ErrorVsCodeNotFound); REGISTER_MESSAGE(ErrorVsCodeNotFoundPathExamined); + REGISTER_MESSAGE(ErrorWhileParsing); REGISTER_MESSAGE(ExcludedPackage); REGISTER_MESSAGE(ExpectedCharacterHere); REGISTER_MESSAGE(ExpectedFailOrSkip); REGISTER_MESSAGE(ExpectedPortName); REGISTER_MESSAGE(ExpectedTripletName); REGISTER_MESSAGE(ExtendedDocumentationAtUrl); + REGISTER_MESSAGE(FailedToParseBinParagraph); REGISTER_MESSAGE(FailedToProvisionCe); REGISTER_MESSAGE(FailedToRunToolToDetermineVersion); REGISTER_MESSAGE(FailedToStoreBackToMirror); @@ -572,14 +576,18 @@ namespace vcpkg REGISTER_MESSAGE(LicenseExpressionImbalancedParens); REGISTER_MESSAGE(LicenseExpressionUnknownException); REGISTER_MESSAGE(LicenseExpressionUnknownLicense); + REGISTER_MESSAGE(ListOfValidFieldsForControlFiles); REGISTER_MESSAGE(LoadingCommunityTriplet); REGISTER_MESSAGE(LoadingOverlayTriplet); REGISTER_MESSAGE(LocalizedMessageMustNotContainIndents); REGISTER_MESSAGE(LocalizedMessageMustNotEndWithNewline); + REGISTER_MESSAGE(MismatchedBinaryParagraphs); REGISTER_MESSAGE(MonoInstructions); REGISTER_MESSAGE(MsiexecFailedToExtract); + REGISTER_MESSAGE(MultiArch); REGISTER_MESSAGE(NoLocalizationForMessages); REGISTER_MESSAGE(NoRegistryForPort); + REGISTER_MESSAGE(OriginalBinaryParagraphHeader); REGISTER_MESSAGE(PackingVendorFailed); REGISTER_MESSAGE(ParseControlErrorInfoInvalidFields); REGISTER_MESSAGE(ParseControlErrorInfoMissingFields); @@ -596,9 +604,11 @@ namespace vcpkg REGISTER_MESSAGE(RestoredPackage); REGISTER_MESSAGE(RestoredPackagesFromVendor); REGISTER_MESSAGE(ResultsHeader); + REGISTER_MESSAGE(SerializedBinaryParagraphHeader); REGISTER_MESSAGE(SettingEnvVar); REGISTER_MESSAGE(SourceFieldPortNameMismatch); REGISTER_MESSAGE(StoredBinaryCache); + REGISTER_MESSAGE(SuggestUpdateVcpkg); REGISTER_MESSAGE(SystemApiErrorMessage); REGISTER_MESSAGE(ToolFetchFailed); REGISTER_MESSAGE(ToolInWin10); @@ -642,14 +652,4 @@ namespace vcpkg REGISTER_MESSAGE(WaitingToTakeFilesystemLock); REGISTER_MESSAGE(WarningMessageMustUsePrintWarning); REGISTER_MESSAGE(WarningsTreatedAsErrors); - REGISTER_MESSAGE(ErrorParsingBinaryParagraph); - REGISTER_MESSAGE(MultiArch); - REGISTER_MESSAGE(FailedToParseBinParagraph); - REGISTER_MESSAGE(ListOfValidFieldsForControlFiles); - REGISTER_MESSAGE(SuggestUpdateVcpkg); - REGISTER_MESSAGE(MismatchedBinaryParagraphs); - REGISTER_MESSAGE(OriginalBinaryParagraphHeader); - REGISTER_MESSAGE(SerializedBinaryParagraphHeader); - REGISTER_MESSAGE(BinaryParagraphDescription); - REGISTER_MESSAGE(ErrorWhileParsing); } From 6e69b6ea79d0cc6b290129cf951348c9a407e140 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Fri, 15 Jul 2022 11:55:37 -0700 Subject: [PATCH 16/61] WIP --- include/vcpkg/base/messages.h | 1 + locales/messages.en.json | 1 + locales/messages.json | 2 ++ src/vcpkg/base/messages.cpp | 1 + src/vcpkg/build.cpp | 8 ++++---- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index 224084a65a..3c1672f19f 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -1204,4 +1204,5 @@ namespace vcpkg "The message named {value} starts with warning:, it must be changed to prepend " "WarningMessage in code instead."); DECLARE_MESSAGE(WarningsTreatedAsErrors, (), "", "previous warnings being interpreted as errors"); + DECLARE_MESSAGE(ErrorWhileWriting, (msg::error_msg), "", "Error occured while writing {error_msg}"); } diff --git a/locales/messages.en.json b/locales/messages.en.json index 39737749c1..1d5b18ccd1 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -101,6 +101,7 @@ "ErrorVcvarsUnsupported": "in triplet {triplet}: Use of Visual Studio's Developer Prompt is unsupported on non-Windows hosts.\nDefine 'VCPKG_CMAKE_SYSTEM_NAME' or 'VCPKG_CHAINLOAD_TOOLCHAIN_FILE' in the triplet file.", "ErrorVsCodeNotFound": "Visual Studio Code was not found and the environment variable {env_var} is not set or invalid.", "ErrorVsCodeNotFoundPathExamined": "The following paths were examined:", + "ErrorWhileWriting": "Error occured while writing {error_msg}", "ExcludedPackage": "Excluded {spec}", "ExpectedCharacterHere": "expected '{expected}' here", "ExpectedFailOrSkip": "expected 'fail', 'skip', or 'pass' here", diff --git a/locales/messages.json b/locales/messages.json index 4d94a58546..c58b22f326 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -182,6 +182,8 @@ "ErrorVsCodeNotFound": "Visual Studio Code was not found and the environment variable {env_var} is not set or invalid.", "_ErrorVsCodeNotFound.comment": "An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", "ErrorVsCodeNotFoundPathExamined": "The following paths were examined:", + "ErrorWhileWriting": "Error occured while writing {error_msg}", + "_ErrorWhileWriting.comment": "An example of {error_msg} is File Not Found.", "ExcludedPackage": "Excluded {spec}", "_ExcludedPackage.comment": "An example of {spec} is zlib:x64-windows.", "ExpectedCharacterHere": "expected '{expected}' here", diff --git a/src/vcpkg/base/messages.cpp b/src/vcpkg/base/messages.cpp index 4f56e2c89c..9c77f44e5e 100644 --- a/src/vcpkg/base/messages.cpp +++ b/src/vcpkg/base/messages.cpp @@ -642,4 +642,5 @@ namespace vcpkg REGISTER_MESSAGE(WaitingToTakeFilesystemLock); REGISTER_MESSAGE(WarningMessageMustUsePrintWarning); REGISTER_MESSAGE(WarningsTreatedAsErrors); + REGISTER_MESSAGE(ErrorWhileWriting); } diff --git a/src/vcpkg/build.cpp b/src/vcpkg/build.cpp index b3b6efb6c3..cca7e11e90 100644 --- a/src/vcpkg/build.cpp +++ b/src/vcpkg/build.cpp @@ -675,10 +675,10 @@ namespace vcpkg const auto old_buf_size = buf.size(); Strings::append(buf, s, '\n'); const auto write_size = buf.size() - old_buf_size; - Checks::check_exit(VCPKG_LINE_INFO, - out_file.write(buf.c_str() + old_buf_size, 1, write_size) == write_size, - "Error occurred while writing '%s'", - stdoutlog); + Checks::msg_check_exit(VCPKG_LINE_INFO, + out_file.write(buf.c_str() + old_buf_size, 1, write_size) == write_size, + msgErrorWhileWriting, + msg::error_msg = stdoutlog); }, default_working_directory, env); From 1265b0c525e74b70812619242d8a2a8ac83783a2 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Fri, 15 Jul 2022 12:01:40 -0700 Subject: [PATCH 17/61] UndeterminedToolChainForTriplet --- include/vcpkg/base/messages.h | 6 ++++++ locales/messages.en.json | 1 + locales/messages.json | 2 ++ src/vcpkg/base/messages.cpp | 1 + src/vcpkg/build.cpp | 9 ++++----- 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index 3c1672f19f..c3669009e9 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -1205,4 +1205,10 @@ namespace vcpkg "WarningMessage in code instead."); DECLARE_MESSAGE(WarningsTreatedAsErrors, (), "", "previous warnings being interpreted as errors"); DECLARE_MESSAGE(ErrorWhileWriting, (msg::error_msg), "", "Error occured while writing {error_msg}"); + DECLARE_MESSAGE(UndeterminedToolChainForTriplet, + (msg::triplet, msg::system_name), + "", + "Unable to determine toolchain use for {triplet} with with CMAKE_SYSTEM_NAME {system_name}. Did " + "you mean to use " + "VCPKG_CHAINLOAD_TOOLCHAIN_FILE?"); } diff --git a/locales/messages.en.json b/locales/messages.en.json index 1d5b18ccd1..84692b5439 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -206,6 +206,7 @@ "SystemApiErrorMessage": "calling {system_api} failed with {exit_code} ({error_msg})", "ToolFetchFailed": "Could not fetch {tool_name}.", "ToolInWin10": "This utility is bundled with Windows 10 or later.", + "UndeterminedToolChainForTriplet": "Unable to determine toolchain use for {triplet} with with CMAKE_SYSTEM_NAME {system_name}. Did you mean to use VCPKG_CHAINLOAD_TOOLCHAIN_FILE?", "UnexpectedErrorDuringBulkDownload": "an unexpected error occurred during bulk download.", "UnexpectedToolOutput": "{tool_name} ({path}) produced unexpected output when attempting to determine the version:", "UnknownBaselineFileContent": "unrecognizable baseline entry; expected 'port:triplet=(fail|skip|pass)'", diff --git a/locales/messages.json b/locales/messages.json index c58b22f326..88608f745d 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -360,6 +360,8 @@ "ToolFetchFailed": "Could not fetch {tool_name}.", "_ToolFetchFailed.comment": "An example of {tool_name} is aria2.", "ToolInWin10": "This utility is bundled with Windows 10 or later.", + "UndeterminedToolChainForTriplet": "Unable to determine toolchain use for {triplet} with with CMAKE_SYSTEM_NAME {system_name}. Did you mean to use VCPKG_CHAINLOAD_TOOLCHAIN_FILE?", + "_UndeterminedToolChainForTriplet.comment": "An example of {triplet} is x64-windows. An example of {system_name} is Darwin.", "UnexpectedErrorDuringBulkDownload": "an unexpected error occurred during bulk download.", "UnexpectedToolOutput": "{tool_name} ({path}) produced unexpected output when attempting to determine the version:", "_UnexpectedToolOutput.comment": "The actual command line output will be appended after this message. An example of {tool_name} is aria2. An example of {path} is /foo/bar.", diff --git a/src/vcpkg/base/messages.cpp b/src/vcpkg/base/messages.cpp index 9c77f44e5e..56c793fb8e 100644 --- a/src/vcpkg/base/messages.cpp +++ b/src/vcpkg/base/messages.cpp @@ -643,4 +643,5 @@ namespace vcpkg REGISTER_MESSAGE(WarningMessageMustUsePrintWarning); REGISTER_MESSAGE(WarningsTreatedAsErrors); REGISTER_MESSAGE(ErrorWhileWriting); + REGISTER_MESSAGE(UndeterminedToolChainForTriplet); } diff --git a/src/vcpkg/build.cpp b/src/vcpkg/build.cpp index cca7e11e90..7d7dcdac15 100644 --- a/src/vcpkg/build.cpp +++ b/src/vcpkg/build.cpp @@ -834,11 +834,10 @@ namespace vcpkg } else { - Checks::exit_maybe_upgrade(VCPKG_LINE_INFO, - "Unable to determine toolchain to use for triplet %s with CMAKE_SYSTEM_NAME %s; " - "maybe you meant to use VCPKG_CHAINLOAD_TOOLCHAIN_FILE?", - triplet, - cmake_system_name); + Checks::msg_exit_maybe_upgrade(VCPKG_LINE_INFO, + msgUndeterminedToolChainForTriplet, + msg::triplet = triplet, + msg::system_name = cmake_system_name); } } From 57a045a214ba04d1485510303e38c62c83f4d5c1 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Fri, 15 Jul 2022 12:11:16 -0700 Subject: [PATCH 18/61] return_code lambda --- src/vcpkg/build.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/vcpkg/build.cpp b/src/vcpkg/build.cpp index 7d7dcdac15..6cecf40d5b 100644 --- a/src/vcpkg/build.cpp +++ b/src/vcpkg/build.cpp @@ -913,11 +913,11 @@ namespace vcpkg return_code = cmd_execute_and_stream_data( command, [&](StringView sv) { - print2(sv); - Checks::check_exit(VCPKG_LINE_INFO, - out_file.write(sv.data(), 1, sv.size()) == sv.size(), - "Error occurred while writing '%s'", - stdoutlog); + msg::println(LocalizedString::from_raw(sv)); + Checks::msg_check_exit(VCPKG_LINE_INFO, + out_file.write(sv.data(), 1, sv.size()) == sv.size(), + msgErrorWhileWriting, + msg::error_msg = stdoutlog); }, default_working_directory, env); From 462127b6a4c8854636f1097707d0168d71f276fb Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Fri, 15 Jul 2022 12:20:26 -0700 Subject: [PATCH 19/61] FailedToFindDependencyAbi --- include/vcpkg/base/messages.h | 4 ++++ locales/messages.en.json | 1 + locales/messages.json | 2 ++ src/vcpkg/base/messages.cpp | 1 + src/vcpkg/build.cpp | 6 ++++-- src/vcpkg/commands.porthistory.cpp | 2 +- src/vcpkg/registries.cpp | 2 +- src/vcpkg/vcpkgpaths.cpp | 2 +- 8 files changed, 15 insertions(+), 5 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index c3669009e9..e7cef1df60 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -1211,4 +1211,8 @@ namespace vcpkg "Unable to determine toolchain use for {triplet} with with CMAKE_SYSTEM_NAME {system_name}. Did " "you mean to use " "VCPKG_CHAINLOAD_TOOLCHAIN_FILE?"); + DECLARE_MESSAGE(FailedToFindDependencyAbi, + (msg::spec, msg::spec), + "", + "Failed to find dependency abi for {spec} -> {spec}"); } diff --git a/locales/messages.en.json b/locales/messages.en.json index 84692b5439..1144646284 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -108,6 +108,7 @@ "ExpectedPortName": "expected a port name here", "ExpectedTripletName": "expected a triplet name here", "ExtendedDocumentationAtUrl": "Extended documentation available at '{url}'.", + "FailedToFindDependencyAbi": "Failed to find dependency abi for {spec} -> {spec}", "FailedToProvisionCe": "Failed to provision vcpkg-ce.", "FailedToRunToolToDetermineVersion": "Failed to run {path} to determine the {tool_name} version.", "FailedToStoreBackToMirror": "failed to store back to mirror:", diff --git a/locales/messages.json b/locales/messages.json index 88608f745d..6792482145 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -193,6 +193,8 @@ "ExpectedTripletName": "expected a triplet name here", "ExtendedDocumentationAtUrl": "Extended documentation available at '{url}'.", "_ExtendedDocumentationAtUrl.comment": "An example of {url} is https://github.com/microsoft/vcpkg.", + "FailedToFindDependencyAbi": "Failed to find dependency abi for {spec} -> {spec}", + "_FailedToFindDependencyAbi.comment": "An example of {spec} is zlib:x64-windows. An example of {spec} is zlib:x64-windows.", "FailedToProvisionCe": "Failed to provision vcpkg-ce.", "FailedToRunToolToDetermineVersion": "Failed to run {path} to determine the {tool_name} version.", "_FailedToRunToolToDetermineVersion.comment": "Additional information, such as the command line output, if any, will be appended on the line after this message An example of {tool_name} is aria2. An example of {path} is /foo/bar.", diff --git a/src/vcpkg/base/messages.cpp b/src/vcpkg/base/messages.cpp index 56c793fb8e..cd24f9e3da 100644 --- a/src/vcpkg/base/messages.cpp +++ b/src/vcpkg/base/messages.cpp @@ -644,4 +644,5 @@ namespace vcpkg REGISTER_MESSAGE(WarningsTreatedAsErrors); REGISTER_MESSAGE(ErrorWhileWriting); REGISTER_MESSAGE(UndeterminedToolChainForTriplet); + REGISTER_MESSAGE(FailedToFindDependencyAbi); } diff --git a/src/vcpkg/build.cpp b/src/vcpkg/build.cpp index 6cecf40d5b..38311b0d93 100644 --- a/src/vcpkg/build.cpp +++ b/src/vcpkg/build.cpp @@ -1226,8 +1226,10 @@ namespace vcpkg auto status_it = status_db.find(pspec); if (status_it == status_db.end()) { - Checks::exit_maybe_upgrade( - VCPKG_LINE_INFO, "Failed to find dependency abi for %s -> %s", action.spec, pspec); + Checks::msg_exit_maybe_upgrade(VCPKG_LINE_INFO, + msgFailedToFindDependencyAbi, + msg::spec = action.spec, + msg::spec = pspec); } dependency_abis.emplace_back(AbiEntry{pspec.name(), status_it->get()->package.abi}); diff --git a/src/vcpkg/commands.porthistory.cpp b/src/vcpkg/commands.porthistory.cpp index f74282d498..3ab8b359cd 100644 --- a/src/vcpkg/commands.porthistory.cpp +++ b/src/vcpkg/commands.porthistory.cpp @@ -112,7 +112,7 @@ namespace vcpkg::Commands::PortHistory if (auto output = maybe_output.get()) { auto commits = Util::fmap( - Strings::split(*output, '\n'), [](const std::string& line) -> auto{ + Strings::split(*output, '\n'), [](const std::string& line) -> auto { auto parts = Strings::split(line, ' '); return std::make_pair(parts[0], parts[1]); }); diff --git a/src/vcpkg/registries.cpp b/src/vcpkg/registries.cpp index f1388a0f2e..ab90bcd77a 100644 --- a/src/vcpkg/registries.cpp +++ b/src/vcpkg/registries.cpp @@ -1186,7 +1186,7 @@ namespace vcpkg if (auto pversions = maybe_versions.get()) { return Util::fmap( - *pversions, [](auto&& entry) -> auto{ + *pversions, [](auto&& entry) -> auto { return std::make_pair(SchemedVersion{entry.scheme, entry.version}, entry.git_tree); }); } diff --git a/src/vcpkg/vcpkgpaths.cpp b/src/vcpkg/vcpkgpaths.cpp index bd5188a71e..c9dca0690b 100644 --- a/src/vcpkg/vcpkgpaths.cpp +++ b/src/vcpkg/vcpkgpaths.cpp @@ -877,7 +877,7 @@ namespace vcpkg const Path VcpkgPaths::get_triplet_file_path(Triplet triplet) const { return m_pimpl->m_triplets_cache.get_lazy( - triplet, [&]() -> auto{ + triplet, [&]() -> auto { for (const auto& triplet_dir : m_pimpl->triplets_dirs) { auto path = triplet_dir / (triplet.canonical_name() + ".cmake"); From f84aec4d98fa412a8c2406eef67a8e98a8df526e Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Fri, 15 Jul 2022 12:31:54 -0700 Subject: [PATCH 20/61] InvalidCrtILinkage --- include/vcpkg/base/messages.h | 4 ++++ locales/messages.en.json | 1 + locales/messages.json | 2 ++ src/vcpkg/base/messages.cpp | 1 + src/vcpkg/build.cpp | 3 ++- 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index e7cef1df60..958795b3ca 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -1215,4 +1215,8 @@ namespace vcpkg (msg::spec, msg::spec), "", "Failed to find dependency abi for {spec} -> {spec}"); + DECLARE_MESSAGE(InvalidCrtLinkage, + (msg::value), + "'{value}' is the crt linkage type.", + "Invalid crt linkage type: [{value}]"); } diff --git a/locales/messages.en.json b/locales/messages.en.json index 1144646284..89187c7c76 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -152,6 +152,7 @@ "InvalidArgumentRequiresSourceArgument": "invalid argument: binary config '{binary_source}' requires at least one source argument", "InvalidArgumentRequiresTwoOrThreeArguments": "invalid argument: binary config '{binary_source}' requires 2 or 3 arguments", "InvalidArgumentRequiresValidToken": "invalid argument: binary config '{binary_source}' requires a SAS token without a preceeding '?' as the second argument", + "InvalidCrtLinkage": "Invalid crt linkage type: [{value}]", "InvalidFormatString": "invalid format string: {actual}", "JsonErrorFailedToParse": "failed to parse {path}:", "JsonErrorFailedToRead": "failed to read {path}: {error_msg}", diff --git a/locales/messages.json b/locales/messages.json index 6792482145..8ec1c11cc9 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -268,6 +268,8 @@ "_InvalidArgumentRequiresTwoOrThreeArguments.comment": "An example of {binary_source} is azblob.", "InvalidArgumentRequiresValidToken": "invalid argument: binary config '{binary_source}' requires a SAS token without a preceeding '?' as the second argument", "_InvalidArgumentRequiresValidToken.comment": "An example of {binary_source} is azblob.", + "InvalidCrtLinkage": "Invalid crt linkage type: [{value}]", + "_InvalidCrtLinkage.comment": "'{value}' is the crt linkage type.", "InvalidFormatString": "invalid format string: {actual}", "_InvalidFormatString.comment": "{actual} is the provided format string", "JsonErrorFailedToParse": "failed to parse {path}:", diff --git a/src/vcpkg/base/messages.cpp b/src/vcpkg/base/messages.cpp index cd24f9e3da..be527e2f84 100644 --- a/src/vcpkg/base/messages.cpp +++ b/src/vcpkg/base/messages.cpp @@ -645,4 +645,5 @@ namespace vcpkg REGISTER_MESSAGE(ErrorWhileWriting); REGISTER_MESSAGE(UndeterminedToolChainForTriplet); REGISTER_MESSAGE(FailedToFindDependencyAbi); + REGISTER_MESSAGE(InvalidCrtLinkage); } diff --git a/src/vcpkg/build.cpp b/src/vcpkg/build.cpp index 38311b0d93..076f00c4f6 100644 --- a/src/vcpkg/build.cpp +++ b/src/vcpkg/build.cpp @@ -1543,7 +1543,8 @@ namespace vcpkg } else { - Checks::exit_with_message(VCPKG_LINE_INFO, "Invalid crt linkage type: [%s]", crt_linkage_as_string); + Checks::msg_exit_with_message( + VCPKG_LINE_INFO, msgInvalidCrtLinkage, msg::value = crt_linkage_as_string); } } From ae5e896c36f169558cc8291bb1ae617de9bba8c7 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Fri, 15 Jul 2022 12:36:11 -0700 Subject: [PATCH 21/61] Rename: InvalidCrtLinkage -> InvalidLinkage Parameterize InvalidLinkage to take a system_name to enable re-usability. --- include/vcpkg/base/messages.h | 8 ++++---- locales/messages.en.json | 2 +- locales/messages.json | 4 ++-- src/vcpkg/base/messages.cpp | 2 +- src/vcpkg/build.cpp | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index 958795b3ca..6b18533f74 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -1215,8 +1215,8 @@ namespace vcpkg (msg::spec, msg::spec), "", "Failed to find dependency abi for {spec} -> {spec}"); - DECLARE_MESSAGE(InvalidCrtLinkage, - (msg::value), - "'{value}' is the crt linkage type.", - "Invalid crt linkage type: [{value}]"); + DECLARE_MESSAGE(InvalidLinkage, + (msg::system_name, msg::value), + "'{value}' is the linkage type.", + "Invalid {system_name} linkage type: [{value}]"); } diff --git a/locales/messages.en.json b/locales/messages.en.json index 89187c7c76..5ed896b069 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -152,8 +152,8 @@ "InvalidArgumentRequiresSourceArgument": "invalid argument: binary config '{binary_source}' requires at least one source argument", "InvalidArgumentRequiresTwoOrThreeArguments": "invalid argument: binary config '{binary_source}' requires 2 or 3 arguments", "InvalidArgumentRequiresValidToken": "invalid argument: binary config '{binary_source}' requires a SAS token without a preceeding '?' as the second argument", - "InvalidCrtLinkage": "Invalid crt linkage type: [{value}]", "InvalidFormatString": "invalid format string: {actual}", + "InvalidLinkage": "Invalid {system_name} linkage type: [{value}]", "JsonErrorFailedToParse": "failed to parse {path}:", "JsonErrorFailedToRead": "failed to read {path}: {error_msg}", "JsonErrorMustBeAnObject": "Expected {path} to be an object.", diff --git a/locales/messages.json b/locales/messages.json index 8ec1c11cc9..53c6f0547b 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -268,10 +268,10 @@ "_InvalidArgumentRequiresTwoOrThreeArguments.comment": "An example of {binary_source} is azblob.", "InvalidArgumentRequiresValidToken": "invalid argument: binary config '{binary_source}' requires a SAS token without a preceeding '?' as the second argument", "_InvalidArgumentRequiresValidToken.comment": "An example of {binary_source} is azblob.", - "InvalidCrtLinkage": "Invalid crt linkage type: [{value}]", - "_InvalidCrtLinkage.comment": "'{value}' is the crt linkage type.", "InvalidFormatString": "invalid format string: {actual}", "_InvalidFormatString.comment": "{actual} is the provided format string", + "InvalidLinkage": "Invalid {system_name} linkage type: [{value}]", + "_InvalidLinkage.comment": "'{value}' is the linkage type. An example of {system_name} is Darwin.", "JsonErrorFailedToParse": "failed to parse {path}:", "_JsonErrorFailedToParse.comment": "An example of {path} is /foo/bar.", "JsonErrorFailedToRead": "failed to read {path}: {error_msg}", diff --git a/src/vcpkg/base/messages.cpp b/src/vcpkg/base/messages.cpp index be527e2f84..b04c42bbe4 100644 --- a/src/vcpkg/base/messages.cpp +++ b/src/vcpkg/base/messages.cpp @@ -645,5 +645,5 @@ namespace vcpkg REGISTER_MESSAGE(ErrorWhileWriting); REGISTER_MESSAGE(UndeterminedToolChainForTriplet); REGISTER_MESSAGE(FailedToFindDependencyAbi); - REGISTER_MESSAGE(InvalidCrtLinkage); + REGISTER_MESSAGE(InvalidLinkage); } diff --git a/src/vcpkg/build.cpp b/src/vcpkg/build.cpp index 076f00c4f6..d5b0ede1fa 100644 --- a/src/vcpkg/build.cpp +++ b/src/vcpkg/build.cpp @@ -1544,7 +1544,7 @@ namespace vcpkg else { Checks::msg_exit_with_message( - VCPKG_LINE_INFO, msgInvalidCrtLinkage, msg::value = crt_linkage_as_string); + VCPKG_LINE_INFO, msgInvalidLinkage, msg::system_name = "crt", msg::value = crt_linkage_as_string); } } From 805920b10e97e987134d1928c925ddc7a22c80a6 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Fri, 15 Jul 2022 12:43:02 -0700 Subject: [PATCH 22/61] InvalidLinkage re-use --- src/vcpkg/build.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/vcpkg/build.cpp b/src/vcpkg/build.cpp index d5b0ede1fa..265f3cc92d 100644 --- a/src/vcpkg/build.cpp +++ b/src/vcpkg/build.cpp @@ -1558,8 +1558,10 @@ namespace vcpkg } else { - Checks::exit_with_message( - VCPKG_LINE_INFO, "Invalid library linkage type: [%s]", library_linkage_as_string); + Checks::msg_exit_with_message(VCPKG_LINE_INFO, + msgInvalidLinkage, + msg::system_name = "library", + msg::value = library_linkage_as_string); } } From da5170ace45e2b9957a207c52869d1bd571c6eba Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Fri, 15 Jul 2022 12:48:03 -0700 Subject: [PATCH 23/61] UnknownPolicySetting --- include/vcpkg/base/messages.h | 4 ++++ locales/messages.en.json | 1 + locales/messages.json | 2 ++ src/vcpkg/base/messages.cpp | 1 + src/vcpkg/build.cpp | 4 ++-- 5 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index 6b18533f74..a8bc2f7de8 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -1219,4 +1219,8 @@ namespace vcpkg (msg::system_name, msg::value), "'{value}' is the linkage type.", "Invalid {system_name} linkage type: [{value}]"); + DECLARE_MESSAGE(UnknownPolicySetting, + (msg::option, msg::value), + "'{value}' is the policy.", + "Unknown setting for policy '{value}': {option}"); } diff --git a/locales/messages.en.json b/locales/messages.en.json index 5ed896b069..0906164037 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -213,6 +213,7 @@ "UnexpectedToolOutput": "{tool_name} ({path}) produced unexpected output when attempting to determine the version:", "UnknownBaselineFileContent": "unrecognizable baseline entry; expected 'port:triplet=(fail|skip|pass)'", "UnknownBinaryProviderType": "unknown binary provider type: valid providers are 'clear', 'default', 'nuget', 'nugetconfig','nugettimeout', 'interactive', 'x-azblob', 'x-gcs', 'x-aws', 'x-aws-config', 'http', and 'files'", + "UnknownPolicySetting": "Unknown setting for policy '{value}': {option}", "UnknownTool": "vcpkg does not have a definition of this tool for this platform.", "UnknownVariablesInTemplate": "invalid argument: url template '{value}' contains unknown variables: {list}", "UnsupportedSystemName": "Could not map VCPKG_CMAKE_SYSTEM_NAME '{system_name}' to a vcvarsall platform. Supported system names are '', 'Windows' and 'WindowsStore'.", diff --git a/locales/messages.json b/locales/messages.json index 53c6f0547b..e115d94988 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -371,6 +371,8 @@ "_UnexpectedToolOutput.comment": "The actual command line output will be appended after this message. An example of {tool_name} is aria2. An example of {path} is /foo/bar.", "UnknownBaselineFileContent": "unrecognizable baseline entry; expected 'port:triplet=(fail|skip|pass)'", "UnknownBinaryProviderType": "unknown binary provider type: valid providers are 'clear', 'default', 'nuget', 'nugetconfig','nugettimeout', 'interactive', 'x-azblob', 'x-gcs', 'x-aws', 'x-aws-config', 'http', and 'files'", + "UnknownPolicySetting": "Unknown setting for policy '{value}': {option}", + "_UnknownPolicySetting.comment": "'{value}' is the policy. An example of {option} is editable.", "UnknownTool": "vcpkg does not have a definition of this tool for this platform.", "UnknownVariablesInTemplate": "invalid argument: url template '{value}' contains unknown variables: {list}", "_UnknownVariablesInTemplate.comment": "{value} is the value provided by the user and {list} a list of unknown variables seperated by comma", diff --git a/src/vcpkg/base/messages.cpp b/src/vcpkg/base/messages.cpp index b04c42bbe4..ffa712a0bc 100644 --- a/src/vcpkg/base/messages.cpp +++ b/src/vcpkg/base/messages.cpp @@ -646,4 +646,5 @@ namespace vcpkg REGISTER_MESSAGE(UndeterminedToolChainForTriplet); REGISTER_MESSAGE(FailedToFindDependencyAbi); REGISTER_MESSAGE(InvalidLinkage); + REGISTER_MESSAGE(UnknownPolicySetting); } diff --git a/src/vcpkg/build.cpp b/src/vcpkg/build.cpp index 265f3cc92d..9aac660da3 100644 --- a/src/vcpkg/build.cpp +++ b/src/vcpkg/build.cpp @@ -1578,8 +1578,8 @@ namespace vcpkg else if (setting == "disabled") policies.emplace(policy, false); else - Checks::exit_maybe_upgrade( - VCPKG_LINE_INFO, "Unknown setting for policy '%s': %s", to_string(policy), setting); + Checks::msg_exit_maybe_upgrade( + VCPKG_LINE_INFO, msgUnknownPolicySetting, msg::option = setting, msg::value = to_string(policy)); } if (const auto err = parser.error_info("PostBuildInformation")) From 6bcc2628f3d07f5bd8cb7c870668e593a63dddad Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Fri, 15 Jul 2022 12:52:57 -0700 Subject: [PATCH 24/61] InvalidBuildInfo --- include/vcpkg/base/messages.h | 1 + locales/messages.en.json | 1 + locales/messages.json | 2 ++ src/vcpkg/base/messages.cpp | 1 + src/vcpkg/build.cpp | 2 +- 5 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index a8bc2f7de8..2a3328e9cc 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -1223,4 +1223,5 @@ namespace vcpkg (msg::option, msg::value), "'{value}' is the policy.", "Unknown setting for policy '{value}': {option}"); + DECLARE_MESSAGE(InvalidBuildInfo, (msg::error_msg), "", "Invalid BUILD_INFO file for package: {error_msg}"); } diff --git a/locales/messages.en.json b/locales/messages.en.json index 0906164037..6bcfb50489 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -152,6 +152,7 @@ "InvalidArgumentRequiresSourceArgument": "invalid argument: binary config '{binary_source}' requires at least one source argument", "InvalidArgumentRequiresTwoOrThreeArguments": "invalid argument: binary config '{binary_source}' requires 2 or 3 arguments", "InvalidArgumentRequiresValidToken": "invalid argument: binary config '{binary_source}' requires a SAS token without a preceeding '?' as the second argument", + "InvalidBuildInfo": "Invalid BUILD_INFO file for package: {error_msg}", "InvalidFormatString": "invalid format string: {actual}", "InvalidLinkage": "Invalid {system_name} linkage type: [{value}]", "JsonErrorFailedToParse": "failed to parse {path}:", diff --git a/locales/messages.json b/locales/messages.json index e115d94988..8a7c8bb59c 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -268,6 +268,8 @@ "_InvalidArgumentRequiresTwoOrThreeArguments.comment": "An example of {binary_source} is azblob.", "InvalidArgumentRequiresValidToken": "invalid argument: binary config '{binary_source}' requires a SAS token without a preceeding '?' as the second argument", "_InvalidArgumentRequiresValidToken.comment": "An example of {binary_source} is azblob.", + "InvalidBuildInfo": "Invalid BUILD_INFO file for package: {error_msg}", + "_InvalidBuildInfo.comment": "An example of {error_msg} is File Not Found.", "InvalidFormatString": "invalid format string: {actual}", "_InvalidFormatString.comment": "{actual} is the provided format string", "InvalidLinkage": "Invalid {system_name} linkage type: [{value}]", diff --git a/src/vcpkg/base/messages.cpp b/src/vcpkg/base/messages.cpp index ffa712a0bc..c7024b23c1 100644 --- a/src/vcpkg/base/messages.cpp +++ b/src/vcpkg/base/messages.cpp @@ -647,4 +647,5 @@ namespace vcpkg REGISTER_MESSAGE(FailedToFindDependencyAbi); REGISTER_MESSAGE(InvalidLinkage); REGISTER_MESSAGE(UnknownPolicySetting); + REGISTER_MESSAGE(InvalidBuildInfo); } diff --git a/src/vcpkg/build.cpp b/src/vcpkg/build.cpp index 9aac660da3..c87525fd7a 100644 --- a/src/vcpkg/build.cpp +++ b/src/vcpkg/build.cpp @@ -1598,7 +1598,7 @@ namespace vcpkg const ExpectedS pghs = Paragraphs::get_single_paragraph(fs, filepath); if (!pghs) { - Checks::exit_maybe_upgrade(VCPKG_LINE_INFO, "Invalid BUILD_INFO file for package: %s", pghs.error()); + Checks::msg_exit_maybe_upgrade(VCPKG_LINE_INFO, msgInvalidBuildInfo, msg::error_msg = pghs.error()); } return inner_create_buildinfo(*pghs.get()); From f130f2d532f1e3fb6fbc191e72e7607df1102969 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Fri, 15 Jul 2022 13:01:06 -0700 Subject: [PATCH 25/61] UnknownSettingForBuildType --- include/vcpkg/base/messages.h | 4 ++++ locales/messages.en.json | 1 + locales/messages.json | 2 ++ src/vcpkg/base/messages.cpp | 1 + src/vcpkg/build.cpp | 6 ++---- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index 2a3328e9cc..ee34c9afdb 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -1224,4 +1224,8 @@ namespace vcpkg "'{value}' is the policy.", "Unknown setting for policy '{value}': {option}"); DECLARE_MESSAGE(InvalidBuildInfo, (msg::error_msg), "", "Invalid BUILD_INFO file for package: {error_msg}"); + DECLARE_MESSAGE(UnknownSettingForBuildType, + (msg::option), + "", + "Unknown setting for VCPKG_BUILD_TYPE {option}. Valid settings are '', 'debug', and 'release'."); } diff --git a/locales/messages.en.json b/locales/messages.en.json index 6bcfb50489..f8c43f1ca9 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -215,6 +215,7 @@ "UnknownBaselineFileContent": "unrecognizable baseline entry; expected 'port:triplet=(fail|skip|pass)'", "UnknownBinaryProviderType": "unknown binary provider type: valid providers are 'clear', 'default', 'nuget', 'nugetconfig','nugettimeout', 'interactive', 'x-azblob', 'x-gcs', 'x-aws', 'x-aws-config', 'http', and 'files'", "UnknownPolicySetting": "Unknown setting for policy '{value}': {option}", + "UnknownSettingForBuildType": "Unknown setting for VCPKG_BUILD_TYPE {option}. Valid settings are '', 'debug', and 'release'.", "UnknownTool": "vcpkg does not have a definition of this tool for this platform.", "UnknownVariablesInTemplate": "invalid argument: url template '{value}' contains unknown variables: {list}", "UnsupportedSystemName": "Could not map VCPKG_CMAKE_SYSTEM_NAME '{system_name}' to a vcvarsall platform. Supported system names are '', 'Windows' and 'WindowsStore'.", diff --git a/locales/messages.json b/locales/messages.json index 8a7c8bb59c..9783043506 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -375,6 +375,8 @@ "UnknownBinaryProviderType": "unknown binary provider type: valid providers are 'clear', 'default', 'nuget', 'nugetconfig','nugettimeout', 'interactive', 'x-azblob', 'x-gcs', 'x-aws', 'x-aws-config', 'http', and 'files'", "UnknownPolicySetting": "Unknown setting for policy '{value}': {option}", "_UnknownPolicySetting.comment": "'{value}' is the policy. An example of {option} is editable.", + "UnknownSettingForBuildType": "Unknown setting for VCPKG_BUILD_TYPE {option}. Valid settings are '', 'debug', and 'release'.", + "_UnknownSettingForBuildType.comment": "An example of {option} is editable.", "UnknownTool": "vcpkg does not have a definition of this tool for this platform.", "UnknownVariablesInTemplate": "invalid argument: url template '{value}' contains unknown variables: {list}", "_UnknownVariablesInTemplate.comment": "{value} is the value provided by the user and {list} a list of unknown variables seperated by comma", diff --git a/src/vcpkg/base/messages.cpp b/src/vcpkg/base/messages.cpp index c7024b23c1..a0b7315f3f 100644 --- a/src/vcpkg/base/messages.cpp +++ b/src/vcpkg/base/messages.cpp @@ -648,4 +648,5 @@ namespace vcpkg REGISTER_MESSAGE(InvalidLinkage); REGISTER_MESSAGE(UnknownPolicySetting); REGISTER_MESSAGE(InvalidBuildInfo); + REGISTER_MESSAGE(UnknownSettingForBuildType); } diff --git a/src/vcpkg/build.cpp b/src/vcpkg/build.cpp index c87525fd7a..702694a44f 100644 --- a/src/vcpkg/build.cpp +++ b/src/vcpkg/build.cpp @@ -1705,10 +1705,8 @@ namespace vcpkg else if (Strings::case_insensitive_ascii_equals(variable_value, "release")) build_type = ConfigurationType::RELEASE; else - Checks::exit_with_message( - VCPKG_LINE_INFO, - "Unknown setting for VCPKG_BUILD_TYPE: %s. Valid settings are '', 'debug' and 'release'.", - variable_value); + Checks::msg_exit_with_message( + VCPKG_LINE_INFO, msgUnknownSettingForBuildType, msg::option = variable_value); break; case VcpkgTripletVar::ENV_PASSTHROUGH: passthrough_env_vars_tracked = Strings::split(variable_value, ';'); From b578ecc2b73523a3d62ebec3026ca937f10fc792 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Fri, 15 Jul 2022 13:03:42 -0700 Subject: [PATCH 26/61] Sort --- include/vcpkg/base/messages.h | 48 +++++++++++++++++------------------ src/vcpkg/base/messages.cpp | 14 +++++----- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index ee34c9afdb..b971c933fa 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -741,6 +741,7 @@ namespace vcpkg "", "Visual Studio Code was not found and the environment variable {env_var} is not set or invalid."); DECLARE_MESSAGE(ErrorVsCodeNotFoundPathExamined, (), "", "The following paths were examined:"); + DECLARE_MESSAGE(ErrorWhileWriting, (msg::error_msg), "", "Error occured while writing {error_msg}"); DECLARE_MESSAGE(ExcludedPackage, (msg::spec), "", "Excluded {spec}"); DECLARE_MESSAGE( ExpectedCharacterHere, @@ -751,6 +752,10 @@ namespace vcpkg DECLARE_MESSAGE(ExpectedPortName, (), "", "expected a port name here"); DECLARE_MESSAGE(ExpectedTripletName, (), "", "expected a triplet name here"); DECLARE_MESSAGE(ExtendedDocumentationAtUrl, (msg::url), "", "Extended documentation available at '{url}'."); + DECLARE_MESSAGE(FailedToFindDependencyAbi, + (msg::spec, msg::spec), + "", + "Failed to find dependency abi for {spec} -> {spec}"); DECLARE_MESSAGE(FailedToProvisionCe, (), "", "Failed to provision vcpkg-ce."); DECLARE_MESSAGE(FailedToRunToolToDetermineVersion, (msg::tool_name, msg::path), @@ -885,10 +890,15 @@ namespace vcpkg "", "invalid argument: binary config '{binary_source}' requires a SAS token without a " "preceeding '?' as the second argument"); + DECLARE_MESSAGE(InvalidBuildInfo, (msg::error_msg), "", "Invalid BUILD_INFO file for package: {error_msg}"); DECLARE_MESSAGE(InvalidFormatString, (msg::actual), "{actual} is the provided format string", "invalid format string: {actual}"); + DECLARE_MESSAGE(InvalidLinkage, + (msg::system_name, msg::value), + "'{value}' is the linkage type.", + "Invalid {system_name} linkage type: [{value}]"); DECLARE_MESSAGE(JsonErrorFailedToParse, (msg::path), "", "failed to parse {path}:"); DECLARE_MESSAGE(JsonErrorFailedToRead, (msg::path, msg::error_msg), "", "failed to read {path}: {error_msg}"); DECLARE_MESSAGE(JsonErrorMustBeAnObject, (msg::path), "", "Expected {path} to be an object."); @@ -1066,6 +1076,12 @@ namespace vcpkg "calling {system_api} failed with {exit_code} ({error_msg})"); DECLARE_MESSAGE(ToolFetchFailed, (msg::tool_name), "", "Could not fetch {tool_name}."); DECLARE_MESSAGE(ToolInWin10, (), "", "This utility is bundled with Windows 10 or later."); + DECLARE_MESSAGE(UndeterminedToolChainForTriplet, + (msg::triplet, msg::system_name), + "", + "Unable to determine toolchain use for {triplet} with with CMAKE_SYSTEM_NAME {system_name}. Did " + "you mean to use " + "VCPKG_CHAINLOAD_TOOLCHAIN_FILE?"); DECLARE_MESSAGE(UnexpectedErrorDuringBulkDownload, (), "", "an unexpected error occurred during bulk download."); DECLARE_MESSAGE(UnexpectedToolOutput, (msg::tool_name, msg::path), @@ -1081,6 +1097,14 @@ namespace vcpkg "unknown binary provider type: valid providers are 'clear', 'default', 'nuget', " "'nugetconfig','nugettimeout', 'interactive', 'x-azblob', 'x-gcs', 'x-aws', " "'x-aws-config', 'http', and 'files'"); + DECLARE_MESSAGE(UnknownPolicySetting, + (msg::option, msg::value), + "'{value}' is the policy.", + "Unknown setting for policy '{value}': {option}"); + DECLARE_MESSAGE(UnknownSettingForBuildType, + (msg::option), + "", + "Unknown setting for VCPKG_BUILD_TYPE {option}. Valid settings are '', 'debug', and 'release'."); DECLARE_MESSAGE(UnknownTool, (), "", "vcpkg does not have a definition of this tool for this platform."); DECLARE_MESSAGE( UnknownVariablesInTemplate, @@ -1204,28 +1228,4 @@ namespace vcpkg "The message named {value} starts with warning:, it must be changed to prepend " "WarningMessage in code instead."); DECLARE_MESSAGE(WarningsTreatedAsErrors, (), "", "previous warnings being interpreted as errors"); - DECLARE_MESSAGE(ErrorWhileWriting, (msg::error_msg), "", "Error occured while writing {error_msg}"); - DECLARE_MESSAGE(UndeterminedToolChainForTriplet, - (msg::triplet, msg::system_name), - "", - "Unable to determine toolchain use for {triplet} with with CMAKE_SYSTEM_NAME {system_name}. Did " - "you mean to use " - "VCPKG_CHAINLOAD_TOOLCHAIN_FILE?"); - DECLARE_MESSAGE(FailedToFindDependencyAbi, - (msg::spec, msg::spec), - "", - "Failed to find dependency abi for {spec} -> {spec}"); - DECLARE_MESSAGE(InvalidLinkage, - (msg::system_name, msg::value), - "'{value}' is the linkage type.", - "Invalid {system_name} linkage type: [{value}]"); - DECLARE_MESSAGE(UnknownPolicySetting, - (msg::option, msg::value), - "'{value}' is the policy.", - "Unknown setting for policy '{value}': {option}"); - DECLARE_MESSAGE(InvalidBuildInfo, (msg::error_msg), "", "Invalid BUILD_INFO file for package: {error_msg}"); - DECLARE_MESSAGE(UnknownSettingForBuildType, - (msg::option), - "", - "Unknown setting for VCPKG_BUILD_TYPE {option}. Valid settings are '', 'debug', and 'release'."); } diff --git a/src/vcpkg/base/messages.cpp b/src/vcpkg/base/messages.cpp index a0b7315f3f..923090f734 100644 --- a/src/vcpkg/base/messages.cpp +++ b/src/vcpkg/base/messages.cpp @@ -504,12 +504,14 @@ namespace vcpkg REGISTER_MESSAGE(ErrorVcvarsUnsupported); REGISTER_MESSAGE(ErrorVsCodeNotFound); REGISTER_MESSAGE(ErrorVsCodeNotFoundPathExamined); + REGISTER_MESSAGE(ErrorWhileWriting); REGISTER_MESSAGE(ExcludedPackage); REGISTER_MESSAGE(ExpectedCharacterHere); REGISTER_MESSAGE(ExpectedFailOrSkip); REGISTER_MESSAGE(ExpectedPortName); REGISTER_MESSAGE(ExpectedTripletName); REGISTER_MESSAGE(ExtendedDocumentationAtUrl); + REGISTER_MESSAGE(FailedToFindDependencyAbi); REGISTER_MESSAGE(FailedToProvisionCe); REGISTER_MESSAGE(FailedToRunToolToDetermineVersion); REGISTER_MESSAGE(FailedToStoreBackToMirror); @@ -550,7 +552,9 @@ namespace vcpkg REGISTER_MESSAGE(InvalidArgumentRequiresSourceArgument); REGISTER_MESSAGE(InvalidArgumentRequiresTwoOrThreeArguments); REGISTER_MESSAGE(InvalidArgumentRequiresValidToken); + REGISTER_MESSAGE(InvalidBuildInfo); REGISTER_MESSAGE(InvalidFormatString); + REGISTER_MESSAGE(InvalidLinkage); REGISTER_MESSAGE(JsonErrorFailedToParse); REGISTER_MESSAGE(JsonErrorFailedToRead); REGISTER_MESSAGE(JsonErrorMustBeAnObject); @@ -602,10 +606,13 @@ namespace vcpkg REGISTER_MESSAGE(SystemApiErrorMessage); REGISTER_MESSAGE(ToolFetchFailed); REGISTER_MESSAGE(ToolInWin10); + REGISTER_MESSAGE(UndeterminedToolChainForTriplet); REGISTER_MESSAGE(UnexpectedErrorDuringBulkDownload); REGISTER_MESSAGE(UnexpectedToolOutput); REGISTER_MESSAGE(UnknownBaselineFileContent); REGISTER_MESSAGE(UnknownBinaryProviderType); + REGISTER_MESSAGE(UnknownPolicySetting); + REGISTER_MESSAGE(UnknownSettingForBuildType); REGISTER_MESSAGE(UnknownTool); REGISTER_MESSAGE(UnknownVariablesInTemplate); REGISTER_MESSAGE(UnsupportedSystemName); @@ -642,11 +649,4 @@ namespace vcpkg REGISTER_MESSAGE(WaitingToTakeFilesystemLock); REGISTER_MESSAGE(WarningMessageMustUsePrintWarning); REGISTER_MESSAGE(WarningsTreatedAsErrors); - REGISTER_MESSAGE(ErrorWhileWriting); - REGISTER_MESSAGE(UndeterminedToolChainForTriplet); - REGISTER_MESSAGE(FailedToFindDependencyAbi); - REGISTER_MESSAGE(InvalidLinkage); - REGISTER_MESSAGE(UnknownPolicySetting); - REGISTER_MESSAGE(InvalidBuildInfo); - REGISTER_MESSAGE(UnknownSettingForBuildType); } From 0f639b3881a00d608030623b8da2514b98124ec2 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Fri, 15 Jul 2022 14:59:59 -0700 Subject: [PATCH 27/61] Update: FailedToFindDependencyAbi Issue: re-use replacement variables --- include/vcpkg/base/messages.h | 6 +++--- locales/messages.en.json | 2 +- locales/messages.json | 4 ++-- src/vcpkg/build.cpp | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index b971c933fa..e2a45379f2 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -753,9 +753,9 @@ namespace vcpkg DECLARE_MESSAGE(ExpectedTripletName, (), "", "expected a triplet name here"); DECLARE_MESSAGE(ExtendedDocumentationAtUrl, (msg::url), "", "Extended documentation available at '{url}'."); DECLARE_MESSAGE(FailedToFindDependencyAbi, - (msg::spec, msg::spec), - "", - "Failed to find dependency abi for {spec} -> {spec}"); + (msg::old_value, msg::new_value), + "{old_value} is the old spec, {new_value} is the new spec.", + "Failed to find dependency abi for {old_value} -> {new_value}"); DECLARE_MESSAGE(FailedToProvisionCe, (), "", "Failed to provision vcpkg-ce."); DECLARE_MESSAGE(FailedToRunToolToDetermineVersion, (msg::tool_name, msg::path), diff --git a/locales/messages.en.json b/locales/messages.en.json index f8c43f1ca9..5432cd26b8 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -108,7 +108,7 @@ "ExpectedPortName": "expected a port name here", "ExpectedTripletName": "expected a triplet name here", "ExtendedDocumentationAtUrl": "Extended documentation available at '{url}'.", - "FailedToFindDependencyAbi": "Failed to find dependency abi for {spec} -> {spec}", + "FailedToFindDependencyAbi": "Failed to find dependency abi for {old_value} -> {new_value}", "FailedToProvisionCe": "Failed to provision vcpkg-ce.", "FailedToRunToolToDetermineVersion": "Failed to run {path} to determine the {tool_name} version.", "FailedToStoreBackToMirror": "failed to store back to mirror:", diff --git a/locales/messages.json b/locales/messages.json index 9783043506..b6bcae0723 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -193,8 +193,8 @@ "ExpectedTripletName": "expected a triplet name here", "ExtendedDocumentationAtUrl": "Extended documentation available at '{url}'.", "_ExtendedDocumentationAtUrl.comment": "An example of {url} is https://github.com/microsoft/vcpkg.", - "FailedToFindDependencyAbi": "Failed to find dependency abi for {spec} -> {spec}", - "_FailedToFindDependencyAbi.comment": "An example of {spec} is zlib:x64-windows. An example of {spec} is zlib:x64-windows.", + "FailedToFindDependencyAbi": "Failed to find dependency abi for {old_value} -> {new_value}", + "_FailedToFindDependencyAbi.comment": "{old_value} is the old spec, {new_value} is the new spec.", "FailedToProvisionCe": "Failed to provision vcpkg-ce.", "FailedToRunToolToDetermineVersion": "Failed to run {path} to determine the {tool_name} version.", "_FailedToRunToolToDetermineVersion.comment": "Additional information, such as the command line output, if any, will be appended on the line after this message An example of {tool_name} is aria2. An example of {path} is /foo/bar.", diff --git a/src/vcpkg/build.cpp b/src/vcpkg/build.cpp index 702694a44f..c0020491da 100644 --- a/src/vcpkg/build.cpp +++ b/src/vcpkg/build.cpp @@ -1228,8 +1228,8 @@ namespace vcpkg { Checks::msg_exit_maybe_upgrade(VCPKG_LINE_INFO, msgFailedToFindDependencyAbi, - msg::spec = action.spec, - msg::spec = pspec); + msg::old_value = action.spec, + msg::new_value = pspec); } dependency_abis.emplace_back(AbiEntry{pspec.name(), status_it->get()->package.abi}); From d8ba3db377c849d5e7529a6576463a4acb96e36d Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Fri, 15 Jul 2022 15:05:28 -0700 Subject: [PATCH 28/61] Update: IncorrectNumberOfArgs Issue: re-use of replacement variables --- include/vcpkg/base/messages.h | 6 +++--- locales/messages.en.json | 2 +- locales/messages.json | 4 ++-- src/vcpkg/commands.porthistory.cpp | 2 +- src/vcpkg/registries.cpp | 2 +- src/vcpkg/vcpkgcmdarguments.cpp | 12 ++++++------ src/vcpkg/vcpkgpaths.cpp | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index 7fc792fce5..2dfb9f77f2 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -870,9 +870,9 @@ namespace vcpkg DECLARE_MESSAGE(IllegalFeatures, (), "", "List of features is not allowed in this context"); DECLARE_MESSAGE(IllegalPlatformSpec, (), "", "Platform qualifier is not allowed in this context"); DECLARE_MESSAGE(IncorrectNumberOfArgs, - (msg::command_name, msg::count, msg::count), - "", - "'{command_name}' requires '{count}' arguments, but '{count}' were provided."); + (msg::command_name, msg::expected, msg::actual), + "'{expected}' is the required number of arguments. '{actual}' is the number of arguments provided.", + "'{command_name}' requires '{expected}' arguments, but '{actual}' were provided."); DECLARE_MESSAGE(InfoSetEnvVar, (msg::env_var), "In this context 'editor' means IDE", diff --git a/locales/messages.en.json b/locales/messages.en.json index 86936bd858..105c2728c6 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -162,7 +162,7 @@ "HelpVersionCommand": "Display version information.", "IllegalFeatures": "List of features is not allowed in this context", "IllegalPlatformSpec": "Platform qualifier is not allowed in this context", - "IncorrectNumberOfArgs": "'{command_name}' requires '{count}' arguments, but '{count}' were provided.", + "IncorrectNumberOfArgs": "'{command_name}' requires '{expected}' arguments, but '{actual}' were provided.", "InfoSetEnvVar": "You can also set the environment variable '{env_var}' to your editor of choice.", "InstallRootDir": "(Experimental) Specify the install root directory.", "InstallWithSystemManager": "You may be able to install this tool via your system package manager.", diff --git a/locales/messages.json b/locales/messages.json index 1ea0d5aa16..ad8b908865 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -267,8 +267,8 @@ "HelpVersionCommand": "Display version information.", "IllegalFeatures": "List of features is not allowed in this context", "IllegalPlatformSpec": "Platform qualifier is not allowed in this context", - "IncorrectNumberOfArgs": "'{command_name}' requires '{count}' arguments, but '{count}' were provided.", - "_IncorrectNumberOfArgs.comment": "An example of {command_name} is install. An example of {count} is 42. An example of {count} is 42.", + "IncorrectNumberOfArgs": "'{command_name}' requires '{expected}' arguments, but '{actual}' were provided.", + "_IncorrectNumberOfArgs.comment": "'{expected}' is the required number of arguments. '{actual}' is the number of arguments provided. An example of {command_name} is install.", "InfoSetEnvVar": "You can also set the environment variable '{env_var}' to your editor of choice.", "_InfoSetEnvVar.comment": "In this context 'editor' means IDE An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", "InstallRootDir": "(Experimental) Specify the install root directory.", diff --git a/src/vcpkg/commands.porthistory.cpp b/src/vcpkg/commands.porthistory.cpp index f74282d498..3ab8b359cd 100644 --- a/src/vcpkg/commands.porthistory.cpp +++ b/src/vcpkg/commands.porthistory.cpp @@ -112,7 +112,7 @@ namespace vcpkg::Commands::PortHistory if (auto output = maybe_output.get()) { auto commits = Util::fmap( - Strings::split(*output, '\n'), [](const std::string& line) -> auto{ + Strings::split(*output, '\n'), [](const std::string& line) -> auto { auto parts = Strings::split(line, ' '); return std::make_pair(parts[0], parts[1]); }); diff --git a/src/vcpkg/registries.cpp b/src/vcpkg/registries.cpp index f1388a0f2e..ab90bcd77a 100644 --- a/src/vcpkg/registries.cpp +++ b/src/vcpkg/registries.cpp @@ -1186,7 +1186,7 @@ namespace vcpkg if (auto pversions = maybe_versions.get()) { return Util::fmap( - *pversions, [](auto&& entry) -> auto{ + *pversions, [](auto&& entry) -> auto { return std::make_pair(SchemedVersion{entry.scheme, entry.version}, entry.git_tree); }); } diff --git a/src/vcpkg/vcpkgcmdarguments.cpp b/src/vcpkg/vcpkgcmdarguments.cpp index f5ba33f4a5..bf19baf4ec 100644 --- a/src/vcpkg/vcpkgcmdarguments.cpp +++ b/src/vcpkg/vcpkgcmdarguments.cpp @@ -398,8 +398,8 @@ namespace vcpkg { msg::println_error(msgIncorrectNumberOfArgs, msg::command_name = this->command, - msg::count = command_structure.minimum_arity, - msg::count = actual_arg_count); + msg::expected = command_structure.minimum_arity, + msg::actual = actual_arg_count); failed = true; } } @@ -409,16 +409,16 @@ namespace vcpkg { msg::println_error(msgIncorrectNumberOfArgs, msg::command_name = this->command, - msg::count = command_structure.minimum_arity, - msg::count = actual_arg_count); + msg::expected = command_structure.minimum_arity, + msg::actual = actual_arg_count); failed = true; } if (actual_arg_count > command_structure.maximum_arity) { msg::println_error(msgIncorrectNumberOfArgs, msg::command_name = this->command, - msg::count = command_structure.minimum_arity, - msg::count = actual_arg_count); + msg::expected = command_structure.minimum_arity, + msg::actual = actual_arg_count); failed = true; } } diff --git a/src/vcpkg/vcpkgpaths.cpp b/src/vcpkg/vcpkgpaths.cpp index bd5188a71e..c9dca0690b 100644 --- a/src/vcpkg/vcpkgpaths.cpp +++ b/src/vcpkg/vcpkgpaths.cpp @@ -877,7 +877,7 @@ namespace vcpkg const Path VcpkgPaths::get_triplet_file_path(Triplet triplet) const { return m_pimpl->m_triplets_cache.get_lazy( - triplet, [&]() -> auto{ + triplet, [&]() -> auto { for (const auto& triplet_dir : m_pimpl->triplets_dirs) { auto path = triplet_dir / (triplet.canonical_name() + ".cmake"); From 9190e0d2d3bcad28d67b422e99cd6177c2b0ca13 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Fri, 15 Jul 2022 15:08:43 -0700 Subject: [PATCH 29/61] Update:SpecifiedFeatureTurnedOff Issue: duplicate replacement variable --- include/vcpkg/base/messages.h | 4 ++-- locales/messages.en.json | 2 +- locales/messages.json | 4 ++-- src/vcpkg/vcpkgcmdarguments.cpp | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index 2dfb9f77f2..2212a7fcdf 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -1131,9 +1131,9 @@ namespace vcpkg "The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json " "file has the name {package_name} and does not match the port directory {path}."); DECLARE_MESSAGE(SpecifiedFeatureTurnedOff, - (msg::command_name, msg::command_name), + (msg::command_name, msg::option), "", - "'{command_name}' feature specifically turned off, but --'{command_name}' was specified."); + "'{command_name}' feature specifically turned off, but --'{option}' was specified."); DECLARE_MESSAGE(SpecifyDirectoriesContaining, (msg::env_var), "", diff --git a/locales/messages.en.json b/locales/messages.en.json index 105c2728c6..3408eebb8c 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -239,7 +239,7 @@ "SeeURL": "See {url} for more information.", "SettingEnvVar": "-- Setting \"{env_var}\" environment variables to \"{url}\".", "SourceFieldPortNameMismatch": "The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json file has the name {package_name} and does not match the port directory {path}.", - "SpecifiedFeatureTurnedOff": "'{command_name}' feature specifically turned off, but --'{command_name}' was specified.", + "SpecifiedFeatureTurnedOff": "'{command_name}' feature specifically turned off, but --'{option}' was specified.", "SpecifyDirectoriesContaining": "Specifiy directories containing triplets files.\n(also: '{env_var}')", "SpecifyDirectoriesWhenSearching": "Specify directories to be used when searching for ports.\n(also: '{env_var}')", "SpecifyHostArch": "Specify the host architecture triplet. See 'vcpkg help triplet'.\n(default: '{env_var}')", diff --git a/locales/messages.json b/locales/messages.json index ad8b908865..7d7b67934c 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -399,8 +399,8 @@ "_SettingEnvVar.comment": "An example of env_var is \"HTTP(S)_PROXY\"'--' at the beginning must be preserved An example of {env_var} is VCPKG_DEFAULT_TRIPLET. An example of {url} is https://github.com/microsoft/vcpkg.", "SourceFieldPortNameMismatch": "The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json file has the name {package_name} and does not match the port directory {path}.", "_SourceFieldPortNameMismatch.comment": "{package_name} and {path} are both names of installable ports/packages. 'Source', 'CONTROL', 'vcpkg.json', and 'name' references are locale-invariant. An example of {package_name} is zlib. An example of {path} is /foo/bar.", - "SpecifiedFeatureTurnedOff": "'{command_name}' feature specifically turned off, but --'{command_name}' was specified.", - "_SpecifiedFeatureTurnedOff.comment": "An example of {command_name} is install. An example of {command_name} is install.", + "SpecifiedFeatureTurnedOff": "'{command_name}' feature specifically turned off, but --'{option}' was specified.", + "_SpecifiedFeatureTurnedOff.comment": "An example of {command_name} is install. An example of {option} is editable.", "SpecifyDirectoriesContaining": "Specifiy directories containing triplets files.\n(also: '{env_var}')", "_SpecifyDirectoriesContaining.comment": "An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", "SpecifyDirectoriesWhenSearching": "Specify directories to be used when searching for ports.\n(also: '{env_var}')", diff --git a/src/vcpkg/vcpkgcmdarguments.cpp b/src/vcpkg/vcpkgcmdarguments.cpp index bf19baf4ec..5ee929064b 100644 --- a/src/vcpkg/vcpkgcmdarguments.cpp +++ b/src/vcpkg/vcpkgcmdarguments.cpp @@ -828,7 +828,7 @@ namespace vcpkg if (el.is_inconsistent) { msg::println_warning( - msgSpecifiedFeatureTurnedOff, msg::command_name = el.flag, msg::command_name = el.option); + msgSpecifiedFeatureTurnedOff, msg::command_name = el.flag, msg::option = el.option); msg::println_warning(msgDefaultFlag, msg::command_name = el.flag); LockGuardPtr(g_metrics)->track_property( "warning", Strings::format("warning %s alongside %s", el.flag, el.option)); From 9fc46552efb85f47c438f65942597834e81b0e32 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Fri, 15 Jul 2022 15:11:18 -0700 Subject: [PATCH 30/61] Edit: ConflictingValuesForOption PR response: vicroms --- include/vcpkg/base/messages.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index 2212a7fcdf..01dca026cc 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -651,7 +651,7 @@ namespace vcpkg DECLARE_MESSAGE(ConflictingValuesForOption, (msg::value), "'{value}' is a command option.", - "conflicting values specified for --'{value}'."); + "conflicting values specified for '--{value}'."); DECLARE_MESSAGE(CompressFolderFailed, (msg::path), "", "Failed to compress folder \"{path}\":"); DECLARE_MESSAGE(CouldNotDeduceNugetIdAndVersion, (msg::path), From f0fb958555205c19b20aa112da14e792484d8422 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Fri, 15 Jul 2022 15:16:53 -0700 Subject: [PATCH 31/61] PR feedback --- include/vcpkg/base/messages.h | 16 ++++++++-------- locales/messages.en.json | 16 ++++++++-------- locales/messages.json | 18 +++++++++--------- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index 01dca026cc..ee1e3c0f3a 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -692,15 +692,15 @@ namespace vcpkg DECLARE_MESSAGE(DuplicateCommandOption, (msg::command_name), "", - "The option '{command_name}'can only be passed once."); + "The option '{command_name}' can only be passed once."); DECLARE_MESSAGE(DuplicateOptions, (msg::value), - "'{value}' is a command option.", - "--'{value}' specified multiple times."); + "'{value}' is a command line option.", + "'--{value}' specified multiple times."); DECLARE_MESSAGE(EmptyArg, (msg::command_name), "", - "The option '{command_name}'must be passed a non-empty argument."); + "The option '{command_name}' must be passed a non-empty argument."); DECLARE_MESSAGE(EmptyLicenseExpression, (), "", "SPDX license expression was empty."); DECLARE_MESSAGE(EnvStrFailedToExtract, (), "", "could not expand the environment string:"); DECLARE_MESSAGE(ErrorDetectingCompilerInfo, @@ -777,7 +777,7 @@ namespace vcpkg DECLARE_MESSAGE(ExpectedValueForOption, (msg::value), "'{value}' is a command option.", - "expected value after '{value}.'"); + "expected value after '{value}'."); DECLARE_MESSAGE(ExtendedDocumentationAtUrl, (msg::url), "", "Extended documentation available at '{url}'."); DECLARE_MESSAGE(FailedToProvisionCe, (), "", "Failed to provision vcpkg-ce."); DECLARE_MESSAGE(FailedToRunToolToDetermineVersion, @@ -841,7 +841,7 @@ namespace vcpkg DECLARE_MESSAGE(HelpEditCommand, (msg::env_var), "", - "Open up a port for editing (uses '{env_var}' default 'code'."); + "Open up a port for editing (use '{env_var}' to set an editor program, defaults to 'code')."); DECLARE_MESSAGE(HelpEnvCommand, (), "", "Creates a clean shell environment for development or compiling."); DECLARE_MESSAGE(HelpExampleCommand, (), @@ -853,7 +853,7 @@ namespace vcpkg "", "Formats all vcpkg.json files. Run this before committing to vcpkg."); DECLARE_MESSAGE(HelpHashCommand, (), "", "Hash a file by specific algorithm, default SHA512."); - DECLARE_MESSAGE(HelpHistoryCommand, (), "", "(Experimental) Show the history of CONTROL versions of a package."); + DECLARE_MESSAGE(HelpHistoryCommand, (), "", "(Experimental) Show the history of versions of a package."); DECLARE_MESSAGE(HelpInitializeRegistryCommand, (), "", "Initializes a registry in the directory ."); DECLARE_MESSAGE(HelpInstallCommand, (), "", "Install a package."); DECLARE_MESSAGE(HelpListCommand, (), "", "List installed packages."); @@ -864,7 +864,7 @@ namespace vcpkg DECLARE_MESSAGE(HelpSearchCommand, (), "", "Search for packages available to be built."); DECLARE_MESSAGE(HelpTopicCommand, (), "", "Display help for a specific topic."); DECLARE_MESSAGE(HelpTopicsCommand, (), "", "Display the list of help topics."); - DECLARE_MESSAGE(HelpUpdateCommand, (), "", "List Packages that can be updated."); + DECLARE_MESSAGE(HelpUpdateCommand, (), "", "List packages that can be updated."); DECLARE_MESSAGE(HelpUpgradeCommand, (), "", "Rebuild all outdated packages."); DECLARE_MESSAGE(HelpVersionCommand, (), "", "Display version information."); DECLARE_MESSAGE(IllegalFeatures, (), "", "List of features is not allowed in this context"); diff --git a/locales/messages.en.json b/locales/messages.en.json index 3408eebb8c..10196a4ba7 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -76,7 +76,7 @@ "CmakeTargetsExcluded": "note: {count} additional targets are not displayed.", "CommandFailed": "command:\n{command_line}\nfailed with the following results:", "CompressFolderFailed": "Failed to compress folder \"{path}\":", - "ConflictingValuesForOption": "conflicting values specified for --'{value}'.", + "ConflictingValuesForOption": "conflicting values specified for '--{value}'.", "CouldNotDeduceNugetIdAndVersion": "Could not deduce nuget id and version from filename: {path}", "CurlReportedUnexpectedResults": "curl has reported unexpected results to vcpkg and vcpkg cannot continue.\nPlease review the following text for sensitive information and open an issue on the Microsoft/vcpkg GitHub to help fix this problem!\ncmd: {command_line}\n=== curl output ===\n{actual}\n=== end curl output ===", "DefaultFlag": "Defaulting to '{command_name}' being on.", @@ -87,10 +87,10 @@ "DownloadedSources": "Downloaded sources for {spec}", "DownloadingVcpkgCeBundle": "Downloading vcpkg-ce bundle {version}...", "DownloadingVcpkgCeBundleLatest": "Downloading latest vcpkg-ce bundle...", - "DuplicateCommandOption": "The option '{command_name}'can only be passed once.", - "DuplicateOptions": "--'{value}' specified multiple times.", + "DuplicateCommandOption": "The option '{command_name}' can only be passed once.", + "DuplicateOptions": "'--{value}' specified multiple times.", "ElapsedForPackage": "Elapsed time to handle {spec}: {elapsed}", - "EmptyArg": "The option '{command_name}'must be passed a non-empty argument.", + "EmptyArg": "The option '{command_name}' must be passed a non-empty argument.", "EmptyLicenseExpression": "SPDX license expression was empty.", "EnvStrFailedToExtract": "could not expand the environment string:", "ErrorDetectingCompilerInfo": "while detecting compiler information:\nThe log file content at \"{path}\" is:", @@ -115,7 +115,7 @@ "ExpectedFailOrSkip": "expected 'fail', 'skip', or 'pass' here", "ExpectedPortName": "expected a port name here", "ExpectedTripletName": "expected a triplet name here", - "ExpectedValueForOption": "expected value after '{value}.'", + "ExpectedValueForOption": "expected value after '{value}'.", "ExtendedDocumentationAtUrl": "Extended documentation available at '{url}'.", "FailedToProvisionCe": "Failed to provision vcpkg-ce.", "FailedToRunToolToDetermineVersion": "Failed to run {path} to determine the {tool_name} version.", @@ -140,13 +140,13 @@ "HelpContactCommand": "Display contact information to send feedback.", "HelpCreateCommand": "Create a new package.", "HelpDependInfoCommand": "Display a list of dependencies for packages.", - "HelpEditCommand": "Open up a port for editing (uses '{env_var}' default 'code'.", + "HelpEditCommand": "Open up a port for editing (use '{env_var}' to set an editor program, defaults to 'code').", "HelpEnvCommand": "Creates a clean shell environment for development or compiling.", "HelpExampleCommand": "For more help (including examples) see the accompanying README.md and docs folder.", "HelpExportCommand": "Exports a package.", "HelpFormatManifestCommand": "Formats all vcpkg.json files. Run this before committing to vcpkg.", "HelpHashCommand": "Hash a file by specific algorithm, default SHA512.", - "HelpHistoryCommand": "(Experimental) Show the history of CONTROL versions of a package.", + "HelpHistoryCommand": "(Experimental) Show the history of versions of a package.", "HelpInitializeRegistryCommand": "Initializes a registry in the directory .", "HelpInstallCommand": "Install a package.", "HelpListCommand": "List installed packages.", @@ -157,7 +157,7 @@ "HelpSearchCommand": "Search for packages available to be built.", "HelpTopicCommand": "Display help for a specific topic.", "HelpTopicsCommand": "Display the list of help topics.", - "HelpUpdateCommand": "List Packages that can be updated.", + "HelpUpdateCommand": "List packages that can be updated.", "HelpUpgradeCommand": "Rebuild all outdated packages.", "HelpVersionCommand": "Display version information.", "IllegalFeatures": "List of features is not allowed in this context", diff --git a/locales/messages.json b/locales/messages.json index 7d7b67934c..991dfafb53 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -137,7 +137,7 @@ "_CommandFailed.comment": "An example of {command_line} is vcpkg install zlib.", "CompressFolderFailed": "Failed to compress folder \"{path}\":", "_CompressFolderFailed.comment": "An example of {path} is /foo/bar.", - "ConflictingValuesForOption": "conflicting values specified for --'{value}'.", + "ConflictingValuesForOption": "conflicting values specified for '--{value}'.", "_ConflictingValuesForOption.comment": "'{value}' is a command option.", "CouldNotDeduceNugetIdAndVersion": "Could not deduce nuget id and version from filename: {path}", "_CouldNotDeduceNugetIdAndVersion.comment": "An example of {path} is /foo/bar.", @@ -159,13 +159,13 @@ "_DownloadingVcpkgCeBundle.comment": "An example of {version} is 1.3.8.", "DownloadingVcpkgCeBundleLatest": "Downloading latest vcpkg-ce bundle...", "_DownloadingVcpkgCeBundleLatest.comment": "This message is normally displayed only in development.", - "DuplicateCommandOption": "The option '{command_name}'can only be passed once.", + "DuplicateCommandOption": "The option '{command_name}' can only be passed once.", "_DuplicateCommandOption.comment": "An example of {command_name} is install.", - "DuplicateOptions": "--'{value}' specified multiple times.", - "_DuplicateOptions.comment": "'{value}' is a command option.", + "DuplicateOptions": "'--{value}' specified multiple times.", + "_DuplicateOptions.comment": "'{value}' is a command line option.", "ElapsedForPackage": "Elapsed time to handle {spec}: {elapsed}", "_ElapsedForPackage.comment": "An example of {spec} is zlib:x64-windows. An example of {elapsed} is 3.532 min.", - "EmptyArg": "The option '{command_name}'must be passed a non-empty argument.", + "EmptyArg": "The option '{command_name}' must be passed a non-empty argument.", "_EmptyArg.comment": "An example of {command_name} is install.", "EmptyLicenseExpression": "SPDX license expression was empty.", "EnvStrFailedToExtract": "could not expand the environment string:", @@ -204,7 +204,7 @@ "ExpectedFailOrSkip": "expected 'fail', 'skip', or 'pass' here", "ExpectedPortName": "expected a port name here", "ExpectedTripletName": "expected a triplet name here", - "ExpectedValueForOption": "expected value after '{value}.'", + "ExpectedValueForOption": "expected value after '{value}'.", "_ExpectedValueForOption.comment": "'{value}' is a command option.", "ExtendedDocumentationAtUrl": "Extended documentation available at '{url}'.", "_ExtendedDocumentationAtUrl.comment": "An example of {url} is https://github.com/microsoft/vcpkg.", @@ -244,14 +244,14 @@ "HelpContactCommand": "Display contact information to send feedback.", "HelpCreateCommand": "Create a new package.", "HelpDependInfoCommand": "Display a list of dependencies for packages.", - "HelpEditCommand": "Open up a port for editing (uses '{env_var}' default 'code'.", + "HelpEditCommand": "Open up a port for editing (use '{env_var}' to set an editor program, defaults to 'code').", "_HelpEditCommand.comment": "An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", "HelpEnvCommand": "Creates a clean shell environment for development or compiling.", "HelpExampleCommand": "For more help (including examples) see the accompanying README.md and docs folder.", "HelpExportCommand": "Exports a package.", "HelpFormatManifestCommand": "Formats all vcpkg.json files. Run this before committing to vcpkg.", "HelpHashCommand": "Hash a file by specific algorithm, default SHA512.", - "HelpHistoryCommand": "(Experimental) Show the history of CONTROL versions of a package.", + "HelpHistoryCommand": "(Experimental) Show the history of versions of a package.", "HelpInitializeRegistryCommand": "Initializes a registry in the directory .", "HelpInstallCommand": "Install a package.", "HelpListCommand": "List installed packages.", @@ -262,7 +262,7 @@ "HelpSearchCommand": "Search for packages available to be built.", "HelpTopicCommand": "Display help for a specific topic.", "HelpTopicsCommand": "Display the list of help topics.", - "HelpUpdateCommand": "List Packages that can be updated.", + "HelpUpdateCommand": "List packages that can be updated.", "HelpUpgradeCommand": "Rebuild all outdated packages.", "HelpVersionCommand": "Display version information.", "IllegalFeatures": "List of features is not allowed in this context", From 3d7b7517bbb02c6fc2e35063ca9863f1bdfd13bf Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Fri, 15 Jul 2022 16:04:33 -0700 Subject: [PATCH 32/61] WIP --- include/vcpkg/base/messages.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index 95609a064e..e8615cd474 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -1019,7 +1019,7 @@ namespace vcpkg "rather than by localization."); DECLARE_MESSAGE(MismatchedBinaryParagraphs, (msg::url), - "", + "A comparison of the original binary paragraph and serialized binary paragraph is expected.", "[sanity check] The serialized binary paragraph was different from the original binary " "paragraph.\nPlease open an issue at {url}, with the following output:"); DECLARE_MESSAGE(MonoInstructions, From dbb507d925b15e8cc315d241f596e7f6fccf096e Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Fri, 15 Jul 2022 16:10:49 -0700 Subject: [PATCH 33/61] update clang format --- CMakeSettings.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeSettings.json b/CMakeSettings.json index 255a15b1a9..f3fc4a9557 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -30,6 +30,11 @@ "name": "VCPKG_BUILD_FUZZING", "value": "True", "type": "BOOL" + }, + { + "name": "CLANG_FORMAT", + "value": "C:/Program Files/LLVM/bin/clang-format.exe", + "type": "FILEPATH" } ] }, From 4d3d4eeba5aa1a7b22aac581b3ab4957cda4bbb0 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Fri, 15 Jul 2022 16:15:27 -0700 Subject: [PATCH 34/61] Fix format --- CMakeSettings.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CMakeSettings.json b/CMakeSettings.json index 255a15b1a9..f3fc4a9557 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -30,6 +30,11 @@ "name": "VCPKG_BUILD_FUZZING", "value": "True", "type": "BOOL" + }, + { + "name": "CLANG_FORMAT", + "value": "C:/Program Files/LLVM/bin/clang-format.exe", + "type": "FILEPATH" } ] }, From b8a06249cc7c33ba1419c7948894ae79e6e0e3f3 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Fri, 15 Jul 2022 16:21:52 -0700 Subject: [PATCH 35/61] Fix paths --- include/vcpkg/base/messages.h | 16 ++++++++-------- locales/messages.en.json | 16 ++++++++-------- locales/messages.json | 16 ++++++++-------- src/vcpkg/commands.porthistory.cpp | 2 +- src/vcpkg/registries.cpp | 2 +- src/vcpkg/vcpkgpaths.cpp | 2 +- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index ee1e3c0f3a..581234b5ba 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -830,7 +830,7 @@ namespace vcpkg HashFileFailureToRead, (msg::path), "Printed after ErrorMessage and before the specific failing filesystem operation (like file not found)", - "failed to read file '{path}' for hashing: "); + "failed to read file \"{path}\" for hashing: "); DECLARE_MESSAGE(HeaderOnlyUsage, (msg::package_name), "'header' refers to C/C++ .h files", @@ -1059,7 +1059,7 @@ namespace vcpkg DECLARE_MESSAGE(MsiexecFailedToExtract, (msg::path, msg::exit_code), "", - "msiexec failed while extracting '{path}' with launch or exit code {exit_code} and message:"); + "msiexec failed while extracting \"{path}\" with launch or exit code {exit_code} and message:"); DECLARE_MESSAGE(NoArgumentsForOption, (msg::command_name), "", @@ -1107,12 +1107,12 @@ namespace vcpkg DECLARE_MESSAGE(PushingVendorFailed, (msg::vendor, msg::path), "", - "Pushing {vendor} to '{path}' failed. Use --debug for more information."); + "Pushing {vendor} to \"{path}\" failed. Use --debug for more information."); DECLARE_MESSAGE(ReplaceSecretsError, (msg::error_msg), "", "Replace secretes produced the following error: '{error_msg}'"); - DECLARE_MESSAGE(RestoredPackage, (msg::path), "", "Restored package from '{path}'"); + DECLARE_MESSAGE(RestoredPackage, (msg::path), "", "Restored package from \"{path}\""); DECLARE_MESSAGE( RestoredPackagesFromVendor, (msg::count, msg::elapsed, msg::value), @@ -1150,7 +1150,7 @@ namespace vcpkg (msg::env_var), "", "Specify the target architecture triplet. See 'vcpkg help triplet'.\n(default: '{env_var}')"); - DECLARE_MESSAGE(StoredBinaryCache, (msg::path), "", "Stored binary cache: '{path}'"); + DECLARE_MESSAGE(StoredBinaryCache, (msg::path), "", "Stored binary cache: \"{path}\""); DECLARE_MESSAGE(SystemApiErrorMessage, (msg::system_api, msg::exit_code, msg::error_msg), "", @@ -1206,7 +1206,7 @@ namespace vcpkg DECLARE_MESSAGE(UpdateBaselineLocalGitError, (msg::path), "", - "git failed to parse HEAD for the local vcpkg registry at '{path}'"); + "git failed to parse HEAD for the local vcpkg registry at \"{path}\""); DECLARE_MESSAGE(UpdateBaselineNoConfiguration, (), "", @@ -1233,11 +1233,11 @@ namespace vcpkg DECLARE_MESSAGE(UploadingBinariesToVendor, (msg::spec, msg::vendor, msg::path), "", - "Uploading binaries for '{spec}' to '{vendor}' source '{path}'."); + "Uploading binaries for '{spec}' to '{vendor}' source \"{path}\"."); DECLARE_MESSAGE(UploadingBinariesUsingVendor, (msg::spec, msg::vendor, msg::path), "", - "Uploading binaries for '{spec}' using '{vendor}' '{path}'."); + "Uploading binaries for '{spec}' using '{vendor}' \"{path}\"."); DECLARE_MESSAGE(UseEnvVar, (msg::env_var), "An example of env_var is \"HTTP(S)_PROXY\"" diff --git a/locales/messages.en.json b/locales/messages.en.json index 10196a4ba7..4a18155955 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -135,7 +135,7 @@ "GitStatusUnknownFileStatus": "unknown file status: {value}", "GitUnexpectedCommandOutput": "unexpected git output", "GraphCycleDetected": "Cycle detected within graph at {package_name}:", - "HashFileFailureToRead": "failed to read file '{path}' for hashing: ", + "HashFileFailureToRead": "failed to read file \"{path}\" for hashing: ", "HeaderOnlyUsage": "{package_name} is header-only and can be used from CMake via:", "HelpContactCommand": "Display contact information to send feedback.", "HelpCreateCommand": "Create a new package.", @@ -213,7 +213,7 @@ "LocalizedMessageMustNotContainIndents": "The message named {value} contains what appears to be indenting which must be changed to use LocalizedString::append_indent instead.", "LocalizedMessageMustNotEndWithNewline": "The message named {value} ends with a newline which should be added by formatting rather than by localization.", "MonoInstructions": "This may be caused by an incomplete mono installation. Full mono is available on some systems via `sudo apt install mono-complete`. Ubuntu 18.04 users may need a newer version of mono, available at https://www.mono-project.com/download/stable/", - "MsiexecFailedToExtract": "msiexec failed while extracting '{path}' with launch or exit code {exit_code} and message:", + "MsiexecFailedToExtract": "msiexec failed while extracting \"{path}\" with launch or exit code {exit_code} and message:", "NoArgumentsForOption": "The option '{command_name}' does not accept an argument.", "NoLocalizationForMessages": "No localized messages for the following: ", "NoRegistryForPort": "no registry configured for port {package_name}", @@ -230,10 +230,10 @@ "ProcessorArchitectureMissing": "The required environment variable %PROCESSOR_ARCHITECTURE% is missing.", "ProcessorArchitectureW6432Malformed": "Failed to parse %PROCESSOR_ARCHITEW6432% ({arch}) as a valid CPU architecture. Falling back to %PROCESSOR_ARCHITECTURE%.", "ProgramReturnedNonzeroExitCode": "{tool_name} failed with exit code: ({exit_code}).", - "PushingVendorFailed": "Pushing {vendor} to '{path}' failed. Use --debug for more information.", + "PushingVendorFailed": "Pushing {vendor} to \"{path}\" failed. Use --debug for more information.", "RemovingPackage": "Removing {action_index}/{count} {spec}", "ReplaceSecretsError": "Replace secretes produced the following error: '{error_msg}'", - "RestoredPackage": "Restored package from '{path}'", + "RestoredPackage": "Restored package from \"{path}\"", "RestoredPackagesFromVendor": "Restored {count} package(s) from {value} in {elapsed}. Use --debug to see more details.", "ResultsHeader": "RESULTS", "SeeURL": "See {url} for more information.", @@ -244,7 +244,7 @@ "SpecifyDirectoriesWhenSearching": "Specify directories to be used when searching for ports.\n(also: '{env_var}')", "SpecifyHostArch": "Specify the host architecture triplet. See 'vcpkg help triplet'.\n(default: '{env_var}')", "SpecifyTargetArch": "Specify the target architecture triplet. See 'vcpkg help triplet'.\n(default: '{env_var}')", - "StoredBinaryCache": "Stored binary cache: '{path}'", + "StoredBinaryCache": "Stored binary cache: \"{path}\"", "SystemApiErrorMessage": "calling {system_api} failed with {exit_code} ({error_msg})", "ToolFetchFailed": "Could not fetch {tool_name}.", "ToolInWin10": "This utility is bundled with Windows 10 or later.", @@ -260,7 +260,7 @@ "UnsupportedSystemName": "Could not map VCPKG_CMAKE_SYSTEM_NAME '{system_name}' to a vcvarsall platform. Supported system names are '', 'Windows' and 'WindowsStore'.", "UnsupportedToolchain": "in triplet {triplet}: Unable to find a valid toolchain for requested target architecture {arch}.\nThe selected Visual Studio instance is at: {path}\nThe available toolchain combinations are: {list}", "UpdateBaselineAddBaselineNoManifest": "the --{option} switch was passed, but there is no manifest file to add a `builtin-baseline` field to.", - "UpdateBaselineLocalGitError": "git failed to parse HEAD for the local vcpkg registry at '{path}'", + "UpdateBaselineLocalGitError": "git failed to parse HEAD for the local vcpkg registry at \"{path}\"", "UpdateBaselineNoConfiguration": "neither `vcpkg.json` nor `vcpkg-configuration.json` exist to update.", "UpdateBaselineNoExistingBuiltinBaseline": "the manifest file currently does not contain a `builtin-baseline` field; in order to add one, pass the --{option} switch.", "UpdateBaselineNoUpdate": "registry '{url}' not updated: '{value}'", @@ -268,8 +268,8 @@ "UpdateBaselineUpdatedBaseline": "updated registry '{url}': baseline '{old_value}' -> '{new_value}'", "UploadedBinaries": "Uploaded binaries to {count} {vendor}.", "UploadedPackagesToVendor": "Uploaded {count} package(s) to {vendor} in {elapsed}", - "UploadingBinariesToVendor": "Uploading binaries for '{spec}' to '{vendor}' source '{path}'.", - "UploadingBinariesUsingVendor": "Uploading binaries for '{spec}' using '{vendor}' '{path}'.", + "UploadingBinariesToVendor": "Uploading binaries for '{spec}' to '{vendor}' source \"{path}\".", + "UploadingBinariesUsingVendor": "Uploading binaries for '{spec}' using '{vendor}' \"{path}\".", "UseEnvVar": "-- Using {env_var} in environment variables.", "UsingCommunityTriplet": "-- Using community triplet {triplet}. This triplet configuration is not guaranteed to succeed.", "UsingManifestAt": "Using manifest file at {path}.", diff --git a/locales/messages.json b/locales/messages.json index 991dfafb53..5044b102c1 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -237,7 +237,7 @@ "GitUnexpectedCommandOutput": "unexpected git output", "GraphCycleDetected": "Cycle detected within graph at {package_name}:", "_GraphCycleDetected.comment": "A list of package names comprising the cycle will be printed after this message. An example of {package_name} is zlib.", - "HashFileFailureToRead": "failed to read file '{path}' for hashing: ", + "HashFileFailureToRead": "failed to read file \"{path}\" for hashing: ", "_HashFileFailureToRead.comment": "Printed after ErrorMessage and before the specific failing filesystem operation (like file not found) An example of {path} is /foo/bar.", "HeaderOnlyUsage": "{package_name} is header-only and can be used from CMake via:", "_HeaderOnlyUsage.comment": "'header' refers to C/C++ .h files An example of {package_name} is zlib.", @@ -354,7 +354,7 @@ "LocalizedMessageMustNotEndWithNewline": "The message named {value} ends with a newline which should be added by formatting rather than by localization.", "_LocalizedMessageMustNotEndWithNewline.comment": "{value} is a localized message name like LocalizedMessageMustNotEndWithNewline", "MonoInstructions": "This may be caused by an incomplete mono installation. Full mono is available on some systems via `sudo apt install mono-complete`. Ubuntu 18.04 users may need a newer version of mono, available at https://www.mono-project.com/download/stable/", - "MsiexecFailedToExtract": "msiexec failed while extracting '{path}' with launch or exit code {exit_code} and message:", + "MsiexecFailedToExtract": "msiexec failed while extracting \"{path}\" with launch or exit code {exit_code} and message:", "_MsiexecFailedToExtract.comment": "An example of {path} is /foo/bar. An example of {exit_code} is 127.", "NoArgumentsForOption": "The option '{command_name}' does not accept an argument.", "_NoArgumentsForOption.comment": "An example of {command_name} is install.", @@ -381,13 +381,13 @@ "_ProcessorArchitectureW6432Malformed.comment": "An example of {arch} is x64.", "ProgramReturnedNonzeroExitCode": "{tool_name} failed with exit code: ({exit_code}).", "_ProgramReturnedNonzeroExitCode.comment": "The program's console output is appended after this. An example of {tool_name} is aria2. An example of {exit_code} is 127.", - "PushingVendorFailed": "Pushing {vendor} to '{path}' failed. Use --debug for more information.", + "PushingVendorFailed": "Pushing {vendor} to \"{path}\" failed. Use --debug for more information.", "_PushingVendorFailed.comment": "An example of {vendor} is Azure. An example of {path} is /foo/bar.", "RemovingPackage": "Removing {action_index}/{count} {spec}", "_RemovingPackage.comment": "An example of {action_index} is 340. An example of {count} is 42. An example of {spec} is zlib:x64-windows.", "ReplaceSecretsError": "Replace secretes produced the following error: '{error_msg}'", "_ReplaceSecretsError.comment": "An example of {error_msg} is File Not Found.", - "RestoredPackage": "Restored package from '{path}'", + "RestoredPackage": "Restored package from \"{path}\"", "_RestoredPackage.comment": "An example of {path} is /foo/bar.", "RestoredPackagesFromVendor": "Restored {count} package(s) from {value} in {elapsed}. Use --debug to see more details.", "_RestoredPackagesFromVendor.comment": "{value} may be either a 'vendor' like 'Azure' or 'NuGet', or a file path like C:\\example or /usr/example An example of {count} is 42. An example of {elapsed} is 3.532 min.", @@ -409,7 +409,7 @@ "_SpecifyHostArch.comment": "An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", "SpecifyTargetArch": "Specify the target architecture triplet. See 'vcpkg help triplet'.\n(default: '{env_var}')", "_SpecifyTargetArch.comment": "An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", - "StoredBinaryCache": "Stored binary cache: '{path}'", + "StoredBinaryCache": "Stored binary cache: \"{path}\"", "_StoredBinaryCache.comment": "An example of {path} is /foo/bar.", "SystemApiErrorMessage": "calling {system_api} failed with {exit_code} ({error_msg})", "_SystemApiErrorMessage.comment": "An example of {system_api} is CreateProcessW. An example of {exit_code} is 127. An example of {error_msg} is File Not Found.", @@ -436,7 +436,7 @@ "_UnsupportedToolchain.comment": "example for {list} is 'x86, arm64' An example of {triplet} is x64-windows. An example of {arch} is x64. An example of {path} is /foo/bar.", "UpdateBaselineAddBaselineNoManifest": "the --{option} switch was passed, but there is no manifest file to add a `builtin-baseline` field to.", "_UpdateBaselineAddBaselineNoManifest.comment": "An example of {option} is editable.", - "UpdateBaselineLocalGitError": "git failed to parse HEAD for the local vcpkg registry at '{path}'", + "UpdateBaselineLocalGitError": "git failed to parse HEAD for the local vcpkg registry at \"{path}\"", "_UpdateBaselineLocalGitError.comment": "An example of {path} is /foo/bar.", "UpdateBaselineNoConfiguration": "neither `vcpkg.json` nor `vcpkg-configuration.json` exist to update.", "UpdateBaselineNoExistingBuiltinBaseline": "the manifest file currently does not contain a `builtin-baseline` field; in order to add one, pass the --{option} switch.", @@ -451,9 +451,9 @@ "_UploadedBinaries.comment": "An example of {count} is 42. An example of {vendor} is Azure.", "UploadedPackagesToVendor": "Uploaded {count} package(s) to {vendor} in {elapsed}", "_UploadedPackagesToVendor.comment": "An example of {count} is 42. An example of {elapsed} is 3.532 min. An example of {vendor} is Azure.", - "UploadingBinariesToVendor": "Uploading binaries for '{spec}' to '{vendor}' source '{path}'.", + "UploadingBinariesToVendor": "Uploading binaries for '{spec}' to '{vendor}' source \"{path}\".", "_UploadingBinariesToVendor.comment": "An example of {spec} is zlib:x64-windows. An example of {vendor} is Azure. An example of {path} is /foo/bar.", - "UploadingBinariesUsingVendor": "Uploading binaries for '{spec}' using '{vendor}' '{path}'.", + "UploadingBinariesUsingVendor": "Uploading binaries for '{spec}' using '{vendor}' \"{path}\".", "_UploadingBinariesUsingVendor.comment": "An example of {spec} is zlib:x64-windows. An example of {vendor} is Azure. An example of {path} is /foo/bar.", "UseEnvVar": "-- Using {env_var} in environment variables.", "_UseEnvVar.comment": "An example of env_var is \"HTTP(S)_PROXY\"'--' at the beginning must be preserved An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", diff --git a/src/vcpkg/commands.porthistory.cpp b/src/vcpkg/commands.porthistory.cpp index 3ab8b359cd..f74282d498 100644 --- a/src/vcpkg/commands.porthistory.cpp +++ b/src/vcpkg/commands.porthistory.cpp @@ -112,7 +112,7 @@ namespace vcpkg::Commands::PortHistory if (auto output = maybe_output.get()) { auto commits = Util::fmap( - Strings::split(*output, '\n'), [](const std::string& line) -> auto { + Strings::split(*output, '\n'), [](const std::string& line) -> auto{ auto parts = Strings::split(line, ' '); return std::make_pair(parts[0], parts[1]); }); diff --git a/src/vcpkg/registries.cpp b/src/vcpkg/registries.cpp index ab90bcd77a..f1388a0f2e 100644 --- a/src/vcpkg/registries.cpp +++ b/src/vcpkg/registries.cpp @@ -1186,7 +1186,7 @@ namespace vcpkg if (auto pversions = maybe_versions.get()) { return Util::fmap( - *pversions, [](auto&& entry) -> auto { + *pversions, [](auto&& entry) -> auto{ return std::make_pair(SchemedVersion{entry.scheme, entry.version}, entry.git_tree); }); } diff --git a/src/vcpkg/vcpkgpaths.cpp b/src/vcpkg/vcpkgpaths.cpp index c9dca0690b..bd5188a71e 100644 --- a/src/vcpkg/vcpkgpaths.cpp +++ b/src/vcpkg/vcpkgpaths.cpp @@ -877,7 +877,7 @@ namespace vcpkg const Path VcpkgPaths::get_triplet_file_path(Triplet triplet) const { return m_pimpl->m_triplets_cache.get_lazy( - triplet, [&]() -> auto { + triplet, [&]() -> auto{ for (const auto& triplet_dir : m_pimpl->triplets_dirs) { auto path = triplet_dir / (triplet.canonical_name() + ".cmake"); From 93d96bc79201a010d310e85290832ce3a9f30f6d Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Fri, 15 Jul 2022 16:26:03 -0700 Subject: [PATCH 36/61] Fix paths --- CMakeSettings.json | 5 +++++ include/vcpkg/base/messages.h | 16 ++++++++-------- locales/messages.en.json | 16 ++++++++-------- locales/messages.json | 18 +++++++++--------- src/vcpkg/commands.porthistory.cpp | 2 +- src/vcpkg/registries.cpp | 2 +- src/vcpkg/vcpkgpaths.cpp | 2 +- 7 files changed, 33 insertions(+), 28 deletions(-) diff --git a/CMakeSettings.json b/CMakeSettings.json index 255a15b1a9..f3fc4a9557 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -30,6 +30,11 @@ "name": "VCPKG_BUILD_FUZZING", "value": "True", "type": "BOOL" + }, + { + "name": "CLANG_FORMAT", + "value": "C:/Program Files/LLVM/bin/clang-format.exe", + "type": "FILEPATH" } ] }, diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index e8615cd474..d4210348e1 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -831,7 +831,7 @@ namespace vcpkg HashFileFailureToRead, (msg::path), "Printed after ErrorMessage and before the specific failing filesystem operation (like file not found)", - "failed to read file '{path}' for hashing: "); + "failed to read file \"{path}\" for hashing: "); DECLARE_MESSAGE(HeaderOnlyUsage, (msg::package_name), "'header' refers to C/C++ .h files", @@ -1031,7 +1031,7 @@ namespace vcpkg DECLARE_MESSAGE(MsiexecFailedToExtract, (msg::path, msg::exit_code), "", - "msiexec failed while extracting '{path}' with launch or exit code {exit_code} and message:"); + "msiexec failed while extracting \"{path}\" with launch or exit code {exit_code} and message:"); DECLARE_MESSAGE(MultiArch, (msg::option), "", "Multi-Arch must be 'same' but was {option}"); DECLARE_MESSAGE(NoLocalizationForMessages, (), "", "No localized messages for the following: "); DECLARE_MESSAGE(NoRegistryForPort, (msg::package_name), "", "no registry configured for port {package_name}"); @@ -1079,12 +1079,12 @@ namespace vcpkg DECLARE_MESSAGE(PushingVendorFailed, (msg::vendor, msg::path), "", - "Pushing {vendor} to '{path}' failed. Use --debug for more information."); + "Pushing {vendor} to \"{path}\" failed. Use --debug for more information."); DECLARE_MESSAGE(ReplaceSecretsError, (msg::error_msg), "", "Replace secretes produced the following error: '{error_msg}'"); - DECLARE_MESSAGE(RestoredPackage, (msg::path), "", "Restored package from '{path}'"); + DECLARE_MESSAGE(RestoredPackage, (msg::path), "", "Restored package from \"{path}\""); DECLARE_MESSAGE( RestoredPackagesFromVendor, (msg::count, msg::elapsed, msg::value), @@ -1106,7 +1106,7 @@ namespace vcpkg "'CONTROL', 'vcpkg.json', and 'name' references are locale-invariant.", "The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json " "file has the name {package_name} and does not match the port directory {path}."); - DECLARE_MESSAGE(StoredBinaryCache, (msg::path), "", "Stored binary cache: '{path}'"); + DECLARE_MESSAGE(StoredBinaryCache, (msg::path), "", "Stored binary cache: \"{path}\""); DECLARE_MESSAGE(SuggestUpdateVcpkg, (msg::command_line), "", @@ -1157,7 +1157,7 @@ namespace vcpkg DECLARE_MESSAGE(UpdateBaselineLocalGitError, (msg::path), "", - "git failed to parse HEAD for the local vcpkg registry at '{path}'"); + "git failed to parse HEAD for the local vcpkg registry at \"{path}\""); DECLARE_MESSAGE(UpdateBaselineNoConfiguration, (), "", @@ -1184,11 +1184,11 @@ namespace vcpkg DECLARE_MESSAGE(UploadingBinariesToVendor, (msg::spec, msg::vendor, msg::path), "", - "Uploading binaries for '{spec}' to '{vendor}' source '{path}'."); + "Uploading binaries for '{spec}' to '{vendor}' source \"{path}\"."); DECLARE_MESSAGE(UploadingBinariesUsingVendor, (msg::spec, msg::vendor, msg::path), "", - "Uploading binaries for '{spec}' using '{vendor}' '{path}'."); + "Uploading binaries for '{spec}' using '{vendor}' \"{path}\"."); DECLARE_MESSAGE(UseEnvVar, (msg::env_var), "An example of env_var is \"HTTP(S)_PROXY\"" diff --git a/locales/messages.en.json b/locales/messages.en.json index 58adb7763f..0c771b023f 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -129,7 +129,7 @@ "GitStatusUnknownFileStatus": "unknown file status: {value}", "GitUnexpectedCommandOutput": "unexpected git output", "GraphCycleDetected": "Cycle detected within graph at {package_name}:", - "HashFileFailureToRead": "failed to read file '{path}' for hashing: ", + "HashFileFailureToRead": "failed to read file \"{path}\" for hashing: ", "HeaderOnlyUsage": "{package_name} is header-only and can be used from CMake via:", "IllegalFeatures": "List of features is not allowed in this context", "IllegalPlatformSpec": "Platform qualifier is not allowed in this context", @@ -183,7 +183,7 @@ "LocalizedMessageMustNotEndWithNewline": "The message named {value} ends with a newline which should be added by formatting rather than by localization.", "MismatchedBinaryParagraphs": "[sanity check] The serialized binary paragraph was different from the original binary paragraph.\nPlease open an issue at {url}, with the following output:", "MonoInstructions": "This may be caused by an incomplete mono installation. Full mono is available on some systems via `sudo apt install mono-complete`. Ubuntu 18.04 users may need a newer version of mono, available at https://www.mono-project.com/download/stable/", - "MsiexecFailedToExtract": "msiexec failed while extracting '{path}' with launch or exit code {exit_code} and message:", + "MsiexecFailedToExtract": "msiexec failed while extracting \"{path}\" with launch or exit code {exit_code} and message:", "MultiArch": "Multi-Arch must be 'same' but was {option}", "NoLocalizationForMessages": "No localized messages for the following: ", "NoRegistryForPort": "no registry configured for port {package_name}", @@ -200,17 +200,17 @@ "ProcessorArchitectureMissing": "The required environment variable %PROCESSOR_ARCHITECTURE% is missing.", "ProcessorArchitectureW6432Malformed": "Failed to parse %PROCESSOR_ARCHITEW6432% ({arch}) as a valid CPU architecture. Falling back to %PROCESSOR_ARCHITECTURE%.", "ProgramReturnedNonzeroExitCode": "{tool_name} failed with exit code: ({exit_code}).", - "PushingVendorFailed": "Pushing {vendor} to '{path}' failed. Use --debug for more information.", + "PushingVendorFailed": "Pushing {vendor} to \"{path}\" failed. Use --debug for more information.", "RemovingPackage": "Removing {action_index}/{count} {spec}", "ReplaceSecretsError": "Replace secretes produced the following error: '{error_msg}'", - "RestoredPackage": "Restored package from '{path}'", + "RestoredPackage": "Restored package from \"{path}\"", "RestoredPackagesFromVendor": "Restored {count} package(s) from {value} in {elapsed}. Use --debug to see more details.", "ResultsHeader": "RESULTS", "SeeURL": "See {url} for more information.", "SerializedBinaryParagraphHeader": "\n=== Serialized Binary Paragraph ===", "SettingEnvVar": "-- Setting \"{env_var}\" environment variables to \"{url}\".", "SourceFieldPortNameMismatch": "The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json file has the name {package_name} and does not match the port directory {path}.", - "StoredBinaryCache": "Stored binary cache: '{path}'", + "StoredBinaryCache": "Stored binary cache: \"{path}\"", "SuggestUpdateVcpkg": "You may need to update the vcpkg binary; try running {command_line} to update.", "SystemApiErrorMessage": "calling {system_api} failed with {exit_code} ({error_msg})", "ToolFetchFailed": "Could not fetch {tool_name}.", @@ -224,7 +224,7 @@ "UnsupportedSystemName": "Could not map VCPKG_CMAKE_SYSTEM_NAME '{system_name}' to a vcvarsall platform. Supported system names are '', 'Windows' and 'WindowsStore'.", "UnsupportedToolchain": "in triplet {triplet}: Unable to find a valid toolchain for requested target architecture {arch}.\nThe selected Visual Studio instance is at: {path}\nThe available toolchain combinations are: {list}", "UpdateBaselineAddBaselineNoManifest": "the --{option} switch was passed, but there is no manifest file to add a `builtin-baseline` field to.", - "UpdateBaselineLocalGitError": "git failed to parse HEAD for the local vcpkg registry at '{path}'", + "UpdateBaselineLocalGitError": "git failed to parse HEAD for the local vcpkg registry at \"{path}\"", "UpdateBaselineNoConfiguration": "neither `vcpkg.json` nor `vcpkg-configuration.json` exist to update.", "UpdateBaselineNoExistingBuiltinBaseline": "the manifest file currently does not contain a `builtin-baseline` field; in order to add one, pass the --{option} switch.", "UpdateBaselineNoUpdate": "registry '{url}' not updated: '{value}'", @@ -232,8 +232,8 @@ "UpdateBaselineUpdatedBaseline": "updated registry '{url}': baseline '{old_value}' -> '{new_value}'", "UploadedBinaries": "Uploaded binaries to {count} {vendor}.", "UploadedPackagesToVendor": "Uploaded {count} package(s) to {vendor} in {elapsed}", - "UploadingBinariesToVendor": "Uploading binaries for '{spec}' to '{vendor}' source '{path}'.", - "UploadingBinariesUsingVendor": "Uploading binaries for '{spec}' using '{vendor}' '{path}'.", + "UploadingBinariesToVendor": "Uploading binaries for '{spec}' to '{vendor}' source \"{path}\".", + "UploadingBinariesUsingVendor": "Uploading binaries for '{spec}' using '{vendor}' \"{path}\".", "UseEnvVar": "-- Using {env_var} in environment variables.", "UsingCommunityTriplet": "-- Using community triplet {triplet}. This triplet configuration is not guaranteed to succeed.", "UsingManifestAt": "Using manifest file at {path}.", diff --git a/locales/messages.json b/locales/messages.json index 6a2c29bc88..9df6c77951 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -228,7 +228,7 @@ "GitUnexpectedCommandOutput": "unexpected git output", "GraphCycleDetected": "Cycle detected within graph at {package_name}:", "_GraphCycleDetected.comment": "A list of package names comprising the cycle will be printed after this message. An example of {package_name} is zlib.", - "HashFileFailureToRead": "failed to read file '{path}' for hashing: ", + "HashFileFailureToRead": "failed to read file \"{path}\" for hashing: ", "_HashFileFailureToRead.comment": "Printed after ErrorMessage and before the specific failing filesystem operation (like file not found) An example of {path} is /foo/bar.", "HeaderOnlyUsage": "{package_name} is header-only and can be used from CMake via:", "_HeaderOnlyUsage.comment": "'header' refers to C/C++ .h files An example of {package_name} is zlib.", @@ -318,9 +318,9 @@ "LocalizedMessageMustNotEndWithNewline": "The message named {value} ends with a newline which should be added by formatting rather than by localization.", "_LocalizedMessageMustNotEndWithNewline.comment": "{value} is a localized message name like LocalizedMessageMustNotEndWithNewline", "MismatchedBinaryParagraphs": "[sanity check] The serialized binary paragraph was different from the original binary paragraph.\nPlease open an issue at {url}, with the following output:", - "_MismatchedBinaryParagraphs.comment": "An example of {url} is https://github.com/microsoft/vcpkg.", + "_MismatchedBinaryParagraphs.comment": "A comparison of the original binary paragraph and serialized binary paragraph is expected. An example of {url} is https://github.com/microsoft/vcpkg.", "MonoInstructions": "This may be caused by an incomplete mono installation. Full mono is available on some systems via `sudo apt install mono-complete`. Ubuntu 18.04 users may need a newer version of mono, available at https://www.mono-project.com/download/stable/", - "MsiexecFailedToExtract": "msiexec failed while extracting '{path}' with launch or exit code {exit_code} and message:", + "MsiexecFailedToExtract": "msiexec failed while extracting \"{path}\" with launch or exit code {exit_code} and message:", "_MsiexecFailedToExtract.comment": "An example of {path} is /foo/bar. An example of {exit_code} is 127.", "MultiArch": "Multi-Arch must be 'same' but was {option}", "_MultiArch.comment": "An example of {option} is editable.", @@ -348,13 +348,13 @@ "_ProcessorArchitectureW6432Malformed.comment": "An example of {arch} is x64.", "ProgramReturnedNonzeroExitCode": "{tool_name} failed with exit code: ({exit_code}).", "_ProgramReturnedNonzeroExitCode.comment": "The program's console output is appended after this. An example of {tool_name} is aria2. An example of {exit_code} is 127.", - "PushingVendorFailed": "Pushing {vendor} to '{path}' failed. Use --debug for more information.", + "PushingVendorFailed": "Pushing {vendor} to \"{path}\" failed. Use --debug for more information.", "_PushingVendorFailed.comment": "An example of {vendor} is Azure. An example of {path} is /foo/bar.", "RemovingPackage": "Removing {action_index}/{count} {spec}", "_RemovingPackage.comment": "An example of {action_index} is 340. An example of {count} is 42. An example of {spec} is zlib:x64-windows.", "ReplaceSecretsError": "Replace secretes produced the following error: '{error_msg}'", "_ReplaceSecretsError.comment": "An example of {error_msg} is File Not Found.", - "RestoredPackage": "Restored package from '{path}'", + "RestoredPackage": "Restored package from \"{path}\"", "_RestoredPackage.comment": "An example of {path} is /foo/bar.", "RestoredPackagesFromVendor": "Restored {count} package(s) from {value} in {elapsed}. Use --debug to see more details.", "_RestoredPackagesFromVendor.comment": "{value} may be either a 'vendor' like 'Azure' or 'NuGet', or a file path like C:\\example or /usr/example An example of {count} is 42. An example of {elapsed} is 3.532 min.", @@ -368,7 +368,7 @@ "_SettingEnvVar.comment": "An example of env_var is \"HTTP(S)_PROXY\"'--' at the beginning must be preserved An example of {env_var} is VCPKG_DEFAULT_TRIPLET. An example of {url} is https://github.com/microsoft/vcpkg.", "SourceFieldPortNameMismatch": "The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json file has the name {package_name} and does not match the port directory {path}.", "_SourceFieldPortNameMismatch.comment": "{package_name} and {path} are both names of installable ports/packages. 'Source', 'CONTROL', 'vcpkg.json', and 'name' references are locale-invariant. An example of {package_name} is zlib. An example of {path} is /foo/bar.", - "StoredBinaryCache": "Stored binary cache: '{path}'", + "StoredBinaryCache": "Stored binary cache: \"{path}\"", "_StoredBinaryCache.comment": "An example of {path} is /foo/bar.", "SuggestUpdateVcpkg": "You may need to update the vcpkg binary; try running {command_line} to update.", "_SuggestUpdateVcpkg.comment": "An example of {command_line} is vcpkg install zlib.", @@ -391,7 +391,7 @@ "_UnsupportedToolchain.comment": "example for {list} is 'x86, arm64' An example of {triplet} is x64-windows. An example of {arch} is x64. An example of {path} is /foo/bar.", "UpdateBaselineAddBaselineNoManifest": "the --{option} switch was passed, but there is no manifest file to add a `builtin-baseline` field to.", "_UpdateBaselineAddBaselineNoManifest.comment": "An example of {option} is editable.", - "UpdateBaselineLocalGitError": "git failed to parse HEAD for the local vcpkg registry at '{path}'", + "UpdateBaselineLocalGitError": "git failed to parse HEAD for the local vcpkg registry at \"{path}\"", "_UpdateBaselineLocalGitError.comment": "An example of {path} is /foo/bar.", "UpdateBaselineNoConfiguration": "neither `vcpkg.json` nor `vcpkg-configuration.json` exist to update.", "UpdateBaselineNoExistingBuiltinBaseline": "the manifest file currently does not contain a `builtin-baseline` field; in order to add one, pass the --{option} switch.", @@ -406,9 +406,9 @@ "_UploadedBinaries.comment": "An example of {count} is 42. An example of {vendor} is Azure.", "UploadedPackagesToVendor": "Uploaded {count} package(s) to {vendor} in {elapsed}", "_UploadedPackagesToVendor.comment": "An example of {count} is 42. An example of {elapsed} is 3.532 min. An example of {vendor} is Azure.", - "UploadingBinariesToVendor": "Uploading binaries for '{spec}' to '{vendor}' source '{path}'.", + "UploadingBinariesToVendor": "Uploading binaries for '{spec}' to '{vendor}' source \"{path}\".", "_UploadingBinariesToVendor.comment": "An example of {spec} is zlib:x64-windows. An example of {vendor} is Azure. An example of {path} is /foo/bar.", - "UploadingBinariesUsingVendor": "Uploading binaries for '{spec}' using '{vendor}' '{path}'.", + "UploadingBinariesUsingVendor": "Uploading binaries for '{spec}' using '{vendor}' \"{path}\".", "_UploadingBinariesUsingVendor.comment": "An example of {spec} is zlib:x64-windows. An example of {vendor} is Azure. An example of {path} is /foo/bar.", "UseEnvVar": "-- Using {env_var} in environment variables.", "_UseEnvVar.comment": "An example of env_var is \"HTTP(S)_PROXY\"'--' at the beginning must be preserved An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", diff --git a/src/vcpkg/commands.porthistory.cpp b/src/vcpkg/commands.porthistory.cpp index 3ab8b359cd..f74282d498 100644 --- a/src/vcpkg/commands.porthistory.cpp +++ b/src/vcpkg/commands.porthistory.cpp @@ -112,7 +112,7 @@ namespace vcpkg::Commands::PortHistory if (auto output = maybe_output.get()) { auto commits = Util::fmap( - Strings::split(*output, '\n'), [](const std::string& line) -> auto { + Strings::split(*output, '\n'), [](const std::string& line) -> auto{ auto parts = Strings::split(line, ' '); return std::make_pair(parts[0], parts[1]); }); diff --git a/src/vcpkg/registries.cpp b/src/vcpkg/registries.cpp index ab90bcd77a..f1388a0f2e 100644 --- a/src/vcpkg/registries.cpp +++ b/src/vcpkg/registries.cpp @@ -1186,7 +1186,7 @@ namespace vcpkg if (auto pversions = maybe_versions.get()) { return Util::fmap( - *pversions, [](auto&& entry) -> auto { + *pversions, [](auto&& entry) -> auto{ return std::make_pair(SchemedVersion{entry.scheme, entry.version}, entry.git_tree); }); } diff --git a/src/vcpkg/vcpkgpaths.cpp b/src/vcpkg/vcpkgpaths.cpp index c9dca0690b..bd5188a71e 100644 --- a/src/vcpkg/vcpkgpaths.cpp +++ b/src/vcpkg/vcpkgpaths.cpp @@ -877,7 +877,7 @@ namespace vcpkg const Path VcpkgPaths::get_triplet_file_path(Triplet triplet) const { return m_pimpl->m_triplets_cache.get_lazy( - triplet, [&]() -> auto { + triplet, [&]() -> auto{ for (const auto& triplet_dir : m_pimpl->triplets_dirs) { auto path = triplet_dir / (triplet.canonical_name() + ".cmake"); From cc597cf0eeba7e1e232cf446ed79dd0dd06b9972 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Fri, 15 Jul 2022 16:28:21 -0700 Subject: [PATCH 37/61] Fix paths --- include/vcpkg/base/messages.h | 16 ++++++++-------- locales/messages.en.json | 16 ++++++++-------- locales/messages.json | 16 ++++++++-------- src/vcpkg/commands.porthistory.cpp | 2 +- src/vcpkg/registries.cpp | 2 +- src/vcpkg/vcpkgpaths.cpp | 2 +- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index e2a45379f2..548ae612be 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -807,7 +807,7 @@ namespace vcpkg HashFileFailureToRead, (msg::path), "Printed after ErrorMessage and before the specific failing filesystem operation (like file not found)", - "failed to read file '{path}' for hashing: "); + "failed to read file \"{path}\" for hashing: "); DECLARE_MESSAGE(HeaderOnlyUsage, (msg::package_name), "'header' refers to C/C++ .h files", @@ -1003,7 +1003,7 @@ namespace vcpkg DECLARE_MESSAGE(MsiexecFailedToExtract, (msg::path, msg::exit_code), "", - "msiexec failed while extracting '{path}' with launch or exit code {exit_code} and message:"); + "msiexec failed while extracting \"{path}\" with launch or exit code {exit_code} and message:"); DECLARE_MESSAGE(NoLocalizationForMessages, (), "", "No localized messages for the following: "); DECLARE_MESSAGE(NoRegistryForPort, (msg::package_name), "", "no registry configured for port {package_name}"); DECLARE_MESSAGE(PackingVendorFailed, @@ -1046,12 +1046,12 @@ namespace vcpkg DECLARE_MESSAGE(PushingVendorFailed, (msg::vendor, msg::path), "", - "Pushing {vendor} to '{path}' failed. Use --debug for more information."); + "Pushing {vendor} to \"{path}\" failed. Use --debug for more information."); DECLARE_MESSAGE(ReplaceSecretsError, (msg::error_msg), "", "Replace secretes produced the following error: '{error_msg}'"); - DECLARE_MESSAGE(RestoredPackage, (msg::path), "", "Restored package from '{path}'"); + DECLARE_MESSAGE(RestoredPackage, (msg::path), "", "Restored package from \"{path}\""); DECLARE_MESSAGE( RestoredPackagesFromVendor, (msg::count, msg::elapsed, msg::value), @@ -1069,7 +1069,7 @@ namespace vcpkg "'CONTROL', 'vcpkg.json', and 'name' references are locale-invariant.", "The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json " "file has the name {package_name} and does not match the port directory {path}."); - DECLARE_MESSAGE(StoredBinaryCache, (msg::path), "", "Stored binary cache: '{path}'"); + DECLARE_MESSAGE(StoredBinaryCache, (msg::path), "", "Stored binary cache: \"{path}\""); DECLARE_MESSAGE(SystemApiErrorMessage, (msg::system_api, msg::exit_code, msg::error_msg), "", @@ -1130,7 +1130,7 @@ namespace vcpkg DECLARE_MESSAGE(UpdateBaselineLocalGitError, (msg::path), "", - "git failed to parse HEAD for the local vcpkg registry at '{path}'"); + "git failed to parse HEAD for the local vcpkg registry at \"{path}\""); DECLARE_MESSAGE(UpdateBaselineNoConfiguration, (), "", @@ -1157,11 +1157,11 @@ namespace vcpkg DECLARE_MESSAGE(UploadingBinariesToVendor, (msg::spec, msg::vendor, msg::path), "", - "Uploading binaries for '{spec}' to '{vendor}' source '{path}'."); + "Uploading binaries for '{spec}' to '{vendor}' source \"{path}\"."); DECLARE_MESSAGE(UploadingBinariesUsingVendor, (msg::spec, msg::vendor, msg::path), "", - "Uploading binaries for '{spec}' using '{vendor}' '{path}'."); + "Uploading binaries for '{spec}' using '{vendor}' \"{path}\"."); DECLARE_MESSAGE(UseEnvVar, (msg::env_var), "An example of env_var is \"HTTP(S)_PROXY\"" diff --git a/locales/messages.en.json b/locales/messages.en.json index 5432cd26b8..96e408d3e5 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -127,7 +127,7 @@ "GitStatusUnknownFileStatus": "unknown file status: {value}", "GitUnexpectedCommandOutput": "unexpected git output", "GraphCycleDetected": "Cycle detected within graph at {package_name}:", - "HashFileFailureToRead": "failed to read file '{path}' for hashing: ", + "HashFileFailureToRead": "failed to read file \"{path}\" for hashing: ", "HeaderOnlyUsage": "{package_name} is header-only and can be used from CMake via:", "IllegalFeatures": "List of features is not allowed in this context", "IllegalPlatformSpec": "Platform qualifier is not allowed in this context", @@ -181,7 +181,7 @@ "LocalizedMessageMustNotContainIndents": "The message named {value} contains what appears to be indenting which must be changed to use LocalizedString::append_indent instead.", "LocalizedMessageMustNotEndWithNewline": "The message named {value} ends with a newline which should be added by formatting rather than by localization.", "MonoInstructions": "This may be caused by an incomplete mono installation. Full mono is available on some systems via `sudo apt install mono-complete`. Ubuntu 18.04 users may need a newer version of mono, available at https://www.mono-project.com/download/stable/", - "MsiexecFailedToExtract": "msiexec failed while extracting '{path}' with launch or exit code {exit_code} and message:", + "MsiexecFailedToExtract": "msiexec failed while extracting \"{path}\" with launch or exit code {exit_code} and message:", "NoLocalizationForMessages": "No localized messages for the following: ", "NoRegistryForPort": "no registry configured for port {package_name}", "NoteMessage": "note: ", @@ -196,16 +196,16 @@ "ProcessorArchitectureMissing": "The required environment variable %PROCESSOR_ARCHITECTURE% is missing.", "ProcessorArchitectureW6432Malformed": "Failed to parse %PROCESSOR_ARCHITEW6432% ({arch}) as a valid CPU architecture. Falling back to %PROCESSOR_ARCHITECTURE%.", "ProgramReturnedNonzeroExitCode": "{tool_name} failed with exit code: ({exit_code}).", - "PushingVendorFailed": "Pushing {vendor} to '{path}' failed. Use --debug for more information.", + "PushingVendorFailed": "Pushing {vendor} to \"{path}\" failed. Use --debug for more information.", "RemovingPackage": "Removing {action_index}/{count} {spec}", "ReplaceSecretsError": "Replace secretes produced the following error: '{error_msg}'", - "RestoredPackage": "Restored package from '{path}'", + "RestoredPackage": "Restored package from \"{path}\"", "RestoredPackagesFromVendor": "Restored {count} package(s) from {value} in {elapsed}. Use --debug to see more details.", "ResultsHeader": "RESULTS", "SeeURL": "See {url} for more information.", "SettingEnvVar": "-- Setting \"{env_var}\" environment variables to \"{url}\".", "SourceFieldPortNameMismatch": "The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json file has the name {package_name} and does not match the port directory {path}.", - "StoredBinaryCache": "Stored binary cache: '{path}'", + "StoredBinaryCache": "Stored binary cache: \"{path}\"", "SystemApiErrorMessage": "calling {system_api} failed with {exit_code} ({error_msg})", "ToolFetchFailed": "Could not fetch {tool_name}.", "ToolInWin10": "This utility is bundled with Windows 10 or later.", @@ -221,7 +221,7 @@ "UnsupportedSystemName": "Could not map VCPKG_CMAKE_SYSTEM_NAME '{system_name}' to a vcvarsall platform. Supported system names are '', 'Windows' and 'WindowsStore'.", "UnsupportedToolchain": "in triplet {triplet}: Unable to find a valid toolchain for requested target architecture {arch}.\nThe selected Visual Studio instance is at: {path}\nThe available toolchain combinations are: {list}", "UpdateBaselineAddBaselineNoManifest": "the --{option} switch was passed, but there is no manifest file to add a `builtin-baseline` field to.", - "UpdateBaselineLocalGitError": "git failed to parse HEAD for the local vcpkg registry at '{path}'", + "UpdateBaselineLocalGitError": "git failed to parse HEAD for the local vcpkg registry at \"{path}\"", "UpdateBaselineNoConfiguration": "neither `vcpkg.json` nor `vcpkg-configuration.json` exist to update.", "UpdateBaselineNoExistingBuiltinBaseline": "the manifest file currently does not contain a `builtin-baseline` field; in order to add one, pass the --{option} switch.", "UpdateBaselineNoUpdate": "registry '{url}' not updated: '{value}'", @@ -229,8 +229,8 @@ "UpdateBaselineUpdatedBaseline": "updated registry '{url}': baseline '{old_value}' -> '{new_value}'", "UploadedBinaries": "Uploaded binaries to {count} {vendor}.", "UploadedPackagesToVendor": "Uploaded {count} package(s) to {vendor} in {elapsed}", - "UploadingBinariesToVendor": "Uploading binaries for '{spec}' to '{vendor}' source '{path}'.", - "UploadingBinariesUsingVendor": "Uploading binaries for '{spec}' using '{vendor}' '{path}'.", + "UploadingBinariesToVendor": "Uploading binaries for '{spec}' to '{vendor}' source \"{path}\".", + "UploadingBinariesUsingVendor": "Uploading binaries for '{spec}' using '{vendor}' \"{path}\".", "UseEnvVar": "-- Using {env_var} in environment variables.", "UsingCommunityTriplet": "-- Using community triplet {triplet}. This triplet configuration is not guaranteed to succeed.", "UsingManifestAt": "Using manifest file at {path}.", diff --git a/locales/messages.json b/locales/messages.json index b6bcae0723..67fb88a0ac 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -224,7 +224,7 @@ "GitUnexpectedCommandOutput": "unexpected git output", "GraphCycleDetected": "Cycle detected within graph at {package_name}:", "_GraphCycleDetected.comment": "A list of package names comprising the cycle will be printed after this message. An example of {package_name} is zlib.", - "HashFileFailureToRead": "failed to read file '{path}' for hashing: ", + "HashFileFailureToRead": "failed to read file \"{path}\" for hashing: ", "_HashFileFailureToRead.comment": "Printed after ErrorMessage and before the specific failing filesystem operation (like file not found) An example of {path} is /foo/bar.", "HeaderOnlyUsage": "{package_name} is header-only and can be used from CMake via:", "_HeaderOnlyUsage.comment": "'header' refers to C/C++ .h files An example of {package_name} is zlib.", @@ -317,7 +317,7 @@ "LocalizedMessageMustNotEndWithNewline": "The message named {value} ends with a newline which should be added by formatting rather than by localization.", "_LocalizedMessageMustNotEndWithNewline.comment": "{value} is a localized message name like LocalizedMessageMustNotEndWithNewline", "MonoInstructions": "This may be caused by an incomplete mono installation. Full mono is available on some systems via `sudo apt install mono-complete`. Ubuntu 18.04 users may need a newer version of mono, available at https://www.mono-project.com/download/stable/", - "MsiexecFailedToExtract": "msiexec failed while extracting '{path}' with launch or exit code {exit_code} and message:", + "MsiexecFailedToExtract": "msiexec failed while extracting \"{path}\" with launch or exit code {exit_code} and message:", "_MsiexecFailedToExtract.comment": "An example of {path} is /foo/bar. An example of {exit_code} is 127.", "NoLocalizationForMessages": "No localized messages for the following: ", "NoRegistryForPort": "no registry configured for port {package_name}", @@ -341,13 +341,13 @@ "_ProcessorArchitectureW6432Malformed.comment": "An example of {arch} is x64.", "ProgramReturnedNonzeroExitCode": "{tool_name} failed with exit code: ({exit_code}).", "_ProgramReturnedNonzeroExitCode.comment": "The program's console output is appended after this. An example of {tool_name} is aria2. An example of {exit_code} is 127.", - "PushingVendorFailed": "Pushing {vendor} to '{path}' failed. Use --debug for more information.", + "PushingVendorFailed": "Pushing {vendor} to \"{path}\" failed. Use --debug for more information.", "_PushingVendorFailed.comment": "An example of {vendor} is Azure. An example of {path} is /foo/bar.", "RemovingPackage": "Removing {action_index}/{count} {spec}", "_RemovingPackage.comment": "An example of {action_index} is 340. An example of {count} is 42. An example of {spec} is zlib:x64-windows.", "ReplaceSecretsError": "Replace secretes produced the following error: '{error_msg}'", "_ReplaceSecretsError.comment": "An example of {error_msg} is File Not Found.", - "RestoredPackage": "Restored package from '{path}'", + "RestoredPackage": "Restored package from \"{path}\"", "_RestoredPackage.comment": "An example of {path} is /foo/bar.", "RestoredPackagesFromVendor": "Restored {count} package(s) from {value} in {elapsed}. Use --debug to see more details.", "_RestoredPackagesFromVendor.comment": "{value} may be either a 'vendor' like 'Azure' or 'NuGet', or a file path like C:\\example or /usr/example An example of {count} is 42. An example of {elapsed} is 3.532 min.", @@ -359,7 +359,7 @@ "_SettingEnvVar.comment": "An example of env_var is \"HTTP(S)_PROXY\"'--' at the beginning must be preserved An example of {env_var} is VCPKG_DEFAULT_TRIPLET. An example of {url} is https://github.com/microsoft/vcpkg.", "SourceFieldPortNameMismatch": "The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json file has the name {package_name} and does not match the port directory {path}.", "_SourceFieldPortNameMismatch.comment": "{package_name} and {path} are both names of installable ports/packages. 'Source', 'CONTROL', 'vcpkg.json', and 'name' references are locale-invariant. An example of {package_name} is zlib. An example of {path} is /foo/bar.", - "StoredBinaryCache": "Stored binary cache: '{path}'", + "StoredBinaryCache": "Stored binary cache: \"{path}\"", "_StoredBinaryCache.comment": "An example of {path} is /foo/bar.", "SystemApiErrorMessage": "calling {system_api} failed with {exit_code} ({error_msg})", "_SystemApiErrorMessage.comment": "An example of {system_api} is CreateProcessW. An example of {exit_code} is 127. An example of {error_msg} is File Not Found.", @@ -386,7 +386,7 @@ "_UnsupportedToolchain.comment": "example for {list} is 'x86, arm64' An example of {triplet} is x64-windows. An example of {arch} is x64. An example of {path} is /foo/bar.", "UpdateBaselineAddBaselineNoManifest": "the --{option} switch was passed, but there is no manifest file to add a `builtin-baseline` field to.", "_UpdateBaselineAddBaselineNoManifest.comment": "An example of {option} is editable.", - "UpdateBaselineLocalGitError": "git failed to parse HEAD for the local vcpkg registry at '{path}'", + "UpdateBaselineLocalGitError": "git failed to parse HEAD for the local vcpkg registry at \"{path}\"", "_UpdateBaselineLocalGitError.comment": "An example of {path} is /foo/bar.", "UpdateBaselineNoConfiguration": "neither `vcpkg.json` nor `vcpkg-configuration.json` exist to update.", "UpdateBaselineNoExistingBuiltinBaseline": "the manifest file currently does not contain a `builtin-baseline` field; in order to add one, pass the --{option} switch.", @@ -401,9 +401,9 @@ "_UploadedBinaries.comment": "An example of {count} is 42. An example of {vendor} is Azure.", "UploadedPackagesToVendor": "Uploaded {count} package(s) to {vendor} in {elapsed}", "_UploadedPackagesToVendor.comment": "An example of {count} is 42. An example of {elapsed} is 3.532 min. An example of {vendor} is Azure.", - "UploadingBinariesToVendor": "Uploading binaries for '{spec}' to '{vendor}' source '{path}'.", + "UploadingBinariesToVendor": "Uploading binaries for '{spec}' to '{vendor}' source \"{path}\".", "_UploadingBinariesToVendor.comment": "An example of {spec} is zlib:x64-windows. An example of {vendor} is Azure. An example of {path} is /foo/bar.", - "UploadingBinariesUsingVendor": "Uploading binaries for '{spec}' using '{vendor}' '{path}'.", + "UploadingBinariesUsingVendor": "Uploading binaries for '{spec}' using '{vendor}' \"{path}\".", "_UploadingBinariesUsingVendor.comment": "An example of {spec} is zlib:x64-windows. An example of {vendor} is Azure. An example of {path} is /foo/bar.", "UseEnvVar": "-- Using {env_var} in environment variables.", "_UseEnvVar.comment": "An example of env_var is \"HTTP(S)_PROXY\"'--' at the beginning must be preserved An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", diff --git a/src/vcpkg/commands.porthistory.cpp b/src/vcpkg/commands.porthistory.cpp index 3ab8b359cd..f74282d498 100644 --- a/src/vcpkg/commands.porthistory.cpp +++ b/src/vcpkg/commands.porthistory.cpp @@ -112,7 +112,7 @@ namespace vcpkg::Commands::PortHistory if (auto output = maybe_output.get()) { auto commits = Util::fmap( - Strings::split(*output, '\n'), [](const std::string& line) -> auto { + Strings::split(*output, '\n'), [](const std::string& line) -> auto{ auto parts = Strings::split(line, ' '); return std::make_pair(parts[0], parts[1]); }); diff --git a/src/vcpkg/registries.cpp b/src/vcpkg/registries.cpp index ab90bcd77a..f1388a0f2e 100644 --- a/src/vcpkg/registries.cpp +++ b/src/vcpkg/registries.cpp @@ -1186,7 +1186,7 @@ namespace vcpkg if (auto pversions = maybe_versions.get()) { return Util::fmap( - *pversions, [](auto&& entry) -> auto { + *pversions, [](auto&& entry) -> auto{ return std::make_pair(SchemedVersion{entry.scheme, entry.version}, entry.git_tree); }); } diff --git a/src/vcpkg/vcpkgpaths.cpp b/src/vcpkg/vcpkgpaths.cpp index c9dca0690b..bd5188a71e 100644 --- a/src/vcpkg/vcpkgpaths.cpp +++ b/src/vcpkg/vcpkgpaths.cpp @@ -877,7 +877,7 @@ namespace vcpkg const Path VcpkgPaths::get_triplet_file_path(Triplet triplet) const { return m_pimpl->m_triplets_cache.get_lazy( - triplet, [&]() -> auto { + triplet, [&]() -> auto{ for (const auto& triplet_dir : m_pimpl->triplets_dirs) { auto path = triplet_dir / (triplet.canonical_name() + ".cmake"); From 3beb0c76acf1a5cb417f54d1d161969f92a222be Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Fri, 15 Jul 2022 17:12:04 -0700 Subject: [PATCH 38/61] Split BinaryParagraphDescription to avoid re-useing replacement variables. --- include/vcpkg/base/messages.h | 45 +++++++++++++++++++++-------------- locales/messages.en.json | 10 +++++++- locales/messages.json | 20 ++++++++++++++-- src/vcpkg/base/messages.cpp | 10 +++++++- src/vcpkg/binaryparagraph.cpp | 44 ++++++++++++++++++---------------- 5 files changed, 86 insertions(+), 43 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index d4210348e1..1639566284 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -510,24 +510,33 @@ namespace vcpkg "An example of env_var is \"HTTP(S)_PROXY\"" "'--' at the beginning must be preserved", "-- Automatically setting {env_var} environment variables to \"{url}\"."); - DECLARE_MESSAGE( - BinaryParagraphDescription, - (msg::spec, - msg::version, - msg::version, - msg::value, - msg::value, - msg::value, - msg::value, - msg::value, - msg::value, - msg::value), - "['{value}'] is the paragraph description.\n['{value}'] is the paragraph's maintainers.\n'{value}' is the " - "paragraph's feature.\n['{value}'] is the paragraphs default_feature.\n['{value}'] is the paragraphs " - "dependencies.\n'{value}' is the paragraphs abi.\n'{value}' is the paragraphs type.", - "\nspec: '{spec}'\n\nversion: {version}\nport_version: {version}\ndescription: " - "['{value}']\nmaintainers: ['{value}']\nfeature: '{value}'\ndefault_feature: " - "['{value}']\ndependencies: ['{value}']\nabi: '{value}'\ntype: {value}"); + DECLARE_MESSAGE(BinParagraphPortVersion, (msg::version), "", "\nport_version: {version}"); + DECLARE_MESSAGE(BinParagraphDependencies, + (msg::value), + "'{value}' is the binary paragraph's dependencies.", + "\ndependencies: ['{value}']"); + DECLARE_MESSAGE(BinParagraphMaintainers, + (msg::value), + "'{value}' is the binary paragraph's maintainers.", + "\nmaintainers: ['{value}']"); + DECLARE_MESSAGE(BinParagraphDefaultFeature, + (msg::value), + "'{value}' is the binary paragraph's default feature.", + "\ndefault_feature: ['{value}']"); + DECLARE_MESSAGE(BinParagraphDescription, + (msg::value), + "'{value}' is the binary paragraph's description.", + "\ndescription: ['{value}']"); + DECLARE_MESSAGE(BinParagraphFeature, + (msg::value), + "'{value}' is the value of feature in the binary paragraph.", + "\nfeature: '{value}'"); + DECLARE_MESSAGE(BinParagraphAbi, + (msg::value), + "'{value}' is the value of abi in the binary paragraph.", + "\nabi: '{value}'"); + DECLARE_MESSAGE(BinParagraphType, (msg::value), "'{value}' is the binary paragraph type", "\ntype: '{value}'"); + DECLARE_MESSAGE(BinParagraphSpecAndVersion, (msg::spec, msg::version), "", "\nspec: '{spec}'\nversion: {version}"); DECLARE_MESSAGE(BuildAlreadyInstalled, (msg::spec), "", diff --git a/locales/messages.en.json b/locales/messages.en.json index 0c771b023f..956cd35c04 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -38,7 +38,15 @@ "AttemptingToFetchPackagesFromVendor": "Attempting to fetch {count} package(s) from {vendor}", "AuthenticationMayRequireManualAction": "One or more {vendor} credential providers requested manual action. Add the binary source 'interactive' to allow interactivity.", "AutoSettingEnvVar": "-- Automatically setting {env_var} environment variables to \"{url}\".", - "BinaryParagraphDescription": "\nspec: '{spec}'\n\nversion: {version}\nport_version: {version}\ndescription: ['{value}']\nmaintainers: ['{value}']\nfeature: '{value}'\ndefault_feature: ['{value}']\ndependencies: ['{value}']\nabi: '{value}'\ntype: {value}", + "BinParagraphAbi": "\nabi: '{value}'", + "BinParagraphDefaultFeature": "\ndefault_feature: ['{value}']", + "BinParagraphDependencies": "\ndependencies: ['{value}']", + "BinParagraphDescription": "\ndescription: ['{value}']", + "BinParagraphFeature": "\nfeature: '{value}'", + "BinParagraphMaintainers": "\nmaintainers: ['{value}']", + "BinParagraphPortVersion": "\nport_version: {version}", + "BinParagraphSpecAndVersion": "\nspec: '{spec}'\nversion: {version}", + "BinParagraphType": "\ntype: '{value}'", "BothYesAndNoOptionSpecifiedError": "cannot specify both --no-{option} and --{option}.", "BuildAlreadyInstalled": "{spec} is already installed; please remove {spec} before attempting to build it.", "BuildDependenciesMissing": "The build command requires all dependencies to be already installed.\nThe following dependencies are missing:", diff --git a/locales/messages.json b/locales/messages.json index 9df6c77951..728bc829ff 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -69,8 +69,24 @@ "_AuthenticationMayRequireManualAction.comment": "An example of {vendor} is Azure.", "AutoSettingEnvVar": "-- Automatically setting {env_var} environment variables to \"{url}\".", "_AutoSettingEnvVar.comment": "An example of env_var is \"HTTP(S)_PROXY\"'--' at the beginning must be preserved An example of {env_var} is VCPKG_DEFAULT_TRIPLET. An example of {url} is https://github.com/microsoft/vcpkg.", - "BinaryParagraphDescription": "\nspec: '{spec}'\n\nversion: {version}\nport_version: {version}\ndescription: ['{value}']\nmaintainers: ['{value}']\nfeature: '{value}'\ndefault_feature: ['{value}']\ndependencies: ['{value}']\nabi: '{value}'\ntype: {value}", - "_BinaryParagraphDescription.comment": "['{value}'] is the paragraph description.\n['{value}'] is the paragraph's maintainers.\n'{value}' is the paragraph's feature.\n['{value}'] is the paragraphs default_feature.\n['{value}'] is the paragraphs dependencies.\n'{value}' is the paragraphs abi.\n'{value}' is the paragraphs type. An example of {spec} is zlib:x64-windows. An example of {version} is 1.3.8. An example of {version} is 1.3.8.", + "BinParagraphAbi": "\nabi: '{value}'", + "_BinParagraphAbi.comment": "'{value}' is the value of abi in the binary paragraph.", + "BinParagraphDefaultFeature": "\ndefault_feature: ['{value}']", + "_BinParagraphDefaultFeature.comment": "'{value}' is the binary paragraph's default feature.", + "BinParagraphDependencies": "\ndependencies: ['{value}']", + "_BinParagraphDependencies.comment": "'{value}' is the binary paragraph's dependencies.", + "BinParagraphDescription": "\ndescription: ['{value}']", + "_BinParagraphDescription.comment": "'{value}' is the binary paragraph's description.", + "BinParagraphFeature": "\nfeature: '{value}'", + "_BinParagraphFeature.comment": "'{value}' is the value of feature in the binary paragraph.", + "BinParagraphMaintainers": "\nmaintainers: ['{value}']", + "_BinParagraphMaintainers.comment": "'{value}' is the binary paragraph's maintainers.", + "BinParagraphPortVersion": "\nport_version: {version}", + "_BinParagraphPortVersion.comment": "An example of {version} is 1.3.8.", + "BinParagraphSpecAndVersion": "\nspec: '{spec}'\nversion: {version}", + "_BinParagraphSpecAndVersion.comment": "An example of {spec} is zlib:x64-windows. An example of {version} is 1.3.8.", + "BinParagraphType": "\ntype: '{value}'", + "_BinParagraphType.comment": "'{value}' is the binary paragraph type", "BothYesAndNoOptionSpecifiedError": "cannot specify both --no-{option} and --{option}.", "_BothYesAndNoOptionSpecifiedError.comment": "An example of {option} is editable.", "BuildAlreadyInstalled": "{spec} is already installed; please remove {spec} before attempting to build it.", diff --git a/src/vcpkg/base/messages.cpp b/src/vcpkg/base/messages.cpp index 2cbea7ab09..14d517bda8 100644 --- a/src/vcpkg/base/messages.cpp +++ b/src/vcpkg/base/messages.cpp @@ -444,7 +444,6 @@ namespace vcpkg REGISTER_MESSAGE(AttemptingToFetchPackagesFromVendor); REGISTER_MESSAGE(AuthenticationMayRequireManualAction); REGISTER_MESSAGE(AutoSettingEnvVar); - REGISTER_MESSAGE(BinaryParagraphDescription); REGISTER_MESSAGE(BuildAlreadyInstalled); REGISTER_MESSAGE(BuildDependenciesMissing); REGISTER_MESSAGE(BuildingFromHead); @@ -652,4 +651,13 @@ namespace vcpkg REGISTER_MESSAGE(WaitingToTakeFilesystemLock); REGISTER_MESSAGE(WarningMessageMustUsePrintWarning); REGISTER_MESSAGE(WarningsTreatedAsErrors); + REGISTER_MESSAGE(BinParagraphPortVersion); + REGISTER_MESSAGE(BinParagraphDependencies); + REGISTER_MESSAGE(BinParagraphMaintainers); + REGISTER_MESSAGE(BinParagraphDefaultFeature); + REGISTER_MESSAGE(BinParagraphDescription); + REGISTER_MESSAGE(BinParagraphFeature); + REGISTER_MESSAGE(BinParagraphAbi); + REGISTER_MESSAGE(BinParagraphType); + REGISTER_MESSAGE(BinParagraphSpecAndVersion); } diff --git a/src/vcpkg/binaryparagraph.cpp b/src/vcpkg/binaryparagraph.cpp index 74d8bdd230..c738c99737 100644 --- a/src/vcpkg/binaryparagraph.cpp +++ b/src/vcpkg/binaryparagraph.cpp @@ -296,30 +296,32 @@ namespace vcpkg msg::format(msgMismatchedBinaryParagraphs, msg::url = "https://github.com/microsoft/vcpkg") .append_raw("\n") .append(msgOriginalBinaryParagraphHeader) - .append(msgBinaryParagraphDescription, - msg::spec = pgh.spec, - msg::version = pgh.version, - msg::version = pgh.port_version, - msg::value = Strings::join(join_str, pgh.description), - msg::value = Strings::join(join_str, pgh.maintainers), - msg::value = pgh.feature, - msg::value = Strings::join(join_str, pgh.default_features), - msg::value = Strings::join(join_str, pgh.dependencies), - msg::value = pgh.abi, - msg::value = Type::to_string(pgh.type)) + .append(msgBinParagraphSpecAndVersion, msg::spec = pgh.spec, msg::version = pgh.version) + .append(msgBinParagraphPortVersion, msg::version = pgh.port_version) + .append(msgBinParagraphDescription, msg::value = Strings::join(join_str, pgh.description)) + .append(msgBinParagraphMaintainers, msg::value = Strings::join(join_str, pgh.maintainers)) + .append(msgBinParagraphFeature, msg::value = pgh.feature) + .append(msgBinParagraphDefaultFeature, msg::value = Strings::join(join_str, pgh.default_features)) + .append(msgBinParagraphDependencies, msg::value = Strings::join(join_str, pgh.dependencies)) + .append(msgBinParagraphAbi, msg::value = pgh.abi) + .append(msgBinParagraphType, msg::value = Type::to_string(pgh.type)) .append_raw("\n") .append(msgSerializedBinaryParagraphHeader) - .append(msgBinaryParagraphDescription, + .append(msgBinParagraphSpecAndVersion, msg::spec = binary_paragraph.spec, - msg::version = binary_paragraph.version, - msg::version = binary_paragraph.port_version, - msg::value = Strings::join(join_str, binary_paragraph.description), - msg::value = Strings::join(join_str, binary_paragraph.maintainers), - msg::value = binary_paragraph.feature, - msg::value = Strings::join(join_str, binary_paragraph.default_features), - msg::value = Strings::join(join_str, binary_paragraph.dependencies), - msg::value = binary_paragraph.abi, - msg::value = Type::to_string(binary_paragraph.type))); + msg::version = binary_paragraph.version) + .append(msgBinParagraphPortVersion, msg::version = pgh.port_version) + .append(msgBinParagraphDescription, + msg::value = Strings::join(join_str, binary_paragraph.description)) + .append(msgBinParagraphMaintainers, + msg::value = Strings::join(join_str, binary_paragraph.maintainers)) + .append(msgBinParagraphFeature, msg::value = binary_paragraph.feature) + .append(msgBinParagraphDefaultFeature, + msg::value = Strings::join(join_str, binary_paragraph.default_features)) + .append(msgBinParagraphDependencies, + msg::value = Strings::join(join_str, binary_paragraph.dependencies)) + .append(msgBinParagraphAbi, msg::value = binary_paragraph.abi) + .append(msgBinParagraphType, msg::value = Type::to_string(binary_paragraph.type))); } } } From 9abcac5a3fba0618f433cce8066e21cbce28bb37 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Fri, 15 Jul 2022 17:13:45 -0700 Subject: [PATCH 39/61] Sorted messages --- include/vcpkg/base/messages.h | 24 ++++++++++++------------ src/vcpkg/base/messages.cpp | 18 +++++++++--------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index 1639566284..c17850b916 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -510,19 +510,18 @@ namespace vcpkg "An example of env_var is \"HTTP(S)_PROXY\"" "'--' at the beginning must be preserved", "-- Automatically setting {env_var} environment variables to \"{url}\"."); - DECLARE_MESSAGE(BinParagraphPortVersion, (msg::version), "", "\nport_version: {version}"); - DECLARE_MESSAGE(BinParagraphDependencies, - (msg::value), - "'{value}' is the binary paragraph's dependencies.", - "\ndependencies: ['{value}']"); - DECLARE_MESSAGE(BinParagraphMaintainers, + DECLARE_MESSAGE(BinParagraphAbi, (msg::value), - "'{value}' is the binary paragraph's maintainers.", - "\nmaintainers: ['{value}']"); + "'{value}' is the value of abi in the binary paragraph.", + "\nabi: '{value}'"); DECLARE_MESSAGE(BinParagraphDefaultFeature, (msg::value), "'{value}' is the binary paragraph's default feature.", "\ndefault_feature: ['{value}']"); + DECLARE_MESSAGE(BinParagraphDependencies, + (msg::value), + "'{value}' is the binary paragraph's dependencies.", + "\ndependencies: ['{value}']"); DECLARE_MESSAGE(BinParagraphDescription, (msg::value), "'{value}' is the binary paragraph's description.", @@ -531,12 +530,13 @@ namespace vcpkg (msg::value), "'{value}' is the value of feature in the binary paragraph.", "\nfeature: '{value}'"); - DECLARE_MESSAGE(BinParagraphAbi, + DECLARE_MESSAGE(BinParagraphMaintainers, (msg::value), - "'{value}' is the value of abi in the binary paragraph.", - "\nabi: '{value}'"); - DECLARE_MESSAGE(BinParagraphType, (msg::value), "'{value}' is the binary paragraph type", "\ntype: '{value}'"); + "'{value}' is the binary paragraph's maintainers.", + "\nmaintainers: ['{value}']"); + DECLARE_MESSAGE(BinParagraphPortVersion, (msg::version), "", "\nport_version: {version}"); DECLARE_MESSAGE(BinParagraphSpecAndVersion, (msg::spec, msg::version), "", "\nspec: '{spec}'\nversion: {version}"); + DECLARE_MESSAGE(BinParagraphType, (msg::value), "'{value}' is the binary paragraph type", "\ntype: '{value}'"); DECLARE_MESSAGE(BuildAlreadyInstalled, (msg::spec), "", diff --git a/src/vcpkg/base/messages.cpp b/src/vcpkg/base/messages.cpp index 14d517bda8..dd0efec479 100644 --- a/src/vcpkg/base/messages.cpp +++ b/src/vcpkg/base/messages.cpp @@ -444,6 +444,15 @@ namespace vcpkg REGISTER_MESSAGE(AttemptingToFetchPackagesFromVendor); REGISTER_MESSAGE(AuthenticationMayRequireManualAction); REGISTER_MESSAGE(AutoSettingEnvVar); + REGISTER_MESSAGE(BinParagraphAbi); + REGISTER_MESSAGE(BinParagraphDefaultFeature); + REGISTER_MESSAGE(BinParagraphDependencies); + REGISTER_MESSAGE(BinParagraphDescription); + REGISTER_MESSAGE(BinParagraphFeature); + REGISTER_MESSAGE(BinParagraphMaintainers); + REGISTER_MESSAGE(BinParagraphPortVersion); + REGISTER_MESSAGE(BinParagraphSpecAndVersion); + REGISTER_MESSAGE(BinParagraphType); REGISTER_MESSAGE(BuildAlreadyInstalled); REGISTER_MESSAGE(BuildDependenciesMissing); REGISTER_MESSAGE(BuildingFromHead); @@ -651,13 +660,4 @@ namespace vcpkg REGISTER_MESSAGE(WaitingToTakeFilesystemLock); REGISTER_MESSAGE(WarningMessageMustUsePrintWarning); REGISTER_MESSAGE(WarningsTreatedAsErrors); - REGISTER_MESSAGE(BinParagraphPortVersion); - REGISTER_MESSAGE(BinParagraphDependencies); - REGISTER_MESSAGE(BinParagraphMaintainers); - REGISTER_MESSAGE(BinParagraphDefaultFeature); - REGISTER_MESSAGE(BinParagraphDescription); - REGISTER_MESSAGE(BinParagraphFeature); - REGISTER_MESSAGE(BinParagraphAbi); - REGISTER_MESSAGE(BinParagraphType); - REGISTER_MESSAGE(BinParagraphSpecAndVersion); } From 1c96ade435ff6bf0cc773d89ba5c066c6932cc38 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Mon, 18 Jul 2022 12:32:23 -0700 Subject: [PATCH 40/61] Revert CMakeSettings.json --- CMakeSettings.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/CMakeSettings.json b/CMakeSettings.json index f3fc4a9557..255a15b1a9 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -30,11 +30,6 @@ "name": "VCPKG_BUILD_FUZZING", "value": "True", "type": "BOOL" - }, - { - "name": "CLANG_FORMAT", - "value": "C:/Program Files/LLVM/bin/clang-format.exe", - "type": "FILEPATH" } ] }, From 5791d4a13091aa66b78e9283c0a1168a4caee1dd Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Mon, 18 Jul 2022 12:32:53 -0700 Subject: [PATCH 41/61] Revert CMakeSettings --- CMakeSettings.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/CMakeSettings.json b/CMakeSettings.json index f3fc4a9557..255a15b1a9 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -30,11 +30,6 @@ "name": "VCPKG_BUILD_FUZZING", "value": "True", "type": "BOOL" - }, - { - "name": "CLANG_FORMAT", - "value": "C:/Program Files/LLVM/bin/clang-format.exe", - "type": "FILEPATH" } ] }, From bc747d640c5b18aedb7bd7e61f9c1ba4b786e9fb Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Mon, 18 Jul 2022 12:33:28 -0700 Subject: [PATCH 42/61] Revert CMakeSettings --- CMakeSettings.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/CMakeSettings.json b/CMakeSettings.json index f3fc4a9557..255a15b1a9 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -30,11 +30,6 @@ "name": "VCPKG_BUILD_FUZZING", "value": "True", "type": "BOOL" - }, - { - "name": "CLANG_FORMAT", - "value": "C:/Program Files/LLVM/bin/clang-format.exe", - "type": "FILEPATH" } ] }, From 78019b619250f2d25dfdd411d3abdc172f76bce7 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Mon, 18 Jul 2022 13:04:55 -0700 Subject: [PATCH 43/61] Response to PR feedback --- include/vcpkg/base/messages.h | 19 +++++++++---------- locales/messages.en.json | 3 +-- locales/messages.json | 10 ++++------ src/vcpkg/base/messages.cpp | 1 - src/vcpkg/build.cpp | 10 ++++------ 5 files changed, 18 insertions(+), 25 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index 548ae612be..b29947e2c7 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -741,7 +741,7 @@ namespace vcpkg "", "Visual Studio Code was not found and the environment variable {env_var} is not set or invalid."); DECLARE_MESSAGE(ErrorVsCodeNotFoundPathExamined, (), "", "The following paths were examined:"); - DECLARE_MESSAGE(ErrorWhileWriting, (msg::error_msg), "", "Error occured while writing {error_msg}"); + DECLARE_MESSAGE(ErrorWhileWriting, (msg::path), "", "Error occured while writing {path}"); DECLARE_MESSAGE(ExcludedPackage, (msg::spec), "", "Excluded {spec}"); DECLARE_MESSAGE( ExpectedCharacterHere, @@ -752,10 +752,6 @@ namespace vcpkg DECLARE_MESSAGE(ExpectedPortName, (), "", "expected a port name here"); DECLARE_MESSAGE(ExpectedTripletName, (), "", "expected a triplet name here"); DECLARE_MESSAGE(ExtendedDocumentationAtUrl, (msg::url), "", "Extended documentation available at '{url}'."); - DECLARE_MESSAGE(FailedToFindDependencyAbi, - (msg::old_value, msg::new_value), - "{old_value} is the old spec, {new_value} is the new spec.", - "Failed to find dependency abi for {old_value} -> {new_value}"); DECLARE_MESSAGE(FailedToProvisionCe, (), "", "Failed to provision vcpkg-ce."); DECLARE_MESSAGE(FailedToRunToolToDetermineVersion, (msg::tool_name, msg::path), @@ -895,10 +891,11 @@ namespace vcpkg (msg::actual), "{actual} is the provided format string", "invalid format string: {actual}"); - DECLARE_MESSAGE(InvalidLinkage, - (msg::system_name, msg::value), - "'{value}' is the linkage type.", - "Invalid {system_name} linkage type: [{value}]"); + DECLARE_MESSAGE( + InvalidLinkage, + (msg::system_name, msg::value), + "'{value}' is the linkage type vcpkg would did not understand. (Correct values would be static ofr dynamic)", + "Invalid {system_name} linkage type: [{value}]"); DECLARE_MESSAGE(JsonErrorFailedToParse, (msg::path), "", "failed to parse {path}:"); DECLARE_MESSAGE(JsonErrorFailedToRead, (msg::path, msg::error_msg), "", "failed to read {path}: {error_msg}"); DECLARE_MESSAGE(JsonErrorMustBeAnObject, (msg::path), "", "Expected {path} to be an object."); @@ -1099,7 +1096,9 @@ namespace vcpkg "'x-aws-config', 'http', and 'files'"); DECLARE_MESSAGE(UnknownPolicySetting, (msg::option, msg::value), - "'{value}' is the policy.", + "'{value}' is the policy in question. These are unlocalized names that ports use to control post " + "build checks. Some examples are VCPKG_POLICY_DLLS_WITHOUT_EXPORTS, " + "VCPKG_POLICY_MISMATCHED_NUMBER_OF_BINARIES, or VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT", "Unknown setting for policy '{value}': {option}"); DECLARE_MESSAGE(UnknownSettingForBuildType, (msg::option), diff --git a/locales/messages.en.json b/locales/messages.en.json index 96e408d3e5..6a8338866a 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -101,14 +101,13 @@ "ErrorVcvarsUnsupported": "in triplet {triplet}: Use of Visual Studio's Developer Prompt is unsupported on non-Windows hosts.\nDefine 'VCPKG_CMAKE_SYSTEM_NAME' or 'VCPKG_CHAINLOAD_TOOLCHAIN_FILE' in the triplet file.", "ErrorVsCodeNotFound": "Visual Studio Code was not found and the environment variable {env_var} is not set or invalid.", "ErrorVsCodeNotFoundPathExamined": "The following paths were examined:", - "ErrorWhileWriting": "Error occured while writing {error_msg}", + "ErrorWhileWriting": "Error occured while writing {path}", "ExcludedPackage": "Excluded {spec}", "ExpectedCharacterHere": "expected '{expected}' here", "ExpectedFailOrSkip": "expected 'fail', 'skip', or 'pass' here", "ExpectedPortName": "expected a port name here", "ExpectedTripletName": "expected a triplet name here", "ExtendedDocumentationAtUrl": "Extended documentation available at '{url}'.", - "FailedToFindDependencyAbi": "Failed to find dependency abi for {old_value} -> {new_value}", "FailedToProvisionCe": "Failed to provision vcpkg-ce.", "FailedToRunToolToDetermineVersion": "Failed to run {path} to determine the {tool_name} version.", "FailedToStoreBackToMirror": "failed to store back to mirror:", diff --git a/locales/messages.json b/locales/messages.json index 67fb88a0ac..fa1fd3dbe8 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -182,8 +182,8 @@ "ErrorVsCodeNotFound": "Visual Studio Code was not found and the environment variable {env_var} is not set or invalid.", "_ErrorVsCodeNotFound.comment": "An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", "ErrorVsCodeNotFoundPathExamined": "The following paths were examined:", - "ErrorWhileWriting": "Error occured while writing {error_msg}", - "_ErrorWhileWriting.comment": "An example of {error_msg} is File Not Found.", + "ErrorWhileWriting": "Error occured while writing {path}", + "_ErrorWhileWriting.comment": "An example of {path} is /foo/bar.", "ExcludedPackage": "Excluded {spec}", "_ExcludedPackage.comment": "An example of {spec} is zlib:x64-windows.", "ExpectedCharacterHere": "expected '{expected}' here", @@ -193,8 +193,6 @@ "ExpectedTripletName": "expected a triplet name here", "ExtendedDocumentationAtUrl": "Extended documentation available at '{url}'.", "_ExtendedDocumentationAtUrl.comment": "An example of {url} is https://github.com/microsoft/vcpkg.", - "FailedToFindDependencyAbi": "Failed to find dependency abi for {old_value} -> {new_value}", - "_FailedToFindDependencyAbi.comment": "{old_value} is the old spec, {new_value} is the new spec.", "FailedToProvisionCe": "Failed to provision vcpkg-ce.", "FailedToRunToolToDetermineVersion": "Failed to run {path} to determine the {tool_name} version.", "_FailedToRunToolToDetermineVersion.comment": "Additional information, such as the command line output, if any, will be appended on the line after this message An example of {tool_name} is aria2. An example of {path} is /foo/bar.", @@ -273,7 +271,7 @@ "InvalidFormatString": "invalid format string: {actual}", "_InvalidFormatString.comment": "{actual} is the provided format string", "InvalidLinkage": "Invalid {system_name} linkage type: [{value}]", - "_InvalidLinkage.comment": "'{value}' is the linkage type. An example of {system_name} is Darwin.", + "_InvalidLinkage.comment": "'{value}' is the linkage type vcpkg would did not understand. (Correct values would be static ofr dynamic) An example of {system_name} is Darwin.", "JsonErrorFailedToParse": "failed to parse {path}:", "_JsonErrorFailedToParse.comment": "An example of {path} is /foo/bar.", "JsonErrorFailedToRead": "failed to read {path}: {error_msg}", @@ -374,7 +372,7 @@ "UnknownBaselineFileContent": "unrecognizable baseline entry; expected 'port:triplet=(fail|skip|pass)'", "UnknownBinaryProviderType": "unknown binary provider type: valid providers are 'clear', 'default', 'nuget', 'nugetconfig','nugettimeout', 'interactive', 'x-azblob', 'x-gcs', 'x-aws', 'x-aws-config', 'http', and 'files'", "UnknownPolicySetting": "Unknown setting for policy '{value}': {option}", - "_UnknownPolicySetting.comment": "'{value}' is the policy. An example of {option} is editable.", + "_UnknownPolicySetting.comment": "'{value}' is the policy in question. These are unlocalized names that ports use to control post build checks. Some examples are VCPKG_POLICY_DLLS_WITHOUT_EXPORTS, VCPKG_POLICY_MISMATCHED_NUMBER_OF_BINARIES, or VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT An example of {option} is editable.", "UnknownSettingForBuildType": "Unknown setting for VCPKG_BUILD_TYPE {option}. Valid settings are '', 'debug', and 'release'.", "_UnknownSettingForBuildType.comment": "An example of {option} is editable.", "UnknownTool": "vcpkg does not have a definition of this tool for this platform.", diff --git a/src/vcpkg/base/messages.cpp b/src/vcpkg/base/messages.cpp index 923090f734..702701a3bc 100644 --- a/src/vcpkg/base/messages.cpp +++ b/src/vcpkg/base/messages.cpp @@ -511,7 +511,6 @@ namespace vcpkg REGISTER_MESSAGE(ExpectedPortName); REGISTER_MESSAGE(ExpectedTripletName); REGISTER_MESSAGE(ExtendedDocumentationAtUrl); - REGISTER_MESSAGE(FailedToFindDependencyAbi); REGISTER_MESSAGE(FailedToProvisionCe); REGISTER_MESSAGE(FailedToRunToolToDetermineVersion); REGISTER_MESSAGE(FailedToStoreBackToMirror); diff --git a/src/vcpkg/build.cpp b/src/vcpkg/build.cpp index c0020491da..22e8940060 100644 --- a/src/vcpkg/build.cpp +++ b/src/vcpkg/build.cpp @@ -678,7 +678,7 @@ namespace vcpkg Checks::msg_check_exit(VCPKG_LINE_INFO, out_file.write(buf.c_str() + old_buf_size, 1, write_size) == write_size, msgErrorWhileWriting, - msg::error_msg = stdoutlog); + msg::path = stdoutlog); }, default_working_directory, env); @@ -917,7 +917,7 @@ namespace vcpkg Checks::msg_check_exit(VCPKG_LINE_INFO, out_file.write(sv.data(), 1, sv.size()) == sv.size(), msgErrorWhileWriting, - msg::error_msg = stdoutlog); + msg::path = stdoutlog); }, default_working_directory, env); @@ -1226,10 +1226,8 @@ namespace vcpkg auto status_it = status_db.find(pspec); if (status_it == status_db.end()) { - Checks::msg_exit_maybe_upgrade(VCPKG_LINE_INFO, - msgFailedToFindDependencyAbi, - msg::old_value = action.spec, - msg::new_value = pspec); + Debug::println("Failed to find dependency abi for %s -> %s", action.spec, pspec); + Checks::unreachable(VCPKG_LINE_INFO); } dependency_abis.emplace_back(AbiEntry{pspec.name(), status_it->get()->package.abi}); From dcc61b46a5a1c6c86e0773e638707d35025b830e Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Tue, 19 Jul 2022 10:37:27 -0700 Subject: [PATCH 44/61] Removed BinParagraph messages --- include/vcpkg/base/messages.h | 35 ---------------- locales/messages.en.json | 11 ----- locales/messages.json | 22 ---------- src/vcpkg/base/messages.cpp | 11 ----- src/vcpkg/binaryparagraph.cpp | 78 +++++++++++++++++++++-------------- 5 files changed, 48 insertions(+), 109 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index c17850b916..86063296f5 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -510,33 +510,6 @@ namespace vcpkg "An example of env_var is \"HTTP(S)_PROXY\"" "'--' at the beginning must be preserved", "-- Automatically setting {env_var} environment variables to \"{url}\"."); - DECLARE_MESSAGE(BinParagraphAbi, - (msg::value), - "'{value}' is the value of abi in the binary paragraph.", - "\nabi: '{value}'"); - DECLARE_MESSAGE(BinParagraphDefaultFeature, - (msg::value), - "'{value}' is the binary paragraph's default feature.", - "\ndefault_feature: ['{value}']"); - DECLARE_MESSAGE(BinParagraphDependencies, - (msg::value), - "'{value}' is the binary paragraph's dependencies.", - "\ndependencies: ['{value}']"); - DECLARE_MESSAGE(BinParagraphDescription, - (msg::value), - "'{value}' is the binary paragraph's description.", - "\ndescription: ['{value}']"); - DECLARE_MESSAGE(BinParagraphFeature, - (msg::value), - "'{value}' is the value of feature in the binary paragraph.", - "\nfeature: '{value}'"); - DECLARE_MESSAGE(BinParagraphMaintainers, - (msg::value), - "'{value}' is the binary paragraph's maintainers.", - "\nmaintainers: ['{value}']"); - DECLARE_MESSAGE(BinParagraphPortVersion, (msg::version), "", "\nport_version: {version}"); - DECLARE_MESSAGE(BinParagraphSpecAndVersion, (msg::spec, msg::version), "", "\nspec: '{spec}'\nversion: {version}"); - DECLARE_MESSAGE(BinParagraphType, (msg::value), "'{value}' is the binary paragraph type", "\ntype: '{value}'"); DECLARE_MESSAGE(BuildAlreadyInstalled, (msg::spec), "", @@ -1044,10 +1017,6 @@ namespace vcpkg DECLARE_MESSAGE(MultiArch, (msg::option), "", "Multi-Arch must be 'same' but was {option}"); DECLARE_MESSAGE(NoLocalizationForMessages, (), "", "No localized messages for the following: "); DECLARE_MESSAGE(NoRegistryForPort, (msg::package_name), "", "no registry configured for port {package_name}"); - DECLARE_MESSAGE(OriginalBinaryParagraphHeader, - (), - "The binary paragraph description is expected after this.", - "\n=== Original Binary Paragraph ==="); DECLARE_MESSAGE(PackingVendorFailed, (msg::vendor), "", @@ -1100,10 +1069,6 @@ namespace vcpkg "{value} may be either a 'vendor' like 'Azure' or 'NuGet', or a file path like C:\\example or /usr/example", "Restored {count} package(s) from {value} in {elapsed}. Use --debug to see more details."); DECLARE_MESSAGE(ResultsHeader, (), "Displayed before a list of installation results.", "RESULTS"); - DECLARE_MESSAGE(SerializedBinaryParagraphHeader, - (), - "The binary paragraph description is expected after this.", - "\n=== Serialized Binary Paragraph ==="); DECLARE_MESSAGE(SettingEnvVar, (msg::env_var, msg::url), "An example of env_var is \"HTTP(S)_PROXY\"" diff --git a/locales/messages.en.json b/locales/messages.en.json index 956cd35c04..9fa9d39770 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -38,15 +38,6 @@ "AttemptingToFetchPackagesFromVendor": "Attempting to fetch {count} package(s) from {vendor}", "AuthenticationMayRequireManualAction": "One or more {vendor} credential providers requested manual action. Add the binary source 'interactive' to allow interactivity.", "AutoSettingEnvVar": "-- Automatically setting {env_var} environment variables to \"{url}\".", - "BinParagraphAbi": "\nabi: '{value}'", - "BinParagraphDefaultFeature": "\ndefault_feature: ['{value}']", - "BinParagraphDependencies": "\ndependencies: ['{value}']", - "BinParagraphDescription": "\ndescription: ['{value}']", - "BinParagraphFeature": "\nfeature: '{value}'", - "BinParagraphMaintainers": "\nmaintainers: ['{value}']", - "BinParagraphPortVersion": "\nport_version: {version}", - "BinParagraphSpecAndVersion": "\nspec: '{spec}'\nversion: {version}", - "BinParagraphType": "\ntype: '{value}'", "BothYesAndNoOptionSpecifiedError": "cannot specify both --no-{option} and --{option}.", "BuildAlreadyInstalled": "{spec} is already installed; please remove {spec} before attempting to build it.", "BuildDependenciesMissing": "The build command requires all dependencies to be already installed.\nThe following dependencies are missing:", @@ -196,7 +187,6 @@ "NoLocalizationForMessages": "No localized messages for the following: ", "NoRegistryForPort": "no registry configured for port {package_name}", "NoteMessage": "note: ", - "OriginalBinaryParagraphHeader": "\n=== Original Binary Paragraph ===", "PackingVendorFailed": "Packing {vendor} failed. Use --debug for more information.", "ParseControlErrorInfoInvalidFields": "The following fields were not expected:", "ParseControlErrorInfoMissingFields": "The following fields were missing:", @@ -215,7 +205,6 @@ "RestoredPackagesFromVendor": "Restored {count} package(s) from {value} in {elapsed}. Use --debug to see more details.", "ResultsHeader": "RESULTS", "SeeURL": "See {url} for more information.", - "SerializedBinaryParagraphHeader": "\n=== Serialized Binary Paragraph ===", "SettingEnvVar": "-- Setting \"{env_var}\" environment variables to \"{url}\".", "SourceFieldPortNameMismatch": "The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json file has the name {package_name} and does not match the port directory {path}.", "StoredBinaryCache": "Stored binary cache: \"{path}\"", diff --git a/locales/messages.json b/locales/messages.json index 728bc829ff..267db0f6db 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -69,24 +69,6 @@ "_AuthenticationMayRequireManualAction.comment": "An example of {vendor} is Azure.", "AutoSettingEnvVar": "-- Automatically setting {env_var} environment variables to \"{url}\".", "_AutoSettingEnvVar.comment": "An example of env_var is \"HTTP(S)_PROXY\"'--' at the beginning must be preserved An example of {env_var} is VCPKG_DEFAULT_TRIPLET. An example of {url} is https://github.com/microsoft/vcpkg.", - "BinParagraphAbi": "\nabi: '{value}'", - "_BinParagraphAbi.comment": "'{value}' is the value of abi in the binary paragraph.", - "BinParagraphDefaultFeature": "\ndefault_feature: ['{value}']", - "_BinParagraphDefaultFeature.comment": "'{value}' is the binary paragraph's default feature.", - "BinParagraphDependencies": "\ndependencies: ['{value}']", - "_BinParagraphDependencies.comment": "'{value}' is the binary paragraph's dependencies.", - "BinParagraphDescription": "\ndescription: ['{value}']", - "_BinParagraphDescription.comment": "'{value}' is the binary paragraph's description.", - "BinParagraphFeature": "\nfeature: '{value}'", - "_BinParagraphFeature.comment": "'{value}' is the value of feature in the binary paragraph.", - "BinParagraphMaintainers": "\nmaintainers: ['{value}']", - "_BinParagraphMaintainers.comment": "'{value}' is the binary paragraph's maintainers.", - "BinParagraphPortVersion": "\nport_version: {version}", - "_BinParagraphPortVersion.comment": "An example of {version} is 1.3.8.", - "BinParagraphSpecAndVersion": "\nspec: '{spec}'\nversion: {version}", - "_BinParagraphSpecAndVersion.comment": "An example of {spec} is zlib:x64-windows. An example of {version} is 1.3.8.", - "BinParagraphType": "\ntype: '{value}'", - "_BinParagraphType.comment": "'{value}' is the binary paragraph type", "BothYesAndNoOptionSpecifiedError": "cannot specify both --no-{option} and --{option}.", "_BothYesAndNoOptionSpecifiedError.comment": "An example of {option} is editable.", "BuildAlreadyInstalled": "{spec} is already installed; please remove {spec} before attempting to build it.", @@ -344,8 +326,6 @@ "NoRegistryForPort": "no registry configured for port {package_name}", "_NoRegistryForPort.comment": "An example of {package_name} is zlib.", "NoteMessage": "note: ", - "OriginalBinaryParagraphHeader": "\n=== Original Binary Paragraph ===", - "_OriginalBinaryParagraphHeader.comment": "The binary paragraph description is expected after this.", "PackingVendorFailed": "Packing {vendor} failed. Use --debug for more information.", "_PackingVendorFailed.comment": "An example of {vendor} is Azure.", "ParseControlErrorInfoInvalidFields": "The following fields were not expected:", @@ -378,8 +358,6 @@ "_ResultsHeader.comment": "Displayed before a list of installation results.", "SeeURL": "See {url} for more information.", "_SeeURL.comment": "An example of {url} is https://github.com/microsoft/vcpkg.", - "SerializedBinaryParagraphHeader": "\n=== Serialized Binary Paragraph ===", - "_SerializedBinaryParagraphHeader.comment": "The binary paragraph description is expected after this.", "SettingEnvVar": "-- Setting \"{env_var}\" environment variables to \"{url}\".", "_SettingEnvVar.comment": "An example of env_var is \"HTTP(S)_PROXY\"'--' at the beginning must be preserved An example of {env_var} is VCPKG_DEFAULT_TRIPLET. An example of {url} is https://github.com/microsoft/vcpkg.", "SourceFieldPortNameMismatch": "The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json file has the name {package_name} and does not match the port directory {path}.", diff --git a/src/vcpkg/base/messages.cpp b/src/vcpkg/base/messages.cpp index dd0efec479..beee73e19f 100644 --- a/src/vcpkg/base/messages.cpp +++ b/src/vcpkg/base/messages.cpp @@ -444,15 +444,6 @@ namespace vcpkg REGISTER_MESSAGE(AttemptingToFetchPackagesFromVendor); REGISTER_MESSAGE(AuthenticationMayRequireManualAction); REGISTER_MESSAGE(AutoSettingEnvVar); - REGISTER_MESSAGE(BinParagraphAbi); - REGISTER_MESSAGE(BinParagraphDefaultFeature); - REGISTER_MESSAGE(BinParagraphDependencies); - REGISTER_MESSAGE(BinParagraphDescription); - REGISTER_MESSAGE(BinParagraphFeature); - REGISTER_MESSAGE(BinParagraphMaintainers); - REGISTER_MESSAGE(BinParagraphPortVersion); - REGISTER_MESSAGE(BinParagraphSpecAndVersion); - REGISTER_MESSAGE(BinParagraphType); REGISTER_MESSAGE(BuildAlreadyInstalled); REGISTER_MESSAGE(BuildDependenciesMissing); REGISTER_MESSAGE(BuildingFromHead); @@ -595,7 +586,6 @@ namespace vcpkg REGISTER_MESSAGE(MultiArch); REGISTER_MESSAGE(NoLocalizationForMessages); REGISTER_MESSAGE(NoRegistryForPort); - REGISTER_MESSAGE(OriginalBinaryParagraphHeader); REGISTER_MESSAGE(PackingVendorFailed); REGISTER_MESSAGE(ParseControlErrorInfoInvalidFields); REGISTER_MESSAGE(ParseControlErrorInfoMissingFields); @@ -612,7 +602,6 @@ namespace vcpkg REGISTER_MESSAGE(RestoredPackage); REGISTER_MESSAGE(RestoredPackagesFromVendor); REGISTER_MESSAGE(ResultsHeader); - REGISTER_MESSAGE(SerializedBinaryParagraphHeader); REGISTER_MESSAGE(SettingEnvVar); REGISTER_MESSAGE(SourceFieldPortNameMismatch); REGISTER_MESSAGE(StoredBinaryCache); diff --git a/src/vcpkg/binaryparagraph.cpp b/src/vcpkg/binaryparagraph.cpp index c738c99737..28f808fdae 100644 --- a/src/vcpkg/binaryparagraph.cpp +++ b/src/vcpkg/binaryparagraph.cpp @@ -291,37 +291,55 @@ namespace vcpkg if (binary_paragraph != pgh) { const auto& join_str = R"(", ")"; - Checks::msg_exit_maybe_upgrade( + Checks::exit_maybe_upgrade( VCPKG_LINE_INFO, - msg::format(msgMismatchedBinaryParagraphs, msg::url = "https://github.com/microsoft/vcpkg") - .append_raw("\n") - .append(msgOriginalBinaryParagraphHeader) - .append(msgBinParagraphSpecAndVersion, msg::spec = pgh.spec, msg::version = pgh.version) - .append(msgBinParagraphPortVersion, msg::version = pgh.port_version) - .append(msgBinParagraphDescription, msg::value = Strings::join(join_str, pgh.description)) - .append(msgBinParagraphMaintainers, msg::value = Strings::join(join_str, pgh.maintainers)) - .append(msgBinParagraphFeature, msg::value = pgh.feature) - .append(msgBinParagraphDefaultFeature, msg::value = Strings::join(join_str, pgh.default_features)) - .append(msgBinParagraphDependencies, msg::value = Strings::join(join_str, pgh.dependencies)) - .append(msgBinParagraphAbi, msg::value = pgh.abi) - .append(msgBinParagraphType, msg::value = Type::to_string(pgh.type)) - .append_raw("\n") - .append(msgSerializedBinaryParagraphHeader) - .append(msgBinParagraphSpecAndVersion, - msg::spec = binary_paragraph.spec, - msg::version = binary_paragraph.version) - .append(msgBinParagraphPortVersion, msg::version = pgh.port_version) - .append(msgBinParagraphDescription, - msg::value = Strings::join(join_str, binary_paragraph.description)) - .append(msgBinParagraphMaintainers, - msg::value = Strings::join(join_str, binary_paragraph.maintainers)) - .append(msgBinParagraphFeature, msg::value = binary_paragraph.feature) - .append(msgBinParagraphDefaultFeature, - msg::value = Strings::join(join_str, binary_paragraph.default_features)) - .append(msgBinParagraphDependencies, - msg::value = Strings::join(join_str, binary_paragraph.dependencies)) - .append(msgBinParagraphAbi, msg::value = binary_paragraph.abi) - .append(msgBinParagraphType, msg::value = Type::to_string(binary_paragraph.type))); + R"([sanity check] The serialized binary paragraph was different from the original binary paragraph. +Please open an issue at https://github.com/microsoft/vcpkg, with the following output: + +=== Original BinaryParagraph === +spec: "%s" +version: "%s" +port_version: %d +description: ["%s"] +maintainers: ["%s"] +feature: "%s" +default_features: ["%s"] +dependencies: ["%s"] +abi: "%s" +type: %s + +=== Serialized BinaryParagraph === +spec: "%s" +version: "%s" +port_version: %d +description: ["%s"] +maintainers: ["%s"] +feature: "%s" +default_features: ["%s"] +dependencies: ["%s"] +abi: "%s" +type: %s +)", + pgh.spec.to_string(), + pgh.version, + pgh.port_version, + Strings::join(join_str, pgh.description), + Strings::join(join_str, pgh.maintainers), + pgh.feature, + Strings::join(join_str, pgh.default_features), + Strings::join(join_str, pgh.dependencies), + pgh.abi, + Type::to_string(pgh.type), + binary_paragraph.spec.to_string(), + binary_paragraph.version, + binary_paragraph.port_version, + Strings::join(join_str, binary_paragraph.description), + Strings::join(join_str, binary_paragraph.maintainers), + binary_paragraph.feature, + Strings::join(join_str, binary_paragraph.default_features), + Strings::join(join_str, binary_paragraph.dependencies), + binary_paragraph.abi, + Type::to_string(binary_paragraph.type)); } } } From 27812b21569207ea4e85f0ceb60321b3ed0f488f Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Tue, 19 Jul 2022 10:46:39 -0700 Subject: [PATCH 45/61] Response to feedback - removed replacement varible {url} from FailedToParseBinParagraph - removed formatting from FailedToParseBinParagraph - changed replacement variable in ErrorWhileParsing {value} -> {path} --- include/vcpkg/base/messages.h | 12 +++++------- locales/messages.en.json | 4 ++-- locales/messages.json | 8 ++++---- src/vcpkg/binaryparagraph.cpp | 1 - src/vcpkg/sourceparagraph.cpp | 2 +- 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index 86063296f5..da1346f92f 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -742,10 +742,7 @@ namespace vcpkg "", "Visual Studio Code was not found and the environment variable {env_var} is not set or invalid."); DECLARE_MESSAGE(ErrorVsCodeNotFoundPathExamined, (), "", "The following paths were examined:"); - DECLARE_MESSAGE(ErrorWhileParsing, - (msg::value), - "'{value}' is the file name.", - "Errors occurred while parsing '{value}'."); + DECLARE_MESSAGE(ErrorWhileParsing, (msg::path), "", "Errors occurred while parsing {path}."); DECLARE_MESSAGE(ExcludedPackage, (msg::spec), "", "Excluded {spec}"); DECLARE_MESSAGE( ExpectedCharacterHere, @@ -757,11 +754,12 @@ namespace vcpkg DECLARE_MESSAGE(ExpectedTripletName, (), "", "expected a triplet name here"); DECLARE_MESSAGE(ExtendedDocumentationAtUrl, (msg::url), "", "Extended documentation available at '{url}'."); DECLARE_MESSAGE(FailedToParseBinParagraph, - (msg::url, msg::error_msg, msg::value), + (msg::error_msg, msg::value), "'{error_msg}' is the error message for failing to parse the Binary Paragraph, '{value}' is the " "Binary Paragraph", - "[sanity check] Failed to parse a serialized binary paragraph.\nPlease open an issue at {url}, " - "with the following output:\n{error_msg}\n=== Serialized BinaryParagraph ===\n{value}"); + "[sanity check] Failed to parse a serialized binary paragraph.\nPlease open an issue at " + "https://github.com/microsoft/vcpkg, " + "with the following output:\n{error_msg}\nSerialized Binary Paragraph: \n{value}"); DECLARE_MESSAGE(FailedToProvisionCe, (), "", "Failed to provision vcpkg-ce."); DECLARE_MESSAGE(FailedToRunToolToDetermineVersion, (msg::tool_name, msg::path), diff --git a/locales/messages.en.json b/locales/messages.en.json index 9fa9d39770..2ec78dc02f 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -102,14 +102,14 @@ "ErrorVcvarsUnsupported": "in triplet {triplet}: Use of Visual Studio's Developer Prompt is unsupported on non-Windows hosts.\nDefine 'VCPKG_CMAKE_SYSTEM_NAME' or 'VCPKG_CHAINLOAD_TOOLCHAIN_FILE' in the triplet file.", "ErrorVsCodeNotFound": "Visual Studio Code was not found and the environment variable {env_var} is not set or invalid.", "ErrorVsCodeNotFoundPathExamined": "The following paths were examined:", - "ErrorWhileParsing": "Errors occurred while parsing '{value}'.", + "ErrorWhileParsing": "Errors occurred while parsing {path}.", "ExcludedPackage": "Excluded {spec}", "ExpectedCharacterHere": "expected '{expected}' here", "ExpectedFailOrSkip": "expected 'fail', 'skip', or 'pass' here", "ExpectedPortName": "expected a port name here", "ExpectedTripletName": "expected a triplet name here", "ExtendedDocumentationAtUrl": "Extended documentation available at '{url}'.", - "FailedToParseBinParagraph": "[sanity check] Failed to parse a serialized binary paragraph.\nPlease open an issue at {url}, with the following output:\n{error_msg}\n=== Serialized BinaryParagraph ===\n{value}", + "FailedToParseBinParagraph": "[sanity check] Failed to parse a serialized binary paragraph.\nPlease open an issue at https://github.com/microsoft/vcpkg, with the following output:\n{error_msg}\nSerialized Binary Paragraph: \n{value}", "FailedToProvisionCe": "Failed to provision vcpkg-ce.", "FailedToRunToolToDetermineVersion": "Failed to run {path} to determine the {tool_name} version.", "FailedToStoreBackToMirror": "failed to store back to mirror:", diff --git a/locales/messages.json b/locales/messages.json index 267db0f6db..e7d8a72f0f 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -184,8 +184,8 @@ "ErrorVsCodeNotFound": "Visual Studio Code was not found and the environment variable {env_var} is not set or invalid.", "_ErrorVsCodeNotFound.comment": "An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", "ErrorVsCodeNotFoundPathExamined": "The following paths were examined:", - "ErrorWhileParsing": "Errors occurred while parsing '{value}'.", - "_ErrorWhileParsing.comment": "'{value}' is the file name.", + "ErrorWhileParsing": "Errors occurred while parsing {path}.", + "_ErrorWhileParsing.comment": "An example of {path} is /foo/bar.", "ExcludedPackage": "Excluded {spec}", "_ExcludedPackage.comment": "An example of {spec} is zlib:x64-windows.", "ExpectedCharacterHere": "expected '{expected}' here", @@ -195,8 +195,8 @@ "ExpectedTripletName": "expected a triplet name here", "ExtendedDocumentationAtUrl": "Extended documentation available at '{url}'.", "_ExtendedDocumentationAtUrl.comment": "An example of {url} is https://github.com/microsoft/vcpkg.", - "FailedToParseBinParagraph": "[sanity check] Failed to parse a serialized binary paragraph.\nPlease open an issue at {url}, with the following output:\n{error_msg}\n=== Serialized BinaryParagraph ===\n{value}", - "_FailedToParseBinParagraph.comment": "'{error_msg}' is the error message for failing to parse the Binary Paragraph, '{value}' is the Binary Paragraph An example of {url} is https://github.com/microsoft/vcpkg. An example of {error_msg} is File Not Found.", + "FailedToParseBinParagraph": "[sanity check] Failed to parse a serialized binary paragraph.\nPlease open an issue at https://github.com/microsoft/vcpkg, with the following output:\n{error_msg}\nSerialized Binary Paragraph: \n{value}", + "_FailedToParseBinParagraph.comment": "'{error_msg}' is the error message for failing to parse the Binary Paragraph, '{value}' is the Binary Paragraph An example of {error_msg} is File Not Found.", "FailedToProvisionCe": "Failed to provision vcpkg-ce.", "FailedToRunToolToDetermineVersion": "Failed to run {path} to determine the {tool_name} version.", "_FailedToRunToolToDetermineVersion.comment": "Additional information, such as the command line output, if any, will be appended on the line after this message An example of {tool_name} is aria2. An example of {path} is /foo/bar.", diff --git a/src/vcpkg/binaryparagraph.cpp b/src/vcpkg/binaryparagraph.cpp index 28f808fdae..595765c9b2 100644 --- a/src/vcpkg/binaryparagraph.cpp +++ b/src/vcpkg/binaryparagraph.cpp @@ -282,7 +282,6 @@ namespace vcpkg { Checks::msg_exit_maybe_upgrade(VCPKG_LINE_INFO, msgFailedToParseBinParagraph, - msg::url = "https://github.com/microsoft/vcpkg", msg::error_msg = parsed_paragraph.error(), msg ::value = my_paragraph); } diff --git a/src/vcpkg/sourceparagraph.cpp b/src/vcpkg/sourceparagraph.cpp index 896ea80b67..477ef4a3d6 100644 --- a/src/vcpkg/sourceparagraph.cpp +++ b/src/vcpkg/sourceparagraph.cpp @@ -1613,7 +1613,7 @@ namespace vcpkg auto maybe_configuration = reader.visit(*configuration, get_configuration_deserializer()); if (!reader.errors().empty()) { - msg::println_error(msgErrorWhileParsing, msg::value = ManifestDeserializer::VCPKG_CONFIGURATION); + msg::println_error(msgErrorWhileParsing, msg::path = ManifestDeserializer::VCPKG_CONFIGURATION); for (auto&& msg : reader.errors()) { msg::println_error(LocalizedString::from_raw("").append_indent().append_raw(msg)); From f61cc7d4eeb74770fe06b30f09301f1ad14d949c Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Tue, 19 Jul 2022 11:19:46 -0700 Subject: [PATCH 46/61] resolve merge conflicts --- include/vcpkg/base/messages.h | 2 +- locales/messages.en.json | 9 ++++++++- locales/messages.json | 17 +++++++++++++++-- src/vcpkg/base/messages.cpp | 2 +- src/vcpkg/binarycaching.cpp | 4 ++-- 5 files changed, 27 insertions(+), 7 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index fafd024edd..8542c55d71 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -767,7 +767,7 @@ namespace vcpkg DECLARE_MESSAGE(ExpectedPortName, (), "", "expected a port name here"); DECLARE_MESSAGE(ExpectedTripletName, (), "", "expected a triplet name here"); DECLARE_MESSAGE(ExtendedDocumentationAtUrl, (msg::url), "", "Extended documentation available at '{url}'."); - DECLARE_MESSAGE(FailedToExtract, (msg::path), "", "Failed to extract \"{path}\":"); + DECLARE_MESSAGE(FailedToExtract, (msg::path), "", "Failed to extract \"{path}\":"); DECLARE_MESSAGE(FailedToParseBinParagraph, (msg::error_msg, msg::value), "'{error_msg}' is the error message for failing to parse the Binary Paragraph, '{value}' is the " diff --git a/locales/messages.en.json b/locales/messages.en.json index 79df3b0828..486d0fae68 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -100,19 +100,22 @@ "ErrorNoVSInstanceAt": "at \"{path}\"", "ErrorNoVSInstanceFullVersion": "with toolset version prefix {version}", "ErrorNoVSInstanceVersion": "with toolset version {version}", + "ErrorParsingBinaryParagraph": "while parsing the Binary Paragraph for {spec}", "ErrorRequireBaseline": "this vcpkg instance requires a manifest with a specified baseline in order to interact with ports. Please add 'builtin-baseline' to the manifest or add a 'vcpkg-configuration.json' that redefines the default registry.", "ErrorRequirePackagesList": "`vcpkg install` requires a list of packages to install in classic mode.", "ErrorUnableToDetectCompilerInfo": "vcpkg was unable to detect the active compiler's information. See above for the CMake failure output.", "ErrorVcvarsUnsupported": "in triplet {triplet}: Use of Visual Studio's Developer Prompt is unsupported on non-Windows hosts.\nDefine 'VCPKG_CMAKE_SYSTEM_NAME' or 'VCPKG_CHAINLOAD_TOOLCHAIN_FILE' in the triplet file.", "ErrorVsCodeNotFound": "Visual Studio Code was not found and the environment variable {env_var} is not set or invalid.", "ErrorVsCodeNotFoundPathExamined": "The following paths were examined:", + "ErrorWhileParsing": "Errors occurred while parsing {path}.", "ExcludedPackage": "Excluded {spec}", "ExpectedCharacterHere": "expected '{expected}' here", "ExpectedFailOrSkip": "expected 'fail', 'skip', or 'pass' here", "ExpectedPortName": "expected a port name here", "ExpectedTripletName": "expected a triplet name here", - "ExtendedDocumenationAtUrl": "Extended documentation available at '{url}'.", + "ExtendedDocumentationAtUrl": "Extended documentation available at '{url}'.", "FailedToExtract": "Failed to extract \"{path}\":", + "FailedToParseBinParagraph": "[sanity check] Failed to parse a serialized binary paragraph.\nPlease open an issue at https://github.com/microsoft/vcpkg, with the following output:\n{error_msg}\nSerialized Binary Paragraph: \n{value}", "FailedToParseCMakeConsoleOut": "Failed to parse CMake console output to locate block start/end markers.", "FailedToProvisionCe": "Failed to provision vcpkg-ce.", "FailedToRunToolToDetermineVersion": "Failed to run \"{path}\" to determine the {tool_name} version.", @@ -182,15 +185,18 @@ "LicenseExpressionImbalancedParens": "There was a close parenthesis without an opening parenthesis.", "LicenseExpressionUnknownException": "Unknown license exception identifier '{value}'. Known values are listed at https://spdx.org/licenses/exceptions-index.html", "LicenseExpressionUnknownLicense": "Unknown license identifier '{value}'. Known values are listed at https://spdx.org/licenses/", + "ListOfValidFieldsForControlFiles": "This is the list of valid fields for CONTROL files (case-sensitive):", "LoadingCommunityTriplet": "-- [COMMUNITY] Loading triplet configuration from: {path}", "LoadingDependencyInformation": "Loading dependency information for {count} packages...", "LoadingOverlayTriplet": "-- [OVERLAY] Loading triplet configuration from: {path}", "LocalizedMessageMustNotContainIndents": "The message named {value} contains what appears to be indenting which must be changed to use LocalizedString::append_indent instead.", "LocalizedMessageMustNotEndWithNewline": "The message named {value} ends with a newline which should be added by formatting rather than by localization.", + "MismatchedBinaryParagraphs": "[sanity check] The serialized binary paragraph was different from the original binary paragraph.\nPlease open an issue at {url}, with the following output:", "Missing7zHeader": "Unable to find 7z header.", "MissingExtension": "Missing '{extension}' extension.", "MonoInstructions": "This may be caused by an incomplete mono installation. Full mono is available on some systems via `sudo apt install mono-complete`. Ubuntu 18.04 users may need a newer version of mono, available at https://www.mono-project.com/download/stable/", "MsiexecFailedToExtract": "msiexec failed while extracting \"{path}\" with launch or exit code {exit_code} and message:", + "MultiArch": "Multi-Arch must be 'same' but was {option}", "NewConfigurationAlreadyExists": "Creating a manifest would overwrite a vcpkg-configuration.json at {path}.", "NewManifestAlreadyExists": "A manifest is already present at {path}.", "NewNameCannotBeEmpty": "--name cannot be empty.", @@ -225,6 +231,7 @@ "SourceFieldPortNameMismatch": "The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json file has the name {package_name} and does not match the port directory \"{path}\".", "StoredBinaryCache": "Stored binary cache: \"{path}\"", "SuggestStartingBashShell": "Please make sure you have started a new bash shell for the change to take effect.", + "SuggestUpdateVcpkg": "You may need to update the vcpkg binary; try running {command_line} to update.", "SystemApiErrorMessage": "calling {system_api} failed with {exit_code} ({error_msg})", "ToolFetchFailed": "Could not fetch {tool_name}.", "ToolInWin10": "This utility is bundled with Windows 10 or later.", diff --git a/locales/messages.json b/locales/messages.json index a1b2a5c287..f519c1684a 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -181,6 +181,8 @@ "_ErrorNoVSInstanceFullVersion.comment": "An example of {version} is 1.3.8.", "ErrorNoVSInstanceVersion": "with toolset version {version}", "_ErrorNoVSInstanceVersion.comment": "An example of {version} is 1.3.8.", + "ErrorParsingBinaryParagraph": "while parsing the Binary Paragraph for {spec}", + "_ErrorParsingBinaryParagraph.comment": "An example of {spec} is zlib:x64-windows.", "ErrorRequireBaseline": "this vcpkg instance requires a manifest with a specified baseline in order to interact with ports. Please add 'builtin-baseline' to the manifest or add a 'vcpkg-configuration.json' that redefines the default registry.", "ErrorRequirePackagesList": "`vcpkg install` requires a list of packages to install in classic mode.", "ErrorUnableToDetectCompilerInfo": "vcpkg was unable to detect the active compiler's information. See above for the CMake failure output.", @@ -190,6 +192,8 @@ "ErrorVsCodeNotFound": "Visual Studio Code was not found and the environment variable {env_var} is not set or invalid.", "_ErrorVsCodeNotFound.comment": "An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", "ErrorVsCodeNotFoundPathExamined": "The following paths were examined:", + "ErrorWhileParsing": "Errors occurred while parsing {path}.", + "_ErrorWhileParsing.comment": "An example of {path} is /foo/bar.", "ExcludedPackage": "Excluded {spec}", "_ExcludedPackage.comment": "An example of {spec} is zlib:x64-windows.", "ExpectedCharacterHere": "expected '{expected}' here", @@ -197,10 +201,12 @@ "ExpectedFailOrSkip": "expected 'fail', 'skip', or 'pass' here", "ExpectedPortName": "expected a port name here", "ExpectedTripletName": "expected a triplet name here", - "ExtendedDocumenationAtUrl": "Extended documentation available at '{url}'.", - "_ExtendedDocumenationAtUrl.comment": "An example of {url} is https://github.com/microsoft/vcpkg.", + "ExtendedDocumentationAtUrl": "Extended documentation available at '{url}'.", + "_ExtendedDocumentationAtUrl.comment": "An example of {url} is https://github.com/microsoft/vcpkg.", "FailedToExtract": "Failed to extract \"{path}\":", "_FailedToExtract.comment": "An example of {path} is /foo/bar.", + "FailedToParseBinParagraph": "[sanity check] Failed to parse a serialized binary paragraph.\nPlease open an issue at https://github.com/microsoft/vcpkg, with the following output:\n{error_msg}\nSerialized Binary Paragraph: \n{value}", + "_FailedToParseBinParagraph.comment": "'{error_msg}' is the error message for failing to parse the Binary Paragraph, '{value}' is the Binary Paragraph An example of {error_msg} is File Not Found.", "FailedToParseCMakeConsoleOut": "Failed to parse CMake console output to locate block start/end markers.", "FailedToProvisionCe": "Failed to provision vcpkg-ce.", "FailedToRunToolToDetermineVersion": "Failed to run \"{path}\" to determine the {tool_name} version.", @@ -316,6 +322,7 @@ "_LicenseExpressionUnknownException.comment": "Example of {value} is 'unknownexception'", "LicenseExpressionUnknownLicense": "Unknown license identifier '{value}'. Known values are listed at https://spdx.org/licenses/", "_LicenseExpressionUnknownLicense.comment": "Example of {value} is 'unknownlicense'", + "ListOfValidFieldsForControlFiles": "This is the list of valid fields for CONTROL files (case-sensitive):", "LoadingCommunityTriplet": "-- [COMMUNITY] Loading triplet configuration from: {path}", "_LoadingCommunityTriplet.comment": "'-- [COMMUNITY]' at the beginning must be preserved An example of {path} is /foo/bar.", "LoadingDependencyInformation": "Loading dependency information for {count} packages...", @@ -326,12 +333,16 @@ "_LocalizedMessageMustNotContainIndents.comment": "{value} is is a localized message name like LocalizedMessageMustNotContainIndents. The 'LocalizedString::append_indent' part is locale-invariant.", "LocalizedMessageMustNotEndWithNewline": "The message named {value} ends with a newline which should be added by formatting rather than by localization.", "_LocalizedMessageMustNotEndWithNewline.comment": "{value} is a localized message name like LocalizedMessageMustNotEndWithNewline", + "MismatchedBinaryParagraphs": "[sanity check] The serialized binary paragraph was different from the original binary paragraph.\nPlease open an issue at {url}, with the following output:", + "_MismatchedBinaryParagraphs.comment": "A comparison of the original binary paragraph and serialized binary paragraph is expected. An example of {url} is https://github.com/microsoft/vcpkg.", "Missing7zHeader": "Unable to find 7z header.", "MissingExtension": "Missing '{extension}' extension.", "_MissingExtension.comment": "An example of {extension} is .exe.", "MonoInstructions": "This may be caused by an incomplete mono installation. Full mono is available on some systems via `sudo apt install mono-complete`. Ubuntu 18.04 users may need a newer version of mono, available at https://www.mono-project.com/download/stable/", "MsiexecFailedToExtract": "msiexec failed while extracting \"{path}\" with launch or exit code {exit_code} and message:", "_MsiexecFailedToExtract.comment": "An example of {path} is /foo/bar. An example of {exit_code} is 127.", + "MultiArch": "Multi-Arch must be 'same' but was {option}", + "_MultiArch.comment": "An example of {option} is editable.", "NewConfigurationAlreadyExists": "Creating a manifest would overwrite a vcpkg-configuration.json at {path}.", "_NewConfigurationAlreadyExists.comment": "An example of {path} is /foo/bar.", "NewManifestAlreadyExists": "A manifest is already present at {path}.", @@ -388,6 +399,8 @@ "StoredBinaryCache": "Stored binary cache: \"{path}\"", "_StoredBinaryCache.comment": "An example of {path} is /foo/bar.", "SuggestStartingBashShell": "Please make sure you have started a new bash shell for the change to take effect.", + "SuggestUpdateVcpkg": "You may need to update the vcpkg binary; try running {command_line} to update.", + "_SuggestUpdateVcpkg.comment": "An example of {command_line} is vcpkg install zlib.", "SystemApiErrorMessage": "calling {system_api} failed with {exit_code} ({error_msg})", "_SystemApiErrorMessage.comment": "An example of {system_api} is CreateProcessW. An example of {exit_code} is 127. An example of {error_msg} is File Not Found.", "ToolFetchFailed": "Could not fetch {tool_name}.", diff --git a/src/vcpkg/base/messages.cpp b/src/vcpkg/base/messages.cpp index 717d51cc0c..52f33effe3 100644 --- a/src/vcpkg/base/messages.cpp +++ b/src/vcpkg/base/messages.cpp @@ -517,7 +517,7 @@ namespace vcpkg REGISTER_MESSAGE(ExpectedPortName); REGISTER_MESSAGE(ExpectedTripletName); REGISTER_MESSAGE(ExtendedDocumentationAtUrl); - REGISTER_MESSAGE(FailedToExtract); + REGISTER_MESSAGE(FailedToExtract); REGISTER_MESSAGE(FailedToParseBinParagraph); REGISTER_MESSAGE(FailedToParseCMakeConsoleOut); REGISTER_MESSAGE(FailedToProvisionCe); diff --git a/src/vcpkg/binarycaching.cpp b/src/vcpkg/binarycaching.cpp index 7d79e97d93..a7cffdd664 100644 --- a/src/vcpkg/binarycaching.cpp +++ b/src/vcpkg/binarycaching.cpp @@ -2465,7 +2465,7 @@ void vcpkg::help_topic_asset_caching(const VcpkgPaths&) "specified as `read`, `write`, or `readwrite` and defaults to `read`."); tbl.blank(); print2(tbl.m_str); - msg::println(msgExtendedDocumenationAtUrl, msg::url = docs::assetcaching_url); + msg::println(msgExtendedDocumentationAtUrl, msg::url = docs::assetcaching_url); } void vcpkg::help_topic_binary_caching(const VcpkgPaths&) @@ -2547,7 +2547,7 @@ void vcpkg::help_topic_binary_caching(const VcpkgPaths&) msg::println(msgDefaultPathToBinaries, msg::path = *p); } - msg::println(msgExtendedDocumenationAtUrl, msg::url = docs::binarycaching_url); + msg::println(msgExtendedDocumentationAtUrl, msg::url = docs::binarycaching_url); } std::string vcpkg::generate_nuget_packages_config(const ActionPlan& action) From 4a7ea9790b97f9255252663d6ec9ba5bbba0da3c Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Tue, 19 Jul 2022 11:27:06 -0700 Subject: [PATCH 47/61] Grammer fix + ensure environment variable goes through its formatter --- include/vcpkg/base/messages.h | 4 ++-- locales/messages.en.json | 4 ++-- locales/messages.json | 4 ++-- src/vcpkg/build.cpp | 4 +++- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index 4839961f3f..45ca0c3ac9 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -702,7 +702,7 @@ namespace vcpkg DECLARE_MESSAGE(DownloadRootsDir, (msg::env_var), "", - "Specify the downloads root directory.\n(default: '{env_var}')"); + "Specify the downloads root directory.\n(default: {env_var})"); DECLARE_MESSAGE(DuplicateCommandOption, (msg::command_name), "", @@ -861,7 +861,7 @@ namespace vcpkg DECLARE_MESSAGE(HelpEditCommand, (msg::env_var), "", - "Open up a port for editing (use '{env_var}' to set an editor program, defaults to 'code')."); + "Open a port for editing (use '{env_var}' to set an editor program, defaults to 'code')."); DECLARE_MESSAGE(HelpEnvCommand, (), "", "Creates a clean shell environment for development or compiling."); DECLARE_MESSAGE(HelpExampleCommand, (), diff --git a/locales/messages.en.json b/locales/messages.en.json index e2d22960d9..ec4b5cf8dd 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -88,7 +88,7 @@ "DefaultPathToBinaries": "Based on your system settings, the default path to store binaries is \"{path}\". This consults %LOCALAPPDATA%/%APPDATA% on Windows and $XDG_CACHE_HOME or $HOME on other platforms.", "DetectCompilerHash": "Detecting compiler hash for triplet {triplet}...", "DownloadAvailable": "A downloadable copy of this tool is available and can be used by unsetting {env_var}.", - "DownloadRootsDir": "Specify the downloads root directory.\n(default: '{env_var}')", + "DownloadRootsDir": "Specify the downloads root directory.\n(default: {env_var})", "DownloadedSources": "Downloaded sources for {spec}", "DownloadingVcpkgCeBundle": "Downloading vcpkg-ce bundle {version}...", "DownloadingVcpkgCeBundleLatest": "Downloading latest vcpkg-ce bundle...", @@ -148,7 +148,7 @@ "HelpContactCommand": "Display contact information to send feedback.", "HelpCreateCommand": "Create a new package.", "HelpDependInfoCommand": "Display a list of dependencies for packages.", - "HelpEditCommand": "Open up a port for editing (use '{env_var}' to set an editor program, defaults to 'code').", + "HelpEditCommand": "Open a port for editing (use '{env_var}' to set an editor program, defaults to 'code').", "HelpEnvCommand": "Creates a clean shell environment for development or compiling.", "HelpExampleCommand": "For more help (including examples) see the accompanying README.md and docs folder.", "HelpExportCommand": "Exports a package.", diff --git a/locales/messages.json b/locales/messages.json index 99c0a3a8c5..790ed5ae4b 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -159,7 +159,7 @@ "_DetectCompilerHash.comment": "An example of {triplet} is x64-windows.", "DownloadAvailable": "A downloadable copy of this tool is available and can be used by unsetting {env_var}.", "_DownloadAvailable.comment": "An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", - "DownloadRootsDir": "Specify the downloads root directory.\n(default: '{env_var}')", + "DownloadRootsDir": "Specify the downloads root directory.\n(default: {env_var})", "_DownloadRootsDir.comment": "An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", "DownloadedSources": "Downloaded sources for {spec}", "_DownloadedSources.comment": "An example of {spec} is zlib:x64-windows.", @@ -257,7 +257,7 @@ "HelpContactCommand": "Display contact information to send feedback.", "HelpCreateCommand": "Create a new package.", "HelpDependInfoCommand": "Display a list of dependencies for packages.", - "HelpEditCommand": "Open up a port for editing (use '{env_var}' to set an editor program, defaults to 'code').", + "HelpEditCommand": "Open a port for editing (use '{env_var}' to set an editor program, defaults to 'code').", "_HelpEditCommand.comment": "An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", "HelpEnvCommand": "Creates a clean shell environment for development or compiling.", "HelpExampleCommand": "For more help (including examples) see the accompanying README.md and docs folder.", diff --git a/src/vcpkg/build.cpp b/src/vcpkg/build.cpp index ed10f31c2a..5b6ad344a7 100644 --- a/src/vcpkg/build.cpp +++ b/src/vcpkg/build.cpp @@ -452,7 +452,9 @@ namespace vcpkg // We simply set "ip:port" to HTTP(S)_PROXY variables because it works on most common cases. else { - msg::println(msgAutoSettingEnvVar, msg::env_var = "HTTP(S)_PROXY", msg::url = server); + msg::println(msgAutoSettingEnvVar, + msg::env_var = format_environment_variable("HTTP(S)_PROXY"), + msg::url = server); env.emplace("HTTP_PROXY", server.c_str()); env.emplace("HTTPS_PROXY", server.c_str()); From 251270723de8d86bfd3ec4a9beaa11f81bcdbfa9 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Tue, 19 Jul 2022 11:35:47 -0700 Subject: [PATCH 48/61] grammer fixes --- include/vcpkg/base/messages.h | 5 +---- locales/messages.en.json | 2 +- locales/messages.json | 4 ++-- src/vcpkg/vcpkgcmdarguments.cpp | 8 ++++---- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index 45ca0c3ac9..f156ef76db 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -711,10 +711,7 @@ namespace vcpkg (msg::value), "'{value}' is a command line option.", "'--{value}' specified multiple times."); - DECLARE_MESSAGE(EmptyArg, - (msg::command_name), - "", - "The option '{command_name}' must be passed a non-empty argument."); + DECLARE_MESSAGE(EmptyArg, (msg::option), "", "The option '{option}' must be passed a non-empty argument."); DECLARE_MESSAGE(EmptyLicenseExpression, (), "", "SPDX license expression was empty."); DECLARE_MESSAGE(EnvStrFailedToExtract, (), "", "could not expand the environment string:"); DECLARE_MESSAGE(ErrorDetectingCompilerInfo, diff --git a/locales/messages.en.json b/locales/messages.en.json index ec4b5cf8dd..700ac2c3b0 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -95,7 +95,7 @@ "DuplicateCommandOption": "The option '{command_name}' can only be passed once.", "DuplicateOptions": "'--{value}' specified multiple times.", "ElapsedForPackage": "Elapsed time to handle {spec}: {elapsed}", - "EmptyArg": "The option '{command_name}' must be passed a non-empty argument.", + "EmptyArg": "The option '{option}' must be passed a non-empty argument.", "EmptyLicenseExpression": "SPDX license expression was empty.", "EnvStrFailedToExtract": "could not expand the environment string:", "ErrorDetectingCompilerInfo": "while detecting compiler information:\nThe log file content at \"{path}\" is:", diff --git a/locales/messages.json b/locales/messages.json index 790ed5ae4b..4e62e30635 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -173,8 +173,8 @@ "_DuplicateOptions.comment": "'{value}' is a command line option.", "ElapsedForPackage": "Elapsed time to handle {spec}: {elapsed}", "_ElapsedForPackage.comment": "An example of {spec} is zlib:x64-windows. An example of {elapsed} is 3.532 min.", - "EmptyArg": "The option '{command_name}' must be passed a non-empty argument.", - "_EmptyArg.comment": "An example of {command_name} is install.", + "EmptyArg": "The option '{option}' must be passed a non-empty argument.", + "_EmptyArg.comment": "An example of {option} is editable.", "EmptyLicenseExpression": "SPDX license expression was empty.", "EnvStrFailedToExtract": "could not expand the environment string:", "ErrorDetectingCompilerInfo": "while detecting compiler information:\nThe log file content at \"{path}\" is:", diff --git a/src/vcpkg/vcpkgcmdarguments.cpp b/src/vcpkg/vcpkgcmdarguments.cpp index f220005e3d..48d5c2e113 100644 --- a/src/vcpkg/vcpkgcmdarguments.cpp +++ b/src/vcpkg/vcpkgcmdarguments.cpp @@ -483,7 +483,7 @@ namespace vcpkg else if (value.front().empty()) { // Fail when not given a value, e.g.: "vcpkg install sqlite3 --additional-ports=" - msg::println_error(msgEmptyArg, msg::command_name = option.name); + msg::println_error(msgEmptyArg, msg::option = option.name); failed = true; } else @@ -496,7 +496,7 @@ namespace vcpkg if (switch_it != switches_copy.end()) { // This means that the option was passed like '--a' - msg::println_error(msgEmptyArg, msg::command_name = option.name); + msg::println_error(msgEmptyArg, msg::option = option.name); switches_copy.erase(switch_it); failed = true; } @@ -512,7 +512,7 @@ namespace vcpkg { if (v.empty()) { - msg::println_error(msgEmptyArg, msg::command_name = option.name); + msg::println_error(msgEmptyArg, msg::option = option.name); failed = true; } else @@ -526,7 +526,7 @@ namespace vcpkg if (switch_it != switches_copy.end()) { // This means that the option was passed like '--a' - msg::println_error(msgEmptyArg, msg::command_name = option.name); + msg::println_error(msgEmptyArg, msg::option = option.name); switches_copy.erase(switch_it); failed = true; } From aea234530b69231848d464c8a892e85b26fce8ed Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Tue, 19 Jul 2022 12:40:12 -0700 Subject: [PATCH 49/61] Removed the format_env_variable for consistency --- include/vcpkg/base/messages.h | 16 +++++++------ include/vcpkg/vcpkgcmdarguments.h | 2 -- locales/messages.en.json | 8 +++---- locales/messages.json | 8 +++---- src/vcpkg/build.cpp | 4 +--- src/vcpkg/vcpkgcmdarguments.cpp | 39 +++++++------------------------ 6 files changed, 27 insertions(+), 50 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index f156ef76db..0be2bc6a1d 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -689,10 +689,11 @@ namespace vcpkg "Based on your system settings, the default path to store binaries is \"{path}\". This consults " "%LOCALAPPDATA%/%APPDATA% on Windows and $XDG_CACHE_HOME or $HOME on other platforms."); DECLARE_MESSAGE(DetectCompilerHash, (msg::triplet), "", "Detecting compiler hash for triplet {triplet}..."); - DECLARE_MESSAGE(DownloadAvailable, - (msg::env_var), - "", - "A downloadable copy of this tool is available and can be used by unsetting {env_var}."); + DECLARE_MESSAGE( + DownloadAvailable, + (msg::env_var), + "", + "A downloadable copy of this tool is available and can be used by unsetting {env_var} environment variable."); DECLARE_MESSAGE(DownloadedSources, (msg::spec), "", "Downloaded sources for {spec}"); DECLARE_MESSAGE(DownloadingVcpkgCeBundle, (msg::version), "", "Downloading vcpkg-ce bundle {version}..."); DECLARE_MESSAGE(DownloadingVcpkgCeBundleLatest, @@ -853,12 +854,13 @@ namespace vcpkg "'header' refers to C/C++ .h files", "{package_name} is header-only and can be used from CMake via:"); DECLARE_MESSAGE(HelpContactCommand, (), "", "Display contact information to send feedback."); - DECLARE_MESSAGE(HelpCreateCommand, (), "", "Create a new package."); - DECLARE_MESSAGE(HelpDependInfoCommand, (), "", "Display a list of dependencies for packages."); + DECLARE_MESSAGE(HelpCreateCommand, (), "", "Create a new port."); + DECLARE_MESSAGE(HelpDependInfoCommand, (), "", "Display a list of dependencies for ports."); DECLARE_MESSAGE(HelpEditCommand, (msg::env_var), "", - "Open a port for editing (use '{env_var}' to set an editor program, defaults to 'code')."); + "Open a port for editing (use the environment variable '{env_var}' to set an editor program, " + "defaults to 'code')."); DECLARE_MESSAGE(HelpEnvCommand, (), "", "Creates a clean shell environment for development or compiling."); DECLARE_MESSAGE(HelpExampleCommand, (), diff --git a/include/vcpkg/vcpkgcmdarguments.h b/include/vcpkg/vcpkgcmdarguments.h index b91edb5c17..56693a16a6 100644 --- a/include/vcpkg/vcpkgcmdarguments.h +++ b/include/vcpkg/vcpkgcmdarguments.h @@ -89,8 +89,6 @@ namespace vcpkg std::string create_example_string(const std::string& command_and_arguments); - std::string format_environment_variable(StringLiteral lit); - struct HelpTableFormatter { void format(StringView col1, StringView col2); diff --git a/locales/messages.en.json b/locales/messages.en.json index 700ac2c3b0..ac3ee889ff 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -87,7 +87,7 @@ "DefaultFlag": "Defaulting to '{command_name}' being on.", "DefaultPathToBinaries": "Based on your system settings, the default path to store binaries is \"{path}\". This consults %LOCALAPPDATA%/%APPDATA% on Windows and $XDG_CACHE_HOME or $HOME on other platforms.", "DetectCompilerHash": "Detecting compiler hash for triplet {triplet}...", - "DownloadAvailable": "A downloadable copy of this tool is available and can be used by unsetting {env_var}.", + "DownloadAvailable": "A downloadable copy of this tool is available and can be used by unsetting {env_var} environment variable.", "DownloadRootsDir": "Specify the downloads root directory.\n(default: {env_var})", "DownloadedSources": "Downloaded sources for {spec}", "DownloadingVcpkgCeBundle": "Downloading vcpkg-ce bundle {version}...", @@ -146,9 +146,9 @@ "HashFileFailureToRead": "failed to read file \"{path}\" for hashing: ", "HeaderOnlyUsage": "{package_name} is header-only and can be used from CMake via:", "HelpContactCommand": "Display contact information to send feedback.", - "HelpCreateCommand": "Create a new package.", - "HelpDependInfoCommand": "Display a list of dependencies for packages.", - "HelpEditCommand": "Open a port for editing (use '{env_var}' to set an editor program, defaults to 'code').", + "HelpCreateCommand": "Create a new port.", + "HelpDependInfoCommand": "Display a list of dependencies for ports.", + "HelpEditCommand": "Open a port for editing (use the environment variable '{env_var}' to set an editor program, defaults to 'code').", "HelpEnvCommand": "Creates a clean shell environment for development or compiling.", "HelpExampleCommand": "For more help (including examples) see the accompanying README.md and docs folder.", "HelpExportCommand": "Exports a package.", diff --git a/locales/messages.json b/locales/messages.json index 4e62e30635..6bea7ddcaa 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -157,7 +157,7 @@ "_DefaultPathToBinaries.comment": "An example of {path} is /foo/bar.", "DetectCompilerHash": "Detecting compiler hash for triplet {triplet}...", "_DetectCompilerHash.comment": "An example of {triplet} is x64-windows.", - "DownloadAvailable": "A downloadable copy of this tool is available and can be used by unsetting {env_var}.", + "DownloadAvailable": "A downloadable copy of this tool is available and can be used by unsetting {env_var} environment variable.", "_DownloadAvailable.comment": "An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", "DownloadRootsDir": "Specify the downloads root directory.\n(default: {env_var})", "_DownloadRootsDir.comment": "An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", @@ -255,9 +255,9 @@ "HeaderOnlyUsage": "{package_name} is header-only and can be used from CMake via:", "_HeaderOnlyUsage.comment": "'header' refers to C/C++ .h files An example of {package_name} is zlib.", "HelpContactCommand": "Display contact information to send feedback.", - "HelpCreateCommand": "Create a new package.", - "HelpDependInfoCommand": "Display a list of dependencies for packages.", - "HelpEditCommand": "Open a port for editing (use '{env_var}' to set an editor program, defaults to 'code').", + "HelpCreateCommand": "Create a new port.", + "HelpDependInfoCommand": "Display a list of dependencies for ports.", + "HelpEditCommand": "Open a port for editing (use the environment variable '{env_var}' to set an editor program, defaults to 'code').", "_HelpEditCommand.comment": "An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", "HelpEnvCommand": "Creates a clean shell environment for development or compiling.", "HelpExampleCommand": "For more help (including examples) see the accompanying README.md and docs folder.", diff --git a/src/vcpkg/build.cpp b/src/vcpkg/build.cpp index 5b6ad344a7..ed10f31c2a 100644 --- a/src/vcpkg/build.cpp +++ b/src/vcpkg/build.cpp @@ -452,9 +452,7 @@ namespace vcpkg // We simply set "ip:port" to HTTP(S)_PROXY variables because it works on most common cases. else { - msg::println(msgAutoSettingEnvVar, - msg::env_var = format_environment_variable("HTTP(S)_PROXY"), - msg::url = server); + msg::println(msgAutoSettingEnvVar, msg::env_var = "HTTP(S)_PROXY", msg::url = server); env.emplace("HTTP_PROXY", server.c_str()); env.emplace("HTTPS_PROXY", server.c_str()); diff --git a/src/vcpkg/vcpkgcmdarguments.cpp b/src/vcpkg/vcpkgcmdarguments.cpp index 48d5c2e113..1df023ed97 100644 --- a/src/vcpkg/vcpkgcmdarguments.cpp +++ b/src/vcpkg/vcpkgcmdarguments.cpp @@ -580,8 +580,7 @@ namespace vcpkg Commands::Integrate::append_helpstring(table); table.blank(); table.format("vcpkg export ... [opt]...", msg::format(msgHelpExportCommand)); - table.format("vcpkg edit ", - msg::format(msgHelpEditCommand, msg::env_var = format_environment_variable("EDITOR"))); + table.format("vcpkg edit ", msg::format(msgHelpEditCommand, msg::env_var = "EDITOR")); table.format("vcpkg create [archivename]", msg::format(msgHelpCreateCommand)); table.format("vcpkg x-init-registry ", msg::format(msgHelpInitializeRegistryCommand)); table.format("vcpkg format-manifest --all", msg::format(msgHelpFormatManifestCommand)); @@ -642,24 +641,20 @@ namespace vcpkg return Strings::concat("--", arg, joiner, value); }; - table.format( - opt(TRIPLET_ARG, "=", ""), - msg::format(msgSpecifyTargetArch, msg::env_var = format_environment_variable("VCPKG_DEFAULT_TRIPLET"))); - table.format( - opt(HOST_TRIPLET_ARG, "=", ""), - msg::format(msgSpecifyHostArch, msg::env_var = format_environment_variable("VCPKG_DEFAULT_HOST_TRIPLET"))); + table.format(opt(TRIPLET_ARG, "=", ""), + msg::format(msgSpecifyTargetArch, msg::env_var = "VCPKG_DEFAULT_TRIPLET")); + table.format(opt(HOST_TRIPLET_ARG, "=", ""), + msg::format(msgSpecifyHostArch, msg::env_var = "VCPKG_DEFAULT_HOST_TRIPLET")); table.format(opt(OVERLAY_PORTS_ARG, "=", ""), - msg::format(msgSpecifyDirectoriesWhenSearching, - msg::env_var = format_environment_variable("VCPKG_OVERLAY_PORTS"))); + msg::format(msgSpecifyDirectoriesWhenSearching, msg::env_var = "VCPKG_OVERLAY_PORTS")); table.format(opt(OVERLAY_TRIPLETS_ARG, "=", ""), - msg::format(msgSpecifyDirectoriesContaining, - msg::env_var = format_environment_variable("VCPKG_OVERLAY_TRIPLETS"))); + msg::format(msgSpecifyDirectoriesContaining, msg::env_var = "VCPKG_OVERLAY_TRIPLETS")); table.format(opt(BINARY_SOURCES_ARG, "=", ""), msg::format(msgBinarySourcesArg)); table.format(opt(ASSET_SOURCES_ARG, "=", ""), msg::format(msgAssetSourcesArg)); table.format(opt(DOWNLOADS_ROOT_DIR_ARG, "=", ""), - msg::format(msgDownloadRootsDir, msg::env_var = format_environment_variable("VCPKG_DOWNLOADS"))); + msg::format(msgDownloadRootsDir, msg::env_var = "VCPKG_DOWNLOADS")); table.format(opt(VCPKG_ROOT_DIR_ARG, "=", ""), - msg::format(msgVcpkgRootsDir, msg::env_var = format_environment_variable("VCPKG_ROOT"))); + msg::format(msgVcpkgRootsDir, msg::env_var = "VCPKG_ROOT")); table.format(opt(BUILDTREES_ROOT_DIR_ARG, "=", ""), msg::format(msgBuildTreesRootDir)); table.format(opt(INSTALL_ROOT_DIR_ARG, "=", ""), msg::format(msgInstallRootDir)); table.format(opt(PACKAGES_ROOT_DIR_ARG, "=", ""), msg::format(msgPackageRootDir)); @@ -904,22 +899,6 @@ namespace vcpkg return Optional(std::move(asset_sources_template)); } - std::string format_environment_variable(StringLiteral lit) - { - std::string result; -#if defined(_WIN32) - result.reserve(lit.size() + 2); - result.push_back('%'); - result.append(lit.data(), lit.size()); - result.push_back('%'); -#else - result.reserve(lit.size() + 1); - result.push_back('$'); - result.append(lit.data(), lit.size()); -#endif - return result; - } - std::string create_example_string(const std::string& command_and_arguments) { std::string cs = Strings::format("Example:\n" From e74d2dd482f770f52d32a3d93c3ef6d80393fc66 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Tue, 19 Jul 2022 12:51:25 -0700 Subject: [PATCH 50/61] added -- to all options and scanned for command_name replacements that should be options --- include/vcpkg/base/messages.h | 16 +++++----------- src/vcpkg/vcpkgcmdarguments.cpp | 6 +++--- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index 0be2bc6a1d..b9f161da86 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -682,7 +682,7 @@ namespace vcpkg "=== curl output ===\n" "{actual}\n" "=== end curl output ==="); - DECLARE_MESSAGE(DefaultFlag, (msg::command_name), "", "Defaulting to '{command_name}' being on."); + DECLARE_MESSAGE(DefaultFlag, (msg::option), "", "Defaulting to --{option} being on."); DECLARE_MESSAGE(DefaultPathToBinaries, (msg::path), "", @@ -704,15 +704,12 @@ namespace vcpkg (msg::env_var), "", "Specify the downloads root directory.\n(default: {env_var})"); - DECLARE_MESSAGE(DuplicateCommandOption, - (msg::command_name), - "", - "The option '{command_name}' can only be passed once."); + DECLARE_MESSAGE(DuplicateCommandOption, (msg::option), "", "The option --{option} can only be passed once."); DECLARE_MESSAGE(DuplicateOptions, (msg::value), "'{value}' is a command line option.", "'--{value}' specified multiple times."); - DECLARE_MESSAGE(EmptyArg, (msg::option), "", "The option '{option}' must be passed a non-empty argument."); + DECLARE_MESSAGE(EmptyArg, (msg::option), "", "The option --{option} must be passed a non-empty argument."); DECLARE_MESSAGE(EmptyLicenseExpression, (), "", "SPDX license expression was empty."); DECLARE_MESSAGE(EnvStrFailedToExtract, (), "", "could not expand the environment string:"); DECLARE_MESSAGE(ErrorDetectingCompilerInfo, @@ -1107,10 +1104,7 @@ namespace vcpkg "Either specify --name and --version to produce a manifest intended for C++ libraries, or specify " "--application to indicate that the manifest is not intended to be used as a port."); DECLARE_MESSAGE(NewVersionCannotBeEmpty, (), "", "--version cannot be empty."); - DECLARE_MESSAGE(NoArgumentsForOption, - (msg::command_name), - "", - "The option '{command_name}' does not accept an argument."); + DECLARE_MESSAGE(NoArgumentsForOption, (msg::option), "", "The option --{option} does not accept an argument."); DECLARE_MESSAGE(NoLocalizationForMessages, (), "", "No localized messages for the following: "); DECLARE_MESSAGE(NoRegistryForPort, (msg::package_name), "", "no registry configured for port {package_name}"); DECLARE_MESSAGE(NugetPackageFileSucceededButCreationFailed, @@ -1189,7 +1183,7 @@ namespace vcpkg DECLARE_MESSAGE(SpecifiedFeatureTurnedOff, (msg::command_name, msg::option), "", - "'{command_name}' feature specifically turned off, but --'{option}' was specified."); + "'{command_name}' feature specifically turned off, but --{option} was specified."); DECLARE_MESSAGE(SpecifyDirectoriesContaining, (msg::env_var), "", diff --git a/src/vcpkg/vcpkgcmdarguments.cpp b/src/vcpkg/vcpkgcmdarguments.cpp index 1df023ed97..614c46ae26 100644 --- a/src/vcpkg/vcpkgcmdarguments.cpp +++ b/src/vcpkg/vcpkgcmdarguments.cpp @@ -458,7 +458,7 @@ namespace vcpkg if (option_it != options_copy.end()) { // This means that the switch was passed like '--a=xyz' - msg::println_error(msgNoArgumentsForOption, msg::command_name = switch_.name); + msg::println_error(msgNoArgumentsForOption, msg::option = switch_.name); options_copy.erase(option_it); failed = true; } @@ -477,7 +477,7 @@ namespace vcpkg if (value.size() > 1) { - msg::println_error(msgDuplicateCommandOption, msg::command_name = option.name); + msg::println_error(msgDuplicateCommandOption, msg::option = option.name); failed = true; } else if (value.front().empty()) @@ -834,7 +834,7 @@ namespace vcpkg { msg::println_warning( msgSpecifiedFeatureTurnedOff, msg::command_name = el.flag, msg::option = el.option); - msg::println_warning(msgDefaultFlag, msg::command_name = el.flag); + msg::println_warning(msgDefaultFlag, msg::option = el.flag); LockGuardPtr(g_metrics)->track_property( "warning", Strings::format("warning %s alongside %s", el.flag, el.option)); } From 482d57180e2d909bb10f6fdc8a6ec76af52c12fb Mon Sep 17 00:00:00 2001 From: Javier Matos Denizac Date: Tue, 19 Jul 2022 12:54:20 -0700 Subject: [PATCH 51/61] Update src/vcpkg/sourceparagraph.cpp Co-authored-by: Billy O'Neal --- src/vcpkg/sourceparagraph.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vcpkg/sourceparagraph.cpp b/src/vcpkg/sourceparagraph.cpp index 477ef4a3d6..0a840a3946 100644 --- a/src/vcpkg/sourceparagraph.cpp +++ b/src/vcpkg/sourceparagraph.cpp @@ -1429,7 +1429,7 @@ namespace vcpkg } if (start_of_chunk != end_of_chunk) { - msg::println_error(LocalizedString::from_raw(StringView{start_of_chunk, end_of_chunk})); + msg::write_unlocalized_text_to_stdout(Color::error, StringView{start_of_chunk, end_of_chunk}); start_of_chunk = end_of_chunk; } From 3c6b6bd5d8b1e9ad950c341e9e23cb58060b9291 Mon Sep 17 00:00:00 2001 From: Javier Matos Denizac Date: Tue, 19 Jul 2022 12:54:30 -0700 Subject: [PATCH 52/61] Update src/vcpkg/sourceparagraph.cpp Co-authored-by: Billy O'Neal --- src/vcpkg/sourceparagraph.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vcpkg/sourceparagraph.cpp b/src/vcpkg/sourceparagraph.cpp index 0a840a3946..44020a3761 100644 --- a/src/vcpkg/sourceparagraph.cpp +++ b/src/vcpkg/sourceparagraph.cpp @@ -1616,7 +1616,7 @@ namespace vcpkg msg::println_error(msgErrorWhileParsing, msg::path = ManifestDeserializer::VCPKG_CONFIGURATION); for (auto&& msg : reader.errors()) { - msg::println_error(LocalizedString::from_raw("").append_indent().append_raw(msg)); + msg::println_error(LocalizedString().append_indent().append_raw(msg)); } msg::println(msgExtendedDocumentationAtUrl, msg::url = docs::registries_url); Checks::exit_fail(VCPKG_LINE_INFO); From 6afcd010f75a7ce21ff3978966e80a1c3b1ce8c8 Mon Sep 17 00:00:00 2001 From: Javier Matos Denizac Date: Tue, 19 Jul 2022 12:54:36 -0700 Subject: [PATCH 53/61] Update src/vcpkg/sourceparagraph.cpp Co-authored-by: Billy O'Neal --- src/vcpkg/sourceparagraph.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vcpkg/sourceparagraph.cpp b/src/vcpkg/sourceparagraph.cpp index 44020a3761..dda9b433de 100644 --- a/src/vcpkg/sourceparagraph.cpp +++ b/src/vcpkg/sourceparagraph.cpp @@ -1383,7 +1383,7 @@ namespace vcpkg [](const std::unique_ptr& ppcei) { return !ppcei->extra_fields.empty(); })) { Strings::append(message, - msg::format(msgListOfValidFieldsForControlFiles).data(), + msg::format(msgListOfValidFieldsForControlFiles).extract_data(), Strings::join("\n ", get_list_of_valid_fields()), "\n\n"); #if defined(_WIN32) From 177985f7bb88f70b54556d4fc7a2b1f20cef7d44 Mon Sep 17 00:00:00 2001 From: Javier Matos Denizac Date: Tue, 19 Jul 2022 12:57:43 -0700 Subject: [PATCH 54/61] Update src/vcpkg/build.cpp Co-authored-by: Billy O'Neal --- src/vcpkg/build.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vcpkg/build.cpp b/src/vcpkg/build.cpp index 22e8940060..ed55b656ff 100644 --- a/src/vcpkg/build.cpp +++ b/src/vcpkg/build.cpp @@ -913,7 +913,7 @@ namespace vcpkg return_code = cmd_execute_and_stream_data( command, [&](StringView sv) { - msg::println(LocalizedString::from_raw(sv)); + msg::write_unlocalized_text_to_stdout(sv); Checks::msg_check_exit(VCPKG_LINE_INFO, out_file.write(sv.data(), 1, sv.size()) == sv.size(), msgErrorWhileWriting, From 781eed3f2fe1a5547f494c5d1493eed432c8ca2d Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Wed, 20 Jul 2022 11:03:37 -0700 Subject: [PATCH 55/61] update json --- locales/messages.en.json | 10 +++++----- locales/messages.json | 16 ++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/locales/messages.en.json b/locales/messages.en.json index ac3ee889ff..726b006270 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -84,7 +84,7 @@ "CouldNotDeduceNugetIdAndVersion": "Could not deduce nuget id and version from filename: {path}", "CreatedNuGetPackage": "Created nupkg: \"{path}\"", "CurlReportedUnexpectedResults": "curl has reported unexpected results to vcpkg and vcpkg cannot continue.\nPlease review the following text for sensitive information and open an issue on the Microsoft/vcpkg GitHub to help fix this problem!\ncmd: {command_line}\n=== curl output ===\n{actual}\n=== end curl output ===", - "DefaultFlag": "Defaulting to '{command_name}' being on.", + "DefaultFlag": "Defaulting to --{option} being on.", "DefaultPathToBinaries": "Based on your system settings, the default path to store binaries is \"{path}\". This consults %LOCALAPPDATA%/%APPDATA% on Windows and $XDG_CACHE_HOME or $HOME on other platforms.", "DetectCompilerHash": "Detecting compiler hash for triplet {triplet}...", "DownloadAvailable": "A downloadable copy of this tool is available and can be used by unsetting {env_var} environment variable.", @@ -92,10 +92,10 @@ "DownloadedSources": "Downloaded sources for {spec}", "DownloadingVcpkgCeBundle": "Downloading vcpkg-ce bundle {version}...", "DownloadingVcpkgCeBundleLatest": "Downloading latest vcpkg-ce bundle...", - "DuplicateCommandOption": "The option '{command_name}' can only be passed once.", + "DuplicateCommandOption": "The option --{option} can only be passed once.", "DuplicateOptions": "'--{value}' specified multiple times.", "ElapsedForPackage": "Elapsed time to handle {spec}: {elapsed}", - "EmptyArg": "The option '{option}' must be passed a non-empty argument.", + "EmptyArg": "The option --{option} must be passed a non-empty argument.", "EmptyLicenseExpression": "SPDX license expression was empty.", "EnvStrFailedToExtract": "could not expand the environment string:", "ErrorDetectingCompilerInfo": "while detecting compiler information:\nThe log file content at \"{path}\" is:", @@ -233,7 +233,7 @@ "NewOnlyOneVersionKind": "Only one of --version-relaxed, --version-date, or --version-string may be specified.", "NewSpecifyNameVersionOrApplication": "Either specify --name and --version to produce a manifest intended for C++ libraries, or specify --application to indicate that the manifest is not intended to be used as a port.", "NewVersionCannotBeEmpty": "--version cannot be empty.", - "NoArgumentsForOption": "The option '{command_name}' does not accept an argument.", + "NoArgumentsForOption": "The option --{option} does not accept an argument.", "NoLocalizationForMessages": "No localized messages for the following: ", "NoRegistryForPort": "no registry configured for port {package_name}", "NoteMessage": "note: ", @@ -261,7 +261,7 @@ "SeeURL": "See {url} for more information.", "SettingEnvVar": "-- Setting \"{env_var}\" environment variables to \"{url}\".", "SourceFieldPortNameMismatch": "The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json file has the name {package_name} and does not match the port directory \"{path}\".", - "SpecifiedFeatureTurnedOff": "'{command_name}' feature specifically turned off, but --'{option}' was specified.", + "SpecifiedFeatureTurnedOff": "'{command_name}' feature specifically turned off, but --{option} was specified.", "SpecifyDirectoriesContaining": "Specifiy directories containing triplets files.\n(also: '{env_var}')", "SpecifyDirectoriesWhenSearching": "Specify directories to be used when searching for ports.\n(also: '{env_var}')", "SpecifyHostArch": "Specify the host architecture triplet. See 'vcpkg help triplet'.\n(default: '{env_var}')", diff --git a/locales/messages.json b/locales/messages.json index 6bea7ddcaa..ebdd5344ae 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -151,8 +151,8 @@ "_CreatedNuGetPackage.comment": "An example of {path} is /foo/bar.", "CurlReportedUnexpectedResults": "curl has reported unexpected results to vcpkg and vcpkg cannot continue.\nPlease review the following text for sensitive information and open an issue on the Microsoft/vcpkg GitHub to help fix this problem!\ncmd: {command_line}\n=== curl output ===\n{actual}\n=== end curl output ===", "_CurlReportedUnexpectedResults.comment": "{command_line} is the command line to call curl.exe, {actual} is the console output of curl.exe locale-invariant download results. An example of {command_line} is vcpkg install zlib.", - "DefaultFlag": "Defaulting to '{command_name}' being on.", - "_DefaultFlag.comment": "An example of {command_name} is install.", + "DefaultFlag": "Defaulting to --{option} being on.", + "_DefaultFlag.comment": "An example of {option} is editable.", "DefaultPathToBinaries": "Based on your system settings, the default path to store binaries is \"{path}\". This consults %LOCALAPPDATA%/%APPDATA% on Windows and $XDG_CACHE_HOME or $HOME on other platforms.", "_DefaultPathToBinaries.comment": "An example of {path} is /foo/bar.", "DetectCompilerHash": "Detecting compiler hash for triplet {triplet}...", @@ -167,13 +167,13 @@ "_DownloadingVcpkgCeBundle.comment": "An example of {version} is 1.3.8.", "DownloadingVcpkgCeBundleLatest": "Downloading latest vcpkg-ce bundle...", "_DownloadingVcpkgCeBundleLatest.comment": "This message is normally displayed only in development.", - "DuplicateCommandOption": "The option '{command_name}' can only be passed once.", - "_DuplicateCommandOption.comment": "An example of {command_name} is install.", + "DuplicateCommandOption": "The option --{option} can only be passed once.", + "_DuplicateCommandOption.comment": "An example of {option} is editable.", "DuplicateOptions": "'--{value}' specified multiple times.", "_DuplicateOptions.comment": "'{value}' is a command line option.", "ElapsedForPackage": "Elapsed time to handle {spec}: {elapsed}", "_ElapsedForPackage.comment": "An example of {spec} is zlib:x64-windows. An example of {elapsed} is 3.532 min.", - "EmptyArg": "The option '{option}' must be passed a non-empty argument.", + "EmptyArg": "The option --{option} must be passed a non-empty argument.", "_EmptyArg.comment": "An example of {option} is editable.", "EmptyLicenseExpression": "SPDX license expression was empty.", "EnvStrFailedToExtract": "could not expand the environment string:", @@ -385,8 +385,8 @@ "NewOnlyOneVersionKind": "Only one of --version-relaxed, --version-date, or --version-string may be specified.", "NewSpecifyNameVersionOrApplication": "Either specify --name and --version to produce a manifest intended for C++ libraries, or specify --application to indicate that the manifest is not intended to be used as a port.", "NewVersionCannotBeEmpty": "--version cannot be empty.", - "NoArgumentsForOption": "The option '{command_name}' does not accept an argument.", - "_NoArgumentsForOption.comment": "An example of {command_name} is install.", + "NoArgumentsForOption": "The option --{option} does not accept an argument.", + "_NoArgumentsForOption.comment": "An example of {option} is editable.", "NoLocalizationForMessages": "No localized messages for the following: ", "NoRegistryForPort": "no registry configured for port {package_name}", "_NoRegistryForPort.comment": "An example of {package_name} is zlib.", @@ -433,7 +433,7 @@ "_SettingEnvVar.comment": "An example of env_var is \"HTTP(S)_PROXY\"'--' at the beginning must be preserved An example of {env_var} is VCPKG_DEFAULT_TRIPLET. An example of {url} is https://github.com/microsoft/vcpkg.", "SourceFieldPortNameMismatch": "The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json file has the name {package_name} and does not match the port directory \"{path}\".", "_SourceFieldPortNameMismatch.comment": "{package_name} and \"{path}\" are both names of installable ports/packages. 'Source', 'CONTROL', 'vcpkg.json', and 'name' references are locale-invariant. An example of {package_name} is zlib. An example of {path} is /foo/bar.", - "SpecifiedFeatureTurnedOff": "'{command_name}' feature specifically turned off, but --'{option}' was specified.", + "SpecifiedFeatureTurnedOff": "'{command_name}' feature specifically turned off, but --{option} was specified.", "_SpecifiedFeatureTurnedOff.comment": "An example of {command_name} is install. An example of {option} is editable.", "SpecifyDirectoriesContaining": "Specifiy directories containing triplets files.\n(also: '{env_var}')", "_SpecifyDirectoriesContaining.comment": "An example of {env_var} is VCPKG_DEFAULT_TRIPLET.", From 10d7c5c8649c3b01381f331816bdfb50369a7bee Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Thu, 21 Jul 2022 12:14:20 -0700 Subject: [PATCH 56/61] Feedback --- include/vcpkg/base/messages.h | 7 +++---- locales/messages.en.json | 2 +- locales/messages.json | 4 ++-- src/vcpkg/binaryparagraph.cpp | 8 ++++---- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index c0317c3503..c893b90450 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -796,12 +796,11 @@ namespace vcpkg DECLARE_MESSAGE(ExtendedDocumentationAtUrl, (msg::url), "", "Extended documentation available at '{url}'."); DECLARE_MESSAGE(FailedToExtract, (msg::path), "", "Failed to extract \"{path}\":"); DECLARE_MESSAGE(FailedToParseBinParagraph, - (msg::error_msg, msg::value), - "'{error_msg}' is the error message for failing to parse the Binary Paragraph, '{value}' is the " - "Binary Paragraph", + (msg::error_msg), + "'{error_msg}' is the error message for failing to parse the Binary Paragraph.", "[sanity check] Failed to parse a serialized binary paragraph.\nPlease open an issue at " "https://github.com/microsoft/vcpkg, " - "with the following output:\n{error_msg}\nSerialized Binary Paragraph: \n{value}"); + "with the following output:\n{error_msg}\nSerialized Binary Paragraph:"); DECLARE_MESSAGE(FailedToParseCMakeConsoleOut, (), "", diff --git a/locales/messages.en.json b/locales/messages.en.json index bbcb3ed5f7..df5bcedcef 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -129,7 +129,7 @@ "ExpectedValueForOption": "expected value after '{value}'.", "ExtendedDocumentationAtUrl": "Extended documentation available at '{url}'.", "FailedToExtract": "Failed to extract \"{path}\":", - "FailedToParseBinParagraph": "[sanity check] Failed to parse a serialized binary paragraph.\nPlease open an issue at https://github.com/microsoft/vcpkg, with the following output:\n{error_msg}\nSerialized Binary Paragraph: \n{value}", + "FailedToParseBinParagraph": "[sanity check] Failed to parse a serialized binary paragraph.\nPlease open an issue at https://github.com/microsoft/vcpkg, with the following output:\n{error_msg}\nSerialized Binary Paragraph:", "FailedToParseCMakeConsoleOut": "Failed to parse CMake console output to locate block start/end markers.", "FailedToProvisionCe": "Failed to provision vcpkg-ce.", "FailedToRunToolToDetermineVersion": "Failed to run \"{path}\" to determine the {tool_name} version.", diff --git a/locales/messages.json b/locales/messages.json index 937339400e..78bab64dcd 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -230,8 +230,8 @@ "_ExtendedDocumentationAtUrl.comment": "An example of {url} is https://github.com/microsoft/vcpkg.", "FailedToExtract": "Failed to extract \"{path}\":", "_FailedToExtract.comment": "An example of {path} is /foo/bar.", - "FailedToParseBinParagraph": "[sanity check] Failed to parse a serialized binary paragraph.\nPlease open an issue at https://github.com/microsoft/vcpkg, with the following output:\n{error_msg}\nSerialized Binary Paragraph: \n{value}", - "_FailedToParseBinParagraph.comment": "'{error_msg}' is the error message for failing to parse the Binary Paragraph, '{value}' is the Binary Paragraph An example of {error_msg} is File Not Found.", + "FailedToParseBinParagraph": "[sanity check] Failed to parse a serialized binary paragraph.\nPlease open an issue at https://github.com/microsoft/vcpkg, with the following output:\n{error_msg}\nSerialized Binary Paragraph:", + "_FailedToParseBinParagraph.comment": "'{error_msg}' is the error message for failing to parse the Binary Paragraph. An example of {error_msg} is File Not Found.", "FailedToParseCMakeConsoleOut": "Failed to parse CMake console output to locate block start/end markers.", "FailedToProvisionCe": "Failed to provision vcpkg-ce.", "FailedToRunToolToDetermineVersion": "Failed to run \"{path}\" to determine the {tool_name} version.", diff --git a/src/vcpkg/binaryparagraph.cpp b/src/vcpkg/binaryparagraph.cpp index 595765c9b2..70de9e4d17 100644 --- a/src/vcpkg/binaryparagraph.cpp +++ b/src/vcpkg/binaryparagraph.cpp @@ -280,10 +280,10 @@ namespace vcpkg out_str.substr(initial_end), "vcpkg::serialize(const BinaryParagraph&, std::string&)"); if (!parsed_paragraph) { - Checks::msg_exit_maybe_upgrade(VCPKG_LINE_INFO, - msgFailedToParseBinParagraph, - msg::error_msg = parsed_paragraph.error(), - msg ::value = my_paragraph); + Checks::msg_exit_maybe_upgrade( + VCPKG_LINE_INFO, + msg::format(msgFailedToParseBinParagraph, msg::error_msg = parsed_paragraph.error()) + .append_raw("\n" + my_paragraph)); } auto binary_paragraph = BinaryParagraph(*parsed_paragraph.get()); From 27de5c3f659b6b626b93c334152038c80ce6a3f4 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Thu, 21 Jul 2022 16:11:44 -0700 Subject: [PATCH 57/61] wip --- include/vcpkg/base/messages.h | 7 ++++ include/vcpkg/binaryparagraph.h | 1 + locales/messages.en.json | 3 ++ locales/messages.json | 3 ++ src/vcpkg/base/messages.cpp | 3 ++ src/vcpkg/binaryparagraph.cpp | 74 +++++++++++---------------------- src/vcpkg/sourceparagraph.cpp | 2 +- 7 files changed, 42 insertions(+), 51 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index c893b90450..081c17aa23 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -1441,4 +1441,11 @@ namespace vcpkg "The message named {value} starts with warning:, it must be changed to prepend " "WarningMessage in code instead."); DECLARE_MESSAGE(WarningsTreatedAsErrors, (), "", "previous warnings being interpreted as errors"); + DECLARE_MESSAGE(MissmatchedBinParagraphs, + (), + "", + "The serialized binary paragraph was different from the original binary paragraph. Please open an " + "issue at https://github.com/microsoft/vcpkg with the following output:"); + DECLARE_MESSAGE(OriginalBinParagraphHeader, (), "", "\nOriginal Binary Paragraph"); + DECLARE_MESSAGE(SerializedBinParagraphHeader, (), "", "\nSerialized Binary Paragraph"); } diff --git a/include/vcpkg/binaryparagraph.h b/include/vcpkg/binaryparagraph.h index 030425ff74..ca3d6a286d 100644 --- a/include/vcpkg/binaryparagraph.h +++ b/include/vcpkg/binaryparagraph.h @@ -56,4 +56,5 @@ namespace vcpkg }; void serialize(const BinaryParagraph& pgh, std::string& out_str); + std::string format_binary_paragraph(BinaryParagraph paragraph); } diff --git a/locales/messages.en.json b/locales/messages.en.json index df5bcedcef..f43c557464 100644 --- a/locales/messages.en.json +++ b/locales/messages.en.json @@ -237,6 +237,7 @@ "MismatchedBinaryParagraphs": "[sanity check] The serialized binary paragraph was different from the original binary paragraph.\nPlease open an issue at {url}, with the following output:", "Missing7zHeader": "Unable to find 7z header.", "MissingExtension": "Missing '{extension}' extension.", + "MissmatchedBinParagraphs": "The serialized binary paragraph was different from the original binary paragraph. Please open an issue at https://github.com/microsoft/vcpkg with the following output:", "MonoInstructions": "This may be caused by an incomplete mono installation. Full mono is available on some systems via `sudo apt install mono-complete`. Ubuntu 18.04 users may need a newer version of mono, available at https://www.mono-project.com/download/stable/", "MsiexecFailedToExtract": "msiexec failed while extracting \"{path}\" with launch or exit code {exit_code} and message:", "MultiArch": "Multi-Arch must be 'same' but was {option}", @@ -253,6 +254,7 @@ "NoRegistryForPort": "no registry configured for port {package_name}", "NoteMessage": "note: ", "NugetPackageFileSucceededButCreationFailed": "NuGet package creation succeeded, but no .nupkg was produced. Expected: \"{path}\"", + "OriginalBinParagraphHeader": "\nOriginal Binary Paragraph", "PackageFailedtWhileExtracting": "'{value}' failed while extracting {path}.", "PackageRootDir": "(Experimental) Specify the packages root directory.", "PackingVendorFailed": "Packing {vendor} failed. Use --debug for more information.", @@ -276,6 +278,7 @@ "RestoredPackagesFromVendor": "Restored {count} package(s) from {value} in {elapsed}. Use --debug to see more details.", "ResultsHeader": "RESULTS", "SeeURL": "See {url} for more information.", + "SerializedBinParagraphHeader": "\nSerialized Binary Paragraph", "SettingEnvVar": "-- Setting \"{env_var}\" environment variables to \"{url}\".", "SourceFieldPortNameMismatch": "The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json file has the name {package_name} and does not match the port directory \"{path}\".", "SpecifiedFeatureTurnedOff": "'{command_name}' feature specifically turned off, but --{option} was specified.", diff --git a/locales/messages.json b/locales/messages.json index 78bab64dcd..81dda24056 100644 --- a/locales/messages.json +++ b/locales/messages.json @@ -396,6 +396,7 @@ "Missing7zHeader": "Unable to find 7z header.", "MissingExtension": "Missing '{extension}' extension.", "_MissingExtension.comment": "An example of {extension} is .exe.", + "MissmatchedBinParagraphs": "The serialized binary paragraph was different from the original binary paragraph. Please open an issue at https://github.com/microsoft/vcpkg with the following output:", "MonoInstructions": "This may be caused by an incomplete mono installation. Full mono is available on some systems via `sudo apt install mono-complete`. Ubuntu 18.04 users may need a newer version of mono, available at https://www.mono-project.com/download/stable/", "MsiexecFailedToExtract": "msiexec failed while extracting \"{path}\" with launch or exit code {exit_code} and message:", "_MsiexecFailedToExtract.comment": "An example of {path} is /foo/bar. An example of {exit_code} is 127.", @@ -420,6 +421,7 @@ "NoteMessage": "note: ", "NugetPackageFileSucceededButCreationFailed": "NuGet package creation succeeded, but no .nupkg was produced. Expected: \"{path}\"", "_NugetPackageFileSucceededButCreationFailed.comment": "An example of {path} is /foo/bar.", + "OriginalBinParagraphHeader": "\nOriginal Binary Paragraph", "PackageFailedtWhileExtracting": "'{value}' failed while extracting {path}.", "_PackageFailedtWhileExtracting.comment": "'{value}' is either a tool name or a package name. An example of {path} is /foo/bar.", "PackageRootDir": "(Experimental) Specify the packages root directory.", @@ -460,6 +462,7 @@ "_ResultsHeader.comment": "Displayed before a list of installation results.", "SeeURL": "See {url} for more information.", "_SeeURL.comment": "An example of {url} is https://github.com/microsoft/vcpkg.", + "SerializedBinParagraphHeader": "\nSerialized Binary Paragraph", "SettingEnvVar": "-- Setting \"{env_var}\" environment variables to \"{url}\".", "_SettingEnvVar.comment": "An example of env_var is \"HTTP(S)_PROXY\"'--' at the beginning must be preserved An example of {env_var} is VCPKG_DEFAULT_TRIPLET. An example of {url} is https://github.com/microsoft/vcpkg.", "SourceFieldPortNameMismatch": "The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json file has the name {package_name} and does not match the port directory \"{path}\".", diff --git a/src/vcpkg/base/messages.cpp b/src/vcpkg/base/messages.cpp index 96d1f53186..ca378f1139 100644 --- a/src/vcpkg/base/messages.cpp +++ b/src/vcpkg/base/messages.cpp @@ -742,4 +742,7 @@ namespace vcpkg REGISTER_MESSAGE(WaitingToTakeFilesystemLock); REGISTER_MESSAGE(WarningMessageMustUsePrintWarning); REGISTER_MESSAGE(WarningsTreatedAsErrors); + REGISTER_MESSAGE(MissmatchedBinParagraphs); + REGISTER_MESSAGE(OriginalBinParagraphHeader); + REGISTER_MESSAGE(SerializedBinParagraphHeader); } diff --git a/src/vcpkg/binaryparagraph.cpp b/src/vcpkg/binaryparagraph.cpp index 70de9e4d17..34cf57ad33 100644 --- a/src/vcpkg/binaryparagraph.cpp +++ b/src/vcpkg/binaryparagraph.cpp @@ -289,56 +289,30 @@ namespace vcpkg auto binary_paragraph = BinaryParagraph(*parsed_paragraph.get()); if (binary_paragraph != pgh) { - const auto& join_str = R"(", ")"; - Checks::exit_maybe_upgrade( - VCPKG_LINE_INFO, - R"([sanity check] The serialized binary paragraph was different from the original binary paragraph. -Please open an issue at https://github.com/microsoft/vcpkg, with the following output: - -=== Original BinaryParagraph === -spec: "%s" -version: "%s" -port_version: %d -description: ["%s"] -maintainers: ["%s"] -feature: "%s" -default_features: ["%s"] -dependencies: ["%s"] -abi: "%s" -type: %s - -=== Serialized BinaryParagraph === -spec: "%s" -version: "%s" -port_version: %d -description: ["%s"] -maintainers: ["%s"] -feature: "%s" -default_features: ["%s"] -dependencies: ["%s"] -abi: "%s" -type: %s -)", - pgh.spec.to_string(), - pgh.version, - pgh.port_version, - Strings::join(join_str, pgh.description), - Strings::join(join_str, pgh.maintainers), - pgh.feature, - Strings::join(join_str, pgh.default_features), - Strings::join(join_str, pgh.dependencies), - pgh.abi, - Type::to_string(pgh.type), - binary_paragraph.spec.to_string(), - binary_paragraph.version, - binary_paragraph.port_version, - Strings::join(join_str, binary_paragraph.description), - Strings::join(join_str, binary_paragraph.maintainers), - binary_paragraph.feature, - Strings::join(join_str, binary_paragraph.default_features), - Strings::join(join_str, binary_paragraph.dependencies), - binary_paragraph.abi, - Type::to_string(binary_paragraph.type)); + Checks::msg_exit_maybe_upgrade(VCPKG_LINE_INFO, + msg::format(msgMissmatchedBinParagraphs) + .append(msgOriginalBinParagraphHeader) + .append_raw(format_binary_paragraph(pgh)) + .append(msgSerializedBinParagraphHeader) + .append_raw(format_binary_paragraph(binary_paragraph))); } } + + std::string format_binary_paragraph(BinaryParagraph paragraph) + { + const auto& join_str = R"(", ")"; + return ( + "\nspec: \"%s\"\nversion: \"%s\"\nport_version: %d\ndescription: [\"%s\"]\nmaintainers: [\"%s\"]\nfeature: " + "\"%s\"\ndefault_features: [\"%s\"]\ndependencies: [\"%s\"]\nabi: \"%s\"\ntype: %s", + paragraph.spec.to_string(), + paragraph.version, + paragraph.port_version, + Strings::join(join_str, paragraph.description), + Strings::join(join_str, paragraph.maintainers), + paragraph.feature, + Strings::join(join_str, paragraph.default_features), + Strings::join(join_str, paragraph.dependencies), + paragraph.abi, + Type::to_string(paragraph.type)); + } } diff --git a/src/vcpkg/sourceparagraph.cpp b/src/vcpkg/sourceparagraph.cpp index dda9b433de..a2bdb81405 100644 --- a/src/vcpkg/sourceparagraph.cpp +++ b/src/vcpkg/sourceparagraph.cpp @@ -1439,7 +1439,7 @@ namespace vcpkg } if (start_of_chunk != end_of_chunk) { - msg::println_error(LocalizedString::from_raw(StringView{start_of_chunk, end_of_chunk})); + msg::write_unlocalized_text_to_stdout(Color::error, StringView{start_of_chunk, end_of_chunk}); start_of_chunk = end_of_chunk; } } From 9fe54485d09f2b6bb44956ae7ebe5178e629f6c1 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Thu, 21 Jul 2022 16:14:12 -0700 Subject: [PATCH 58/61] wip --- src/vcpkg/binaryparagraph.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vcpkg/binaryparagraph.cpp b/src/vcpkg/binaryparagraph.cpp index 34cf57ad33..b21e4bf390 100644 --- a/src/vcpkg/binaryparagraph.cpp +++ b/src/vcpkg/binaryparagraph.cpp @@ -301,7 +301,7 @@ namespace vcpkg std::string format_binary_paragraph(BinaryParagraph paragraph) { const auto& join_str = R"(", ")"; - return ( + return Strings::format( "\nspec: \"%s\"\nversion: \"%s\"\nport_version: %d\ndescription: [\"%s\"]\nmaintainers: [\"%s\"]\nfeature: " "\"%s\"\ndefault_features: [\"%s\"]\ndependencies: [\"%s\"]\nabi: \"%s\"\ntype: %s", paragraph.spec.to_string(), From 2dd25764d0bd533dc77009e2923213da4834cdb6 Mon Sep 17 00:00:00 2001 From: Javier Matos Date: Thu, 21 Jul 2022 16:18:08 -0700 Subject: [PATCH 59/61] sort --- include/vcpkg/base/messages.h | 18 +++++++++--------- src/vcpkg/base/messages.cpp | 6 +++--- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/vcpkg/base/messages.h b/include/vcpkg/base/messages.h index 081c17aa23..2d12aa57b5 100644 --- a/include/vcpkg/base/messages.h +++ b/include/vcpkg/base/messages.h @@ -711,8 +711,8 @@ namespace vcpkg (msg::value), "'{value}' is a command line option.", "'--{value}' specified multiple times."); - DECLARE_MESSAGE(EmptyArg, (msg::option), "", "The option --{option} must be passed a non-empty argument."); DECLARE_MESSAGE(EmailVcpkgTeam, (msg::url), "", "Send an email to {url} with any feedback."); + DECLARE_MESSAGE(EmptyArg, (msg::option), "", "The option --{option} must be passed a non-empty argument."); DECLARE_MESSAGE(EmptyLicenseExpression, (), "", "SPDX license expression was empty."); DECLARE_MESSAGE(EnvStrFailedToExtract, (), "", "could not expand the environment string:"); DECLARE_MESSAGE(ErrorDetectingCompilerInfo, @@ -1106,6 +1106,11 @@ namespace vcpkg "paragraph.\nPlease open an issue at {url}, with the following output:"); DECLARE_MESSAGE(Missing7zHeader, (), "", "Unable to find 7z header."); DECLARE_MESSAGE(MissingExtension, (msg::extension), "", "Missing '{extension}' extension."); + DECLARE_MESSAGE(MissmatchedBinParagraphs, + (), + "", + "The serialized binary paragraph was different from the original binary paragraph. Please open an " + "issue at https://github.com/microsoft/vcpkg with the following output:"); DECLARE_MESSAGE(MonoInstructions, (), "", @@ -1116,6 +1121,7 @@ namespace vcpkg (msg::path, msg::exit_code), "", "msiexec failed while extracting \"{path}\" with launch or exit code {exit_code} and message:"); + DECLARE_MESSAGE(MultiArch, (msg::option), "", "Multi-Arch must be 'same' but was {option}"); DECLARE_MESSAGE(NavigateToNPS, (msg::url), "", "Please navigate to {url} in your preferred browser."); DECLARE_MESSAGE(NewConfigurationAlreadyExists, (msg::path), @@ -1141,7 +1147,7 @@ namespace vcpkg (msg::path), "", "NuGet package creation succeeded, but no .nupkg was produced. Expected: \"{path}\""); - DECLARE_MESSAGE(MultiArch, (msg::option), "", "Multi-Arch must be 'same' but was {option}"); + DECLARE_MESSAGE(OriginalBinParagraphHeader, (), "", "\nOriginal Binary Paragraph"); DECLARE_MESSAGE(PackageFailedtWhileExtracting, (msg::value, msg::path), "'{value}' is either a tool name or a package name.", @@ -1208,6 +1214,7 @@ namespace vcpkg "{value} may be either a 'vendor' like 'Azure' or 'NuGet', or a file path like C:\\example or /usr/example", "Restored {count} package(s) from {value} in {elapsed}. Use --debug to see more details."); DECLARE_MESSAGE(ResultsHeader, (), "Displayed before a list of installation results.", "RESULTS"); + DECLARE_MESSAGE(SerializedBinParagraphHeader, (), "", "\nSerialized Binary Paragraph"); DECLARE_MESSAGE(SettingEnvVar, (msg::env_var, msg::url), "An example of env_var is \"HTTP(S)_PROXY\"" @@ -1441,11 +1448,4 @@ namespace vcpkg "The message named {value} starts with warning:, it must be changed to prepend " "WarningMessage in code instead."); DECLARE_MESSAGE(WarningsTreatedAsErrors, (), "", "previous warnings being interpreted as errors"); - DECLARE_MESSAGE(MissmatchedBinParagraphs, - (), - "", - "The serialized binary paragraph was different from the original binary paragraph. Please open an " - "issue at https://github.com/microsoft/vcpkg with the following output:"); - DECLARE_MESSAGE(OriginalBinParagraphHeader, (), "", "\nOriginal Binary Paragraph"); - DECLARE_MESSAGE(SerializedBinParagraphHeader, (), "", "\nSerialized Binary Paragraph"); } diff --git a/src/vcpkg/base/messages.cpp b/src/vcpkg/base/messages.cpp index ca378f1139..bbbe3cce96 100644 --- a/src/vcpkg/base/messages.cpp +++ b/src/vcpkg/base/messages.cpp @@ -637,6 +637,7 @@ namespace vcpkg REGISTER_MESSAGE(MismatchedBinaryParagraphs); REGISTER_MESSAGE(Missing7zHeader); REGISTER_MESSAGE(MissingExtension); + REGISTER_MESSAGE(MissmatchedBinParagraphs); REGISTER_MESSAGE(MonoInstructions); REGISTER_MESSAGE(MsiexecFailedToExtract); REGISTER_MESSAGE(MultiArch); @@ -652,6 +653,7 @@ namespace vcpkg REGISTER_MESSAGE(NoLocalizationForMessages); REGISTER_MESSAGE(NoRegistryForPort); REGISTER_MESSAGE(NugetPackageFileSucceededButCreationFailed); + REGISTER_MESSAGE(OriginalBinParagraphHeader); REGISTER_MESSAGE(PackageFailedtWhileExtracting); REGISTER_MESSAGE(PackageRootDir); REGISTER_MESSAGE(PackingVendorFailed); @@ -673,6 +675,7 @@ namespace vcpkg REGISTER_MESSAGE(RestoredPackage); REGISTER_MESSAGE(RestoredPackagesFromVendor); REGISTER_MESSAGE(ResultsHeader); + REGISTER_MESSAGE(SerializedBinParagraphHeader); REGISTER_MESSAGE(SettingEnvVar); REGISTER_MESSAGE(SourceFieldPortNameMismatch); REGISTER_MESSAGE(SpecifiedFeatureTurnedOff); @@ -742,7 +745,4 @@ namespace vcpkg REGISTER_MESSAGE(WaitingToTakeFilesystemLock); REGISTER_MESSAGE(WarningMessageMustUsePrintWarning); REGISTER_MESSAGE(WarningsTreatedAsErrors); - REGISTER_MESSAGE(MissmatchedBinParagraphs); - REGISTER_MESSAGE(OriginalBinParagraphHeader); - REGISTER_MESSAGE(SerializedBinParagraphHeader); } From 805643c8d53d6c98ad1254529c51508db7757088 Mon Sep 17 00:00:00 2001 From: Javier Matos Denizac Date: Thu, 21 Jul 2022 16:43:37 -0700 Subject: [PATCH 60/61] Update src/vcpkg/binaryparagraph.cpp Co-authored-by: Billy O'Neal --- src/vcpkg/binaryparagraph.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vcpkg/binaryparagraph.cpp b/src/vcpkg/binaryparagraph.cpp index b21e4bf390..817ae92619 100644 --- a/src/vcpkg/binaryparagraph.cpp +++ b/src/vcpkg/binaryparagraph.cpp @@ -301,9 +301,9 @@ namespace vcpkg std::string format_binary_paragraph(BinaryParagraph paragraph) { const auto& join_str = R"(", ")"; - return Strings::format( - "\nspec: \"%s\"\nversion: \"%s\"\nport_version: %d\ndescription: [\"%s\"]\nmaintainers: [\"%s\"]\nfeature: " - "\"%s\"\ndefault_features: [\"%s\"]\ndependencies: [\"%s\"]\nabi: \"%s\"\ntype: %s", + return fmt::format( + "\nspec: \"{}\"\nversion: \"{}\"\nport_version: {}\ndescription: [\"{}\"]\nmaintainers: [\"{}\"]\nfeature: " + "\"{}\"\ndefault_features: [\"{}\"]\ndependencies: [\"{}\"]\nabi: \"{}\"\ntype: {}", paragraph.spec.to_string(), paragraph.version, paragraph.port_version, From 53c2afb5b682d10cbabf6afbc5472384006b546a Mon Sep 17 00:00:00 2001 From: Javier Matos Denizac Date: Thu, 21 Jul 2022 16:43:43 -0700 Subject: [PATCH 61/61] Update src/vcpkg/binaryparagraph.cpp Co-authored-by: Billy O'Neal --- src/vcpkg/binaryparagraph.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vcpkg/binaryparagraph.cpp b/src/vcpkg/binaryparagraph.cpp index 817ae92619..87731e9165 100644 --- a/src/vcpkg/binaryparagraph.cpp +++ b/src/vcpkg/binaryparagraph.cpp @@ -300,7 +300,7 @@ namespace vcpkg std::string format_binary_paragraph(BinaryParagraph paragraph) { - const auto& join_str = R"(", ")"; + constexpr StringLiteral join_str = R"(", ")"; return fmt::format( "\nspec: \"{}\"\nversion: \"{}\"\nport_version: {}\ndescription: [\"{}\"]\nmaintainers: [\"{}\"]\nfeature: " "\"{}\"\ndefault_features: [\"{}\"]\ndependencies: [\"{}\"]\nabi: \"{}\"\ntype: {}",