Skip to content

Commit

Permalink
Print path to compiler in output (#1328)
Browse files Browse the repository at this point in the history
* print compiler path

* update messages.json

* fix empty message

* fix format

* add tests and fix

* update vcpkg to latest commit

* fix

* fix

* Fix e2e test on Windows.

* Change scripts SHA to not include microsoft/vcpkg#36056

---------

Co-authored-by: Billy Robert O'Neal III <[email protected]>
  • Loading branch information
data-queue and BillyONeal authored Mar 4, 2024
1 parent 05f88ed commit 13fd7ab
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 2 deletions.
11 changes: 10 additions & 1 deletion azure-pipelines/end-to-end-tests-dir/build-test-ports.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@

$CurrentTest = "Build Test Ports"

Run-Vcpkg @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports" install vcpkg-internal-e2e-test-port3
$output = Run-VcpkgAndCaptureOutput @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports" install vcpkg-internal-e2e-test-port3
Throw-IfFailed
if ($output -match "Compiler found: ([^\r\n]+)") {
$detected = $matches[1]
if (-Not (Test-Path $detected)) {
throw "Did not print a valid compiler path (detected $detected)"
}
} else {
throw "Did not detect a compiler"
}


$output = Run-VcpkgAndCaptureOutput @commonArgs --overlay-ports="$PSScriptRoot/../e2e-ports/vcpkg-internal-e2e-test-port2" install vcpkg-internal-e2e-test-port2
Throw-IfFailed
Expand Down
1 change: 1 addition & 0 deletions include/vcpkg/base/message-data.inc.h
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,7 @@ DECLARE_MESSAGE(CommandFailed,
"{command_line}\n"
"failed with the following results:")
DECLARE_MESSAGE(CommunityTriplets, (), "", "Community Triplets:")
DECLARE_MESSAGE(CompilerPath, (msg::path), "", "Compiler found: {path}")
DECLARE_MESSAGE(CompressFolderFailed, (msg::path), "", "Failed to compress folder \"{path}\":")
DECLARE_MESSAGE(ComputingInstallPlan, (), "", "Computing installation plan...")
DECLARE_MESSAGE(ConfigurationErrorRegistriesWithoutBaseline,
Expand Down
1 change: 1 addition & 0 deletions include/vcpkg/commands.build.h
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ namespace vcpkg
std::string id;
std::string version;
std::string hash;
std::string path;
};

struct AbiInfo
Expand Down
2 changes: 2 additions & 0 deletions locales/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,8 @@
"CommandFailed": "command:\n{command_line}\nfailed with the following results:",
"_CommandFailed.comment": "An example of {command_line} is vcpkg install zlib.",
"CommunityTriplets": "Community Triplets:",
"CompilerPath": "Compiler found: {path}",
"_CompilerPath.comment": "An example of {path} is /foo/bar.",
"CompressFolderFailed": "Failed to compress folder \"{path}\":",
"_CompressFolderFailed.comment": "An example of {path} is /foo/bar.",
"ComputingInstallPlan": "Computing installation plan...",
Expand Down
10 changes: 10 additions & 0 deletions src/vcpkg/commands.build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,12 @@ namespace vcpkg
{
compiler_info.id = s.substr(MarkerCompilerCxxId.size()).to_string();
}
static constexpr StringLiteral s_path_marker = "#COMPILER_CXX_PATH#";
if (Strings::starts_with(s, s_path_marker))
{
const auto compiler_cxx_path = s.substr(s_path_marker.size());
compiler_info.path.assign(compiler_cxx_path.data(), compiler_cxx_path.size());
}
Debug::println(s);
const auto old_buf_size = buf.size();
Strings::append(buf, s, '\n');
Expand All @@ -702,6 +708,10 @@ namespace vcpkg
}

Debug::println("Detected compiler hash for triplet ", triplet, ": ", compiler_info.hash);
if (!compiler_info.path.empty())
{
msg::println(msgCompilerPath, msg::path = compiler_info.path);
}
return compiler_info;
}

Expand Down
2 changes: 1 addition & 1 deletion vcpkg-init/vcpkg-scripts-sha.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
66b4b34d99ab272fcf21f2bd12b616e371c6bb31
002c5b065927a6142dd7858813f25a10947094d8

0 comments on commit 13fd7ab

Please sign in to comment.