Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make artifacts use common console handling. #1165

Merged
merged 8 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions azure-pipelines/end-to-end-tests-dir/integrate-install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ if (-not $IsLinux -and -not $IsMacOS) {
# Test msbuild props and targets
$Script:CurrentTest = "zlib:x86-windows msbuild $iiroot\..."
Write-Host $Script:CurrentTest
Run-Vcpkg @CommonArgs integrate install
BillyONeal marked this conversation as resolved.
Show resolved Hide resolved
Run-Vcpkg @CommonArgs install zlib:x86-windows
Throw-IfFailed
foreach ($project in @("Project1", "NoProps")) {
Expand Down
49 changes: 49 additions & 0 deletions include/vcpkg/base/message-data.inc.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ DECLARE_MESSAGE(AddTripletExpressionNotAllowed,
"",
"triplet expressions are not allowed here. You may want to change "
"`{package_name}:{triplet}` to `{package_name}` instead.")
DECLARE_MESSAGE(AddVersionArtifactsOnly,
(),
"'--version', and 'vcpkg add port' are command lines that must not be localized",
"--version is artifacts only and can't be used with vcpkg add port")
DECLARE_MESSAGE(AddVersionAddedVersionToFile, (msg::version, msg::path), "", "added version {version} to {path}")
DECLARE_MESSAGE(AddVersionCommitChangesReminder, (), "", "Did you remember to commit your changes?")
DECLARE_MESSAGE(AddVersionCommitResultReminder, (), "", "Don't forget to commit the result!")
Expand Down Expand Up @@ -177,6 +181,47 @@ DECLARE_MESSAGE(ArtifactsNotInstalledReadonlyRoot,
"readonly. Reinstalling vcpkg using the 'one liner' may fix this problem.")
DECLARE_MESSAGE(ArtifactsNotOfficialWarning, (), "", "Using vcpkg-artifacts with an unofficial ")
DECLARE_MESSAGE(ArtifactsOptionIncompatibility, (msg::option), "", "--{option} has no effect on find artifact.")
DECLARE_MESSAGE(ArtifactsOptionJson,
(),
"",
"Full path to JSON file where environment variables and other properties are recorded")
DECLARE_MESSAGE(ArtifactsOptionMSBuildProps,
(),
"",
"Full path to the file in which MSBuild properties will be written")
DECLARE_MESSAGE(ArtifactsOptionVersion, (), "", "A version or version range to match; only valid for artifacts")
DECLARE_MESSAGE(ArtifactsOptionVersionMismatch,
(),
"--version is a command line switch and must not be localized",
"The number of --version switches must match the number of named artifacts")
DECLARE_MESSAGE(ArtifactsSwitchAll, (), "", "Update all known artifact registries")
DECLARE_MESSAGE(ArtifactsSwitchAllLanguages, (), "", "Acquire all language files when acquiring artifacts")
DECLARE_MESSAGE(ArtifactsSwitchARM, (), "", "Force host detection to ARM when acquiring artifacts")
DECLARE_MESSAGE(ArtifactsSwitchARM64, (), "", "Force host detection to ARM64 when acquiring artifacts")
DECLARE_MESSAGE(ArtifactsSwitchForce, (), "", "Force reacquire if an artifact is already acquired")
DECLARE_MESSAGE(ArtifactsSwitchFreebsd, (), "", "Force host detection to FreeBSD when acquiring artifacts")
DECLARE_MESSAGE(ArtifactsSwitchLinux, (), "", "Force host detection to Linux when acquiring artifacts")
DECLARE_MESSAGE(ArtifactsSwitchNormalize, (), "", "Apply any deprecation fixups")
DECLARE_MESSAGE(ArtifactsSwitchTargetARM, (), "", "Set target detection to ARM when acquiring artifacts")
DECLARE_MESSAGE(ArtifactsSwitchTargetARM64, (), "", "Set target detection to ARM64 when acquiring artifacts")
DECLARE_MESSAGE(ArtifactsSwitchTargetX64, (), "", "Set target detection to x64 when acquiring artifacts")
DECLARE_MESSAGE(ArtifactsSwitchTargetX86, (), "", "Set target to x86 when acquiring artifacts")
DECLARE_MESSAGE(ArtifactsSwitchOnlyOneOperatingSystem,
(),
"The words after -- are command line switches and must not be localized.",
"Only one operating system (--windows, --osx, --linux, --freebsd) may be set.")
DECLARE_MESSAGE(ArtifactsSwitchOnlyOneHostPlatform,
(),
"The words after -- are command line switches and must not be localized.",
"Only one host platform (--x64, --x86, --arm, --arm64) may be set.")
DECLARE_MESSAGE(ArtifactsSwitchOnlyOneTargetPlatform,
(),
"The words after -- are command line switches and must not be localized.",
"Only one target platform (--target:x64, --target:x86, --target:arm, --target:arm64) may be set.")
DECLARE_MESSAGE(ArtifactsSwitchOsx, (), "", "Force host detection to MacOS when acquiring artifacts")
DECLARE_MESSAGE(ArtifactsSwitchX64, (), "", "Force host detection to x64 when acquiring artifacts")
DECLARE_MESSAGE(ArtifactsSwitchX86, (), "", "Force host detection to x86 when acquiring artifacts")
DECLARE_MESSAGE(ArtifactsSwitchWindows, (), "", "Force host detection to Windows when acquiring artifacts")
DECLARE_MESSAGE(AssetCacheProviderAcceptsNoArguments,
(msg::value),
"{value} is a asset caching provider name such as azurl, clear, or x-block-origin",
Expand Down Expand Up @@ -1058,6 +1103,10 @@ DECLARE_MESSAGE(FindHelp,
"'artifact' and 'port' are what the user must literally type.",
"Searches for the indicated artifact or port. With no parameter after 'artifact' or 'port', "
"displays everything.")
DECLARE_MESSAGE(FindVersionArtifactsOnly,
(),
"'--version', 'vcpkg search', and 'vcpkg find port' are command lines that must not be localized",
"--version can't be used with vcpkg search or vcpkg find port")
DECLARE_MESSAGE(FieldKindDidNotHaveExpectedValue,
(msg::expected, msg::actual),
"{expected} is a list of literal kinds the user must type, separated by commas, {actual} is what "
Expand Down
1 change: 1 addition & 0 deletions include/vcpkg/commands.acquire-project.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@

namespace vcpkg
{
extern const CommandMetadata CommandAcquireProjectMetadata;
void command_acquire_project_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
1 change: 1 addition & 0 deletions include/vcpkg/commands.acquire.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@

namespace vcpkg
{
extern const CommandMetadata CommandAcquireMetadata;
void command_acquire_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
1 change: 1 addition & 0 deletions include/vcpkg/commands.activate.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@

namespace vcpkg
{
extern const CommandMetadata CommandActivateMetadata;
void command_activate_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
2 changes: 0 additions & 2 deletions include/vcpkg/commands.find.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <vcpkg/fwd/vcpkgpaths.h>

#include <vcpkg/base/optional.h>
#include <vcpkg/base/span.h>
BillyONeal marked this conversation as resolved.
Show resolved Hide resolved
#include <vcpkg/base/stringview.h>

#include <string>
Expand All @@ -16,7 +15,6 @@ namespace vcpkg
bool enable_json,
Optional<StringView> filter,
View<std::string> overlay_ports);
void perform_find_artifact_and_exit(const VcpkgPaths& paths, Optional<StringView> filter);
extern const CommandMetadata CommandFindMetadata;
void command_find_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
1 change: 1 addition & 0 deletions include/vcpkg/commands.generate-msbuild-props.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@

namespace vcpkg
{
extern const CommandMetadata CommandGenerateMsbuildPropsMetadata;
void command_generate_msbuild_props_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
1 change: 1 addition & 0 deletions include/vcpkg/commands.use.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@

namespace vcpkg
{
extern const CommandMetadata CommandUseMetadata;
void command_use_and_exit(const VcpkgCmdArguments& args, const VcpkgPaths& paths);
}
23 changes: 22 additions & 1 deletion include/vcpkg/configure-environment.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <vcpkg/base/expected.h>
#include <vcpkg/base/span.h>
#include <vcpkg/base/stringview.h>
#include <vcpkg/base/util.h>

#include <string>

Expand All @@ -18,5 +19,25 @@ namespace vcpkg
const Path& download_root);

int run_configure_environment_command(const VcpkgPaths& paths, View<std::string> args);
int run_configure_environment_command(const VcpkgPaths& paths, StringView arg0, View<std::string> args);

template<size_t N>
bool more_than_one_mapped(const StringLiteral* const (&candidates)[N],
const std::set<std::string, std::less<>>& switches)
{
bool seen = false;
for (auto&& candidate : candidates)
{
if (Util::Sets::contains(switches, *candidate))
{
if (seen)
{
return true;
}

seen = true;
}
}

return false;
}
}
Loading