Skip to content

Added system architecture to winget --info. - #1937

Merged
yao-msft merged 5 commits into
microsoft:masterfrom
jedieaston:youre-no-match-for-my-arch
Feb 24, 2022
Merged

yao-msft merged 5 commits into
microsoft:masterfrom
jedieaston:youre-no-match-for-my-arch

Conversation

@jedieaston

@jedieaston Easton Pillay (jedieaston) commented Feb 14, 2022 •

Copy link
Copy Markdown
Contributor

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
Easton Pillay (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
Comment thread src/AppInstallerCLIPackage/Shared/Strings/en-us/winget.resw Outdated
Co-authored-by: JohnMcPMS <johnmcp@microsoft.com>
@JohnMcPMS

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

info << std::endl <<
"Windows: "_liv << Runtime::GetOSVersion() << std::endl;

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

Copy link
Copy Markdown
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
Copy Markdown
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.

<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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

It was the missing header :(

Thanks yao-msft.

{
case Architecture::Neutral:
return "Neutral"sv;
return LocIndView("Neutral"sv);

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Collaborator

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
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

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

Copy link
Copy Markdown
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