Skip to content

Vcpkg Package Manager #2925

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

Merged
merged 43 commits into from
Nov 10, 2024
Merged

Conversation

mrixner
Copy link
Contributor

@mrixner mrixner commented Nov 3, 2024

  • I have read the contributing guidelines, and I agree with the Code of Conduct.
  • Have you checked that there aren't other open pull requests for the same changes?
  • Have you tested that the committed code can be executed without errors?
  • This PR is not composed of garbage changes used to farm GitHub activity to enter potential Crypto AirDrops.
    Any user suspected of farming GitHub activity with crypto purposes will get banned. Submitting broken code wastes the contributors' time, who have to spend their free time reviewing, fixing, and testing code that does not even compile breaks other features, or does not introduce any useful changes. I appreciate your understanding.

TODO before merging (for @marticliment)

  • Add the VCPkg icon to symbol icon table
  • Add the setting to specify the default triplet.

This pull request is for support for the vcpkg package manager.

I'm sorry if the code is not good, this is my first time ever working with C#. I tried to write code in the style of all the other package managers and not touch more than I needed to.

List of Added Translations:

  • vcpkg ManagerProperties Description (A popular C/C++ library manager. Full of C/C++ libraries and other C/C++-related utilities<br>Contains: <b>C/C++ libraries and related utilities</b>)
  • InvalidOperationException value (Cannot update vcpkg port files as requested: git was not installed or the VCPKG_ROOT environment variable / the custom vcpkg root setting were not set)
  • Automatic Portfile Update Setting Title (Update vcpkg's Git portfiles automatically (requires Git installed))
  • Default vcpkg Triplet Setting Title (Default vcpkg triplet)
  • Custom vcpkg Root Setting Title (Custom vcpkg root)

Manager Capabilities (for the table on the home page):

Install as administrator: yes (for vcpkg roots in an admin-locked directory)
Skip integrity checks: no (I don't think vcpkg has this capability, or if it has integrity checks to skip)
Interactive installation: no (it's being built from the command-line; there's no interactivity to show)
Install Older Versions: no (vcpkg doesn't support this on a global scale, only for projects with vcpkg.json control files)
Install a PreRelease Version: no (vcpkg doesn't have pre-release versions)
Install a Custom Architecture: not directly supported but can be easily achieved (via using a different triplet / source)
Install on a Custom Scope: no (everything just gets installed to the vcpkg directory)
Custom Install Location: no / sort of not directly supported but can be easily achieved? (everything just gets installed to the vcpkg directory; you can change which vcpkg directory via the "Custom vcpkg root" setting)
Custom Package Sources: not directly supported but can be easily achieved (it will automatically detect custom triplet / source CMake scripts dropped into %VCPKG_ROOT%\triplets or %VCPKG_ROOT%\triplets\community)

Other Potentially Unresolved Things

  • I have added a colored icon, but as src/UniGetUI.PackageEngine.Managers.Vcpkg/Vcpkg.cs:65 states, discussion How can I add an icon to my language in Tolgee #2826 brought me to believe that an outlined icon must be added by the maintainers, so if you care enough that may be one thing that needs to happen.
  • I would recommend probably squash-merging this if you weren't going to already, as I pretty much just edited the file for package manager-specific settings and the files for the package manager. Unfortunately, I accidentally forgot to commit some changes for some commits, so not all commits compile as requested in the Contributing Guidelines.
  • As mentioned in [FEATURE REQUEST] VCPKG support? #2146: The DefaultVcpkgTriplet setting isn't being set properly, but I was told to leave the UI to Marti, and so that's what I'm doing.

Closes #2146

mrixner and others added 27 commits October 14, 2024 21:41
Also add empty array returns for GetAvailableUpdates_UnSafe and GetInstalledPackages_UnSafe to allow building.
(for GetInstalledPackages_UnSafe())
@marticliment
Copy link
Owner

Hey, I have been looking at the code, and I have found this:
image

There is an overridable method on the PackageManager class (public void RefreshPackageIndexes()) that will be called by UniGetUI when needed to update the sources.
I will move the code there, but I reckon if you then think the Settings.Get("UpdateVcpkgGitPorts") is still needed or not

@marticliment
Copy link
Owner

Also, do you think it would make sense to list git as a dependency for vcpkg, so if the user doesn't have git installed UniGetUI prompts them to install it?

…tting, as it isn't necessary (this was tested)
@mrixner
Copy link
Contributor Author

mrixner commented Nov 8, 2024

OK, looking through the UI, the settings UIs look really great, and everything major works as intended. However, there's a few things I noticed.

  • The default triplet dropdown shows a restart required banner when it doesn't need to (fixed in 2e5a166)
  • I was hoping the first time you viewed the default triplet dropdown the value would be the default triplet as determined elsewhere, however this is a tiny nitpick and I understand if it's not possible.
  • In the "discover" list of searched packages, if you have a package installed for a different triplet than the one you're searching for it still shows the little "installed" icon. I'm not sure what it is using to compare that, but I assumed that given that the package IDs are different, that would be different as well?
  • As mentioned in the last comment, due to removal of custom sources, you can no longer filter the vcpkg packages by their triplet. This is also trivial and possibly intended / doesn't matter, but if there's an easy way to add that I think that could be helpful.

I'll look through all the diffs to see if there's anything else I missed.

@mrixner
Copy link
Contributor Author

mrixner commented Nov 8, 2024

I removed the unnecessary restart required banner, fixed a typo, and made Vcpkg.GetDefaultTriplet public. I did not remove any of the TODOs dealing with DisableUpdateVcpkgGitPorts, in case it's not something you want to keep.

I noticed this in the commit log; is there an implementation to think about? (it's been shifted to SettingPage.xaml.cs:441)
image

@marticliment
Copy link
Owner

  • As mentioned in the last comment, due to removal of custom sources, you can no longer filter the vcpkg packages by their triplet. This is also trivial and possibly intended / doesn't matter, but if there's an easy way to add that I think that could be helpful.

Oh, this actually makes sense.
What I will do is I will add source compatibility again, but I will manually remove the Source Manager UI from the settings window.

  • I was hoping the first time you viewed the default triplet dropdown the value would be the default triplet as determined elsewhere, however this is a tiny nitpick and I understand if it's not possible.

This can be kinda fixed. On the LoadManager() method, you can check if the setting is empty, and if it is not set, it can be set to a default value. I don't know how to get the system default triplet, but if you know how to and you want to fix this it'd be great,

  • In the "discover" list of searched packages, if you have a package installed for a different triplet than the one you're searching for it still shows the little "installed" icon. I'm not sure what it is using to compare that, but I assumed that given that the package IDs are different, that would be different as well?

If I enable source support again this issue should fix itself.

I noticed this in the commit log; is there an implementation to think about? (it's been shifted to SettingPage.xaml.cs:441)

This might me my fault, VS might have created it automatically and then I used a lambda. I will get this fixed.

@mrixner
Copy link
Contributor Author

mrixner commented Nov 9, 2024

What I will do is I will add source compatibility again, but I will manually remove the Source Manager UI from the settings window.

Sounds good, thank you!

This can be kinda fixed. On the LoadManager() method, you can check if the setting is empty, and if it is not set, it can be set to a default value. I don't know how to get the system default triplet, but if you know how to and you want to fix this it'd be great,

Yes, I noticed and realized this as I was looking through the settings to add a restart required banner for #2883. I'll go do that in a second. [edit: fixed in f47ab63]

If I enable source support again this issue should fix itself.

Ahh, of course. That makes sense.

@mrixner
Copy link
Contributor Author

mrixner commented Nov 9, 2024

If I enable source support again this issue should fix itself.

Unfortunately, it doesn't seem to have fixed itself.

image
image

CORRECTION: this doesn't work when an item was just uninstalled, but it does if it's not installed when UniGetUI starts. Therefore, this is not an issue.
image

I think all of my concerns have been resolved.

@marticliment
Copy link
Owner

CORRECTION: this doesn't work when an item was just uninstalled, but it does if it's not installed when UniGetUI starts. Therefore, this is not an issue.

This is a bug I am aware of, uninstalled packages still show as installed on the discover page

@marticliment
Copy link
Owner

I will merge once I add the icon. The rest looks fine for me

@mrixner
Copy link
Contributor Author

mrixner commented Nov 9, 2024

I will merge once I add the icon. The rest looks fine for me

OK, thank you! Do you need me to make the icon, or will you do that yourself?

@mrixner
Copy link
Contributor Author

mrixner commented Nov 9, 2024

Also, just a note in case any issues are opened about vcpkg package discovery taking a while - I have tested this by running vcpkg search from the command line, and the first search operation every while just takes a rather long time (I assume because of caching); this isn't an issue with UniGetUI.

@marticliment
Copy link
Owner

OK, thank you! Do you need me to make the icon, or will you do that yourself?

I'll do this myself

@marticliment
Copy link
Owner

Vcpkg icon
image
image

@mrixner
Copy link
Contributor Author

mrixner commented Nov 10, 2024

Vcpkg icon image image

Looks great!

@marticliment marticliment merged commit 3eea653 into marticliment:main Nov 10, 2024
@mrixner mrixner deleted the vcpkg-package-manager branch November 10, 2024 22:14
@mrixner mrixner mentioned this pull request Dec 23, 2024
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE REQUEST] VCPKG support?
2 participants