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

Added system architecture to winget --info. #1937

Merged
merged 5 commits into from
Feb 24, 2022

Conversation

jedieaston
Copy link
Contributor

@jedieaston jedieaston commented Feb 14, 2022


Resolves #1925 (yes, I know it was my issue. just had to leave myself a reminder :D)

This PR adds the system architecture to winget --info, cutting out the first question we usually ask when troubleshooting.

image

Microsoft Reviewers: Open in CodeFlow

@jedieaston jedieaston requested a review from a team as a code owner February 14, 2022 14:55
@ghost ghost added Area-Architecture Issue related to processor architecture Issue-Feature This is a feature request for the Windows Package Manager client. labels Feb 14, 2022
@JohnMcPMS
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@@ -173,6 +173,8 @@ namespace AppInstaller::CLI
info << std::endl <<
"Windows: "_liv << Runtime::GetOSVersion() << std::endl;

info << Resource::String::Architecture << ": "_liv << Utility::ToString(Utility::GetSystemArchitecture()) << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

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

We haven't enforced the output rule yet, but I think the Utility::ToString(Utility::GetSystemArchitecture()) needs to be wrapped inside LocIndString

Copy link
Member

Choose a reason for hiding this comment

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

Utility::ToString(Architecture) could probably be changed to return a loc independent view. If it turns out we need to localize it in the future, that can be its own problem.

@@ -1272,4 +1272,7 @@ Please specify one of them using the `--source` option to proceed.</value>
<data name="InvalidArgumentWithoutQueryError" xml:space="preserve">
<value>The arguments provided can only be used with a query.</value>
</data>
<data name="Architecture" xml:space="preserve">
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: shall we match the variable name with the value so we don't misuse this in the future?

@jedieaston
Copy link
Contributor Author

Sorry for the delay, I made it localization independent when the command is called. I tried to do as @JohnMcPMS suggested and just change the type to LocIndView, but since LocIndView is also defined inside of that project, it seemed to create a circular dependency somehow (although since LocIndView wasn't relying on anything in AppInstallerArchitecture.h, I'm not sure why). Does anyone have any ideas on how to fix that?

@yao-msft
Copy link
Contributor

Sorry for the delay, I made it localization independent when the command is called. I tried to do as @JohnMcPMS suggested and just change the type to LocIndView, but since LocIndView is also defined inside of that project, it seemed to create a circular dependency somehow (although since LocIndView wasn't relying on anything in AppInstallerArchitecture.h, I'm not sure why). Does anyone have any ideas on how to fix that?

I just tried adding #include "winget/LocIndependent.h" to AppInstallerArchitectures.h and modified the declaration and definition of the method. I did not see circular dependency in rebuilding. If somehow this still won't work for you, I'm fine with merging with current code. Just let me know. Thanks.

@jedieaston
Copy link
Contributor Author

It was the missing header :(

Thanks @yao-msft.

{
switch (architecture)
{
case Architecture::Neutral:
return "Neutral"sv;
return LocIndView("Neutral"sv);
Copy link
Contributor

Choose a reason for hiding this comment

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

To make code a bit cleaner and consistent with other places. We may want to use our custom string literals(_liv).

        using namespace literals;

        switch (architecture)
        {
        case Architecture::Neutral:
            return "Neutral"_liv;
        case Architecture::X86:
            return "X86"_liv;
        case Architecture::X64:
            return "X64"_liv;
        case Architecture::Arm:
            return "Arm"_liv;
        case Architecture::Arm64:
            return "Arm64"_liv;
        }

        return "Unknown"_liv;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to use them but was missing the namespace. Oops, my header game is weak this week.

@denelon
Copy link
Contributor

denelon commented Feb 22, 2022

Does this work in the Sandbox? I submitted an Issue for "Screen To Gif". I wanted to make sure we're checking the host architecture, for this scenario or at least be aware of limitations.

@yao-msft
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@yao-msft yao-msft merged commit 015c9e3 into microsoft:master Feb 24, 2022
@jedieaston
Copy link
Contributor Author

Does this work in the Sandbox? I submitted an Issue for "Screen To Gif". I wanted to make sure we're checking the host architecture, for this scenario or at least be aware of limitations.

Sorry I didn't get to this sooner, yes it works in the Sandbox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Architecture Issue related to processor architecture Issue-Feature This is a feature request for the Windows Package Manager client.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

winget --info should print the system architecture
4 participants