Skip to content

Commit

Permalink
Unsupported platform added for env (fixes #29559) (#891)
Browse files Browse the repository at this point in the history
* Unsupported platform added for env (fixes #29559)

* Unsupported platform added for env (fixes #29559)

* Revert error on linux, for testing CI

* Ignore error on linux

* Revert settings change

* Localized message
  • Loading branch information
soroshsabz committed Feb 13, 2023
1 parent 0d4f2fb commit 0798425
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
4 changes: 3 additions & 1 deletion azure-pipelines/end-to-end-tests-dir/env-tools.ps1
Expand Up @@ -2,4 +2,6 @@

$env:VCPKG_DOWNLOADS = Join-Path $TestingRoot 'empty downloads'
Run-Vcpkg env --bin --tools --python set
Throw-IfFailed
if ($IsWindows) {
Throw-IfFailed
}
1 change: 1 addition & 0 deletions include/vcpkg/base/messages.h
Expand Up @@ -1100,6 +1100,7 @@ namespace vcpkg
"{value} is the invalid value of an environment variable",
"{env_var} is {value}, must be > 0");
DECLARE_MESSAGE(EnvStrFailedToExtract, (), "", "could not expand the environment string:");
DECLARE_MESSAGE(EnvPlatformNotSupported, (), "", "Build environment commands are not supported on this platform");
DECLARE_MESSAGE(ErrorDetectingCompilerInfo,
(msg::path),
"",
Expand Down
1 change: 1 addition & 0 deletions locales/messages.json
Expand Up @@ -389,6 +389,7 @@
"EnvInvalidMaxConcurrency": "{env_var} is {value}, must be > 0",
"_EnvInvalidMaxConcurrency.comment": "{value} is the invalid value of an environment variable An example of {env_var} is VCPKG_DEFAULT_TRIPLET.",
"EnvStrFailedToExtract": "could not expand the environment string:",
"EnvPlatformNotSupported": "Build environment commands are not supported on this platform",
"ErrorDetectingCompilerInfo": "while detecting compiler information:\nThe log file content at \"{path}\" is:",
"_ErrorDetectingCompilerInfo.comment": "An example of {path} is /foo/bar.",
"ErrorIndividualPackagesUnsupported": "In manifest mode, `vcpkg install` does not support individual package arguments.\nTo install additional packages, edit vcpkg.json and then run `vcpkg install` without any package arguments.",
Expand Down
1 change: 1 addition & 0 deletions src/vcpkg/base/messages.cpp
Expand Up @@ -663,6 +663,7 @@ namespace vcpkg
REGISTER_MESSAGE(EndOfStringInCodeUnit);
REGISTER_MESSAGE(EnvInvalidMaxConcurrency);
REGISTER_MESSAGE(EnvStrFailedToExtract);
REGISTER_MESSAGE(EnvPlatformNotSupported);
REGISTER_MESSAGE(ErrorDetectingCompilerInfo);
REGISTER_MESSAGE(ErrorIndividualPackagesUnsupported);
REGISTER_MESSAGE(ErrorInvalidClassicModeOption);
Expand Down
7 changes: 6 additions & 1 deletion src/vcpkg/commands.env.cpp
Expand Up @@ -101,11 +101,16 @@ namespace vcpkg::Commands::Env
#if defined(_WIN32)
env = cmd_execute_and_capture_environment(build_env_cmd, env);
#else // ^^^ _WIN32 / !_WIN32 vvv
Checks::exit_with_message(VCPKG_LINE_INFO, "Build environment commands are not supported on this platform");
Checks::msg_exit_with_message(VCPKG_LINE_INFO, msgEnvPlatformNotSupported);
#endif // ^^^ !_WIN32
}

#if defined(_WIN32)
Command cmd("cmd");
#else // ^^^ _WIN32 / !_WIN32 vvv
Command cmd("");
Checks::msg_exit_with_message(VCPKG_LINE_INFO, msgEnvPlatformNotSupported);
#endif // ^^^ !_WIN32
if (!args.command_arguments.empty())
{
cmd.string_arg("/c").raw_arg(args.command_arguments[0]);
Expand Down

0 comments on commit 0798425

Please sign in to comment.