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

Delete Strings::format and no longer used unlocalized infrastructure. #909

Merged
merged 7 commits into from
Mar 4, 2023

Conversation

BillyONeal
Copy link
Member

@BillyONeal BillyONeal commented Feb 16, 2023

This PR is the ultimate result of merging the following localization PRs:

This fixes all known localization problems and makes future ones less likely by mostly removing the infrastructure to print unlocalized messages outright.

Audited:

  • print2 (deleted)
  • vcpkg::printf (deleted)
  • Checks::not-msg (deleted)
  • Strings::format (deleted)
  • ExpectedS (deleted)
  • Strings::append (retained)
  • Strings::concat (retained)
  • add_generic_error (retained)

@BillyONeal BillyONeal marked this pull request as draft February 16, 2023 05:03
BillyONeal added a commit to BillyONeal/vcpkg-tool that referenced this pull request Feb 27, 2023
@BillyONeal BillyONeal mentioned this pull request Feb 27, 2023
@BillyONeal BillyONeal changed the title Fix all known missing localization. Delete Strings::format and no longer used unlocalized infrastructure. Feb 27, 2023
@BillyONeal BillyONeal marked this pull request as ready for review March 3, 2023 01:32
@@ -91,25 +91,26 @@ namespace vcpkg::CMakeVars
const auto& fs = paths.get_filesystem();
std::string extraction_file;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could construct extraction_file with the initial prelude.

@@ -193,19 +193,17 @@ namespace vcpkg::Commands::DependInfo
for (const auto& package : depend_info)
{
const std::string name = package.package;
nodes.append(Strings::format("<Node Id=\"%s\" />", name));
fmt::format_to(std::back_inserter(nodes), "<Node Id=\"{}\" />", name);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[no change requested] This should really use XmlSerializer...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah :(

src/vcpkg/export.ifw.cpp Outdated Show resolved Hide resolved
src/vcpkg/export.prefab.cpp Outdated Show resolved Hide resolved
BillyONeal and others added 2 commits March 3, 2023 23:23
Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
@BillyONeal BillyONeal merged commit cb90d76 into microsoft:main Mar 4, 2023
@BillyONeal BillyONeal deleted the localization-more-more branch March 4, 2023 09:31
@autoantwort
Copy link
Contributor

This kind of broke the output format of duration.
Before

Detecting compiler hash for triplet arm64-osx...
The following packages will be rebuilt:
    boost-uninstall[core]:arm64-osx -> 1.81.0#2
Removing 1/2 boost-uninstall:arm64-osx
Elapsed time to handle boost-uninstall:arm64-osx: 1.948 ms
Restored 0 package(s) from /Users/leanderSchulten/.cache/vcpkg/archives in 114.9 us. Use --debug to see more details.
Attempting to fetch 1 package(s) from HTTP servers
Restored 0 package(s) from HTTP servers in 206 ms. Use --debug to see more details.
Installing 2/2 boost-uninstall:arm64-osx...
Building boost-uninstall[core]:arm64-osx...
warning: -- Using community triplet arm64-osx. This triplet configuration is not guaranteed to succeed.
-- [COMMUNITY] Loading triplet configuration from: /Users/leanderSchulten/git_projekte/vcpkg/triplets/community/arm64-osx.cmake
-- 
Please use the following command when you need to remove all boost ports/components:
    "./vcpkg remove boost-uninstall:arm64-osx --recurse"

-- Performing post-build validation
Uploaded binaries to 1 HTTP remotes.
Stored binary cache: "/Users/leanderSchulten/.cache/vcpkg/archives/66/669209711bf44e71d0470196cd78bc9b486cef0cf363c6cd577f9b70a053e1dc.zip"
Elapsed time to handle boost-uninstall:arm64-osx: 278.4 ms
Total install time: 487.1 ms

After:

Detecting compiler hash for triplet arm64-osx...
The following packages will be rebuilt:
    boost-uninstall[core]:arm64-osx -> 1.81.0#2
Removing 1/2 boost-uninstall:arm64-osx
Elapsed time to handle boost-uninstall:arm64-osx: 1.88325 ms
Restored 0 package(s) from /Users/leanderSchulten/.cache/vcpkg/archives in 682.708 us. Use --debug to see more details.
Attempting to fetch 1 package(s) from HTTP servers
Restored 0 package(s) from HTTP servers in 210.244292 ms. Use --debug to see more details.
Installing 2/2 boost-uninstall:arm64-osx...
Building boost-uninstall[core]:arm64-osx...
warning: -- Using community triplet arm64-osx. This triplet configuration is not guaranteed to succeed.
-- [COMMUNITY] Loading triplet configuration from: /Users/leanderSchulten/git_projekte/vcpkg/triplets/community/arm64-osx.cmake
-- 
Please use the following command when you need to remove all boost ports/components:
    "./vcpkg remove boost-uninstall:arm64-osx --recurse"

-- Performing post-build validation
Uploaded binaries to 1 HTTP remotes.
Stored binary cache: "/Users/leanderSchulten/.cache/vcpkg/archives/ea/ea1a7b9817b0c937939d837215893858a607c709475ce50a9119f085c3cf5089.zip"
Elapsed time to handle boost-uninstall:arm64-osx: 293.621666 ms
Total install time: 506.937584 ms

@autoantwort
Copy link
Contributor

autoantwort commented Mar 19, 2023

Since this PR vcpkg depend-info --dot vtk crashes with

vcpkg has crashed. Please create an issue at https://github.com/microsoft/vcpkg containing a brief summary of what you were trying to do and the following information.

Version=2999-12-31-unknownhash-debug
EXCEPTION=unmatched '}' in format string
CMD=
vcpkg|
depend-info|
--dot|
vtk|

@@ -466,7 +465,7 @@ namespace vcpkg::Commands::Integrate
.string_arg("-ExecutionPolicy")
.string_arg("Bypass")
.string_arg("-Command")
.string_arg(Strings::format("& {& '%s' }", script_path));
.string_arg(fmt::format("& {& '{}' }", script_path));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably the reason for the following crash: microsoft/vcpkg#30283

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can solve the problem of {} in the parsing path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants