From a8e97d4a4b22d489123dc6d673ceee2c203dc046 Mon Sep 17 00:00:00 2001 From: Victor Romero Date: Fri, 15 Jan 2021 00:04:28 -0800 Subject: [PATCH] [vcpkg] Format JSON output of `x-add-version` to minimize diffs (#15664) * Fix output json file format * Add instructions to fix missing versions file --- toolsrc/src/vcpkg/commands.add-version.cpp | 6 ++++-- toolsrc/src/vcpkg/commands.civerifyversions.cpp | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/toolsrc/src/vcpkg/commands.add-version.cpp b/toolsrc/src/vcpkg/commands.add-version.cpp index 9d7a74465e..fc288eb138 100644 --- a/toolsrc/src/vcpkg/commands.add-version.cpp +++ b/toolsrc/src/vcpkg/commands.add-version.cpp @@ -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( @@ -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( diff --git a/toolsrc/src/vcpkg/commands.civerifyversions.cpp b/toolsrc/src/vcpkg/commands.civerifyversions.cpp index 82a98aa9d6..84aab9c019 100644 --- a/toolsrc/src/vcpkg/commands.civerifyversions.cpp +++ b/toolsrc/src/vcpkg/commands.civerifyversions.cpp @@ -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; }