Skip to content

Commit

Permalink
[vcpkg] Format JSON output of x-add-version to minimize diffs (#15664)
Browse files Browse the repository at this point in the history
* Fix output json file format

* Add instructions to fix missing versions file
  • Loading branch information
vicroms authored Jan 15, 2021
1 parent 0e46f93 commit a8e97d4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 4 additions & 2 deletions toolsrc/src/vcpkg/commands.add-version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ namespace
}

std::error_code ec;
fs.write_contents(output_path, Json::stringify(serialize_baseline(baseline_map), {}), ec);
fs.write_contents(
output_path, Json::stringify(serialize_baseline(baseline_map), Json::JsonStyle::with_spaces(2)), ec);
if (ec)
{
System::printf(
Expand Down Expand Up @@ -127,7 +128,8 @@ namespace

std::error_code ec;
fs.create_directories(output_path.parent_path(), VCPKG_LINE_INFO);
fs.write_contents(output_path, Json::stringify(serialize_versions(versions), {}), ec);
fs.write_contents(
output_path, Json::stringify(serialize_versions(versions), Json::JsonStyle::with_spaces(2)), ec);
if (ec)
{
System::printf(
Expand Down
8 changes: 6 additions & 2 deletions toolsrc/src/vcpkg/commands.civerifyversions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,13 @@ namespace vcpkg::Commands::CIVerifyVersions
{
System::printf(System::Color::error, "FAIL: %s\n", port_name);
errors.emplace(Strings::format("Error: While validating port %s.\n"
" Missing expected versions file at: %s",
" Missing expected versions file at: %s\n"
" Run:\n\n"
" vcpkg x-add-version %s\n\n"
" to create the versions file.",
port_name,
fs::u8string(versions_file_path)));
fs::u8string(versions_file_path),
port_name));
continue;
}

Expand Down

0 comments on commit a8e97d4

Please sign in to comment.