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

Vcpkg Package Manager #2925

Merged
merged 43 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
f11bdf8
Add the vcpkg package manager skeleton
mrixner Oct 15, 2024
0d48b30
Add vcpkg to the list of aware-of package managers
mrixner Oct 15, 2024
aedc533
Add vcpkg icons
mrixner Oct 15, 2024
27c05db
Add triplet sources
mrixner Oct 15, 2024
c244593
Implement vcpkg LoadManager
mrixner Oct 15, 2024
7bd2e00
Add missing files that I forgot to commit to Git before
mrixner Oct 15, 2024
6af5edb
Refactor the vcpkg triplet sources to be in a map
mrixner Oct 15, 2024
7d69c39
Implement vcpkg GetInstalledPackages_UnSafe
mrixner Oct 15, 2024
e9c636a
Add setting to automatically update vcpkg Git portfiles
mrixner Oct 15, 2024
7464752
Add a function to get the vcpkg path from the VCPKG_ROOT environment …
mrixner Oct 16, 2024
c83be88
Implement the UpdateVcpkgGitPorts setting
mrixner Oct 16, 2024
f91c4d3
Fix formatting
mrixner Oct 16, 2024
6f84b38
Implement vcpkg GetAvailableUpdates_UnSafe
mrixner Oct 16, 2024
4da622d
Add a TODO
mrixner Oct 16, 2024
6ca2c89
Implement vcpkg FindPackages_UnSafe
mrixner Nov 2, 2024
3a55cc8
Add the CustomVcpkgRoot setting
mrixner Nov 2, 2024
68649c9
Implement the CustomVcpkgRoot setting to allow locating vcpkg without…
mrixner Nov 2, 2024
a6f66d4
Remove comments
mrixner Nov 2, 2024
3961829
Implement Vcpkg GetOperationResult
mrixner Nov 2, 2024
8dd7745
Implement Vcpkg GetOperationParameters
mrixner Nov 2, 2024
f442bf9
Polish source retrieval
mrixner Nov 2, 2024
c9a5b99
Fix typo
mrixner Nov 2, 2024
5d11022
Merge branch 'main' into vcpkg-package-manager
mrixner Nov 2, 2024
b9650fc
Add and implement the DefaultVcpkgTriplet setting
mrixner Nov 3, 2024
b160fd5
Merge branch 'vcpkg-package-manager' of https://github.com/mrixner/Un…
mrixner Nov 3, 2024
bd24844
Merge branch 'main' into vcpkg-package-manager
mrixner Nov 3, 2024
ec3b5a3
Merge branch 'main' into vcpkg-package-manager
marticliment Nov 8, 2024
ea594cc
Extract refresh sources procedure to RefreshPackageIndexes(), other i…
marticliment Nov 8, 2024
3228086
Improvements to loggers
marticliment Nov 8, 2024
f921db2
Small improvements
marticliment Nov 8, 2024
6a64806
Improvements to the settings UI for vcpkg
marticliment Nov 8, 2024
2e5a166
Remove the restart required banner for the changed default triplet se…
mrixner Nov 8, 2024
305e85b
Correct typo
mrixner Nov 8, 2024
5ac62e3
Make Vcpkg.GetDefaultTriplet public in case it's needed elsewhere (pr…
mrixner Nov 8, 2024
f47ab63
Change the starting triplet to the default triplet
mrixner Nov 9, 2024
cf20404
Improvements
marticliment Nov 9, 2024
9ef50ba
Add git as a dependency
marticliment Nov 9, 2024
d8b9bfe
Add parse-pip-search dependency to pip, improvements to git dependenc…
marticliment Nov 9, 2024
7f251e4
Merge branch 'main' into vcpkg-package-manager
marticliment Nov 9, 2024
7e07141
Add vcpkg svg icon
marticliment Nov 10, 2024
b7ecdc3
Update fonts
marticliment Nov 10, 2024
d8acbfa
Update icon font glyph for vcpkg
marticliment Nov 10, 2024
a78f148
incorrect comment
marticliment Nov 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/UniGetUI.Interface.Enums/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ public enum IconType
Warning_Round = '\uE93F',
WinGet = '\uE940',
Rust = '\uE941',
Vcpkg = '\uE942'
}

public class NotificationArguments
Expand Down
12 changes: 12 additions & 0 deletions src/UniGetUI.PackageEngine.Managers.Pip/Pip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using UniGetUI.Core.Tools;
using UniGetUI.Interface.Enums;
using UniGetUI.PackageEngine.Classes.Manager;
using UniGetUI.PackageEngine.Classes.Manager.Classes;
using UniGetUI.PackageEngine.Classes.Manager.ManagerHelpers;
using UniGetUI.PackageEngine.Enums;
using UniGetUI.PackageEngine.ManagerClasses.Classes;
Expand All @@ -18,6 +19,17 @@ public class Pip : PackageManager

public Pip()
{
Dependencies = [
// parse_pip_search is required for pip package finding to work
new ManagerDependency(
"parse-pip-search",
Path.Join(Environment.SystemDirectory, "windowspowershell\\v1.0\\powershell.exe"),
"-ExecutionPolicy Bypass -NoLogo -NoProfile -Command \"& {python.exe "
+ "-m pip install parse_pip_search; if($error.count -ne 0){pause}}\"",
"python -m pip install parse_pip_search",
async () => (await CoreTools.WhichAsync("parse_pip_search.exe")).Item1)
];

Capabilities = new ManagerCapabilities
{
CanRunAsAdmin = true,
Expand Down
3 changes: 1 addition & 2 deletions src/UniGetUI.PackageEngine.Managers.Scoop/Scoop.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,7 @@ protected override IEnumerable<Package> FindPackages_UnSafe(string query)
}

if (FALSE_PACKAGE_IDS.Contains(elements[0])
|| FALSE_PACKAGE_VERSIONS.Contains(elements[1])
|| FALSE_PACKAGE_VERSIONS.Contains(elements[2]))
|| FALSE_PACKAGE_VERSIONS.Contains(elements[1]))
{
continue;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System.Runtime.InteropServices;
using UniGetUI.Core.Tools;
using UniGetUI.PackageEngine.Classes.Manager.BaseProviders;
using UniGetUI.PackageEngine.Enums;
using UniGetUI.PackageEngine.Interfaces;

namespace UniGetUI.PackageEngine.Managers.VcpkgManager;
internal sealed class VcpkgOperationProvider : BaseOperationProvider<Vcpkg>
{
public VcpkgOperationProvider(Vcpkg manager) : base(manager) { }

public override IEnumerable<string> GetOperationParameters(IPackage package, IInstallationOptions options, OperationType operation)
{
List<string> parameters = operation switch {
OperationType.Install => [Manager.Properties.InstallVerb, package.Id],
OperationType.Update => [Manager.Properties.UpdateVerb, package.Id, "--no-dry-run"],
OperationType.Uninstall => [Manager.Properties.UninstallVerb, package.Id],
_ => throw new InvalidDataException("Invalid package operation")
};

parameters.AddRange(options.CustomParameters);
return parameters;
}

public override OperationVeredict GetOperationResult(
IPackage package,
OperationType operation,
IEnumerable<string> processOutput,
int returnCode)
{
return returnCode == 0 ? OperationVeredict.Succeeded : OperationVeredict.Failed;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using UniGetUI.Core.SettingsEngine;
using UniGetUI.Core.Tools;
using UniGetUI.PackageEngine.Classes.Manager;
using UniGetUI.PackageEngine.Classes.Manager.Providers;
using UniGetUI.PackageEngine.Enums;
using UniGetUI.PackageEngine.Interfaces;
using UniGetUI.PackageEngine.ManagerClasses.Manager;

namespace UniGetUI.PackageEngine.Managers.VcpkgManager
{
internal sealed class VcpkgSourceProvider : BaseSourceProvider<PackageManager>
{
public VcpkgSourceProvider(Vcpkg manager) : base(manager) { }

public override string[] GetAddSourceParameters(IManagerSource source)
=> throw new NotImplementedException();

public override string[] GetRemoveSourceParameters(IManagerSource source)
=> throw new NotImplementedException();

protected override OperationVeredict _getAddSourceOperationVeredict(IManagerSource source, int ReturnCode, string[] Output)
=> throw new NotImplementedException();

protected override OperationVeredict _getRemoveSourceOperationVeredict(IManagerSource source, int ReturnCode, string[] Output)
=> throw new NotImplementedException();

protected override IEnumerable<IManagerSource> GetSources_UnSafe()
{
List<ManagerSource> Sources = [];
// Retrieve all triplets on the system (in %VCPKG_ROOT%\triplets{\community})
var (vcpkgRootFound, vcpkgRoot) = Vcpkg.GetVcpkgRoot();
if (vcpkgRootFound)
{
string tripletLocation = Path.Join(vcpkgRoot, "triplets");
string communityTripletLocation = Path.Join(vcpkgRoot, "triplets", "community");

foreach (string tripletFile in Directory.EnumerateFiles(tripletLocation).Concat(Directory.EnumerateFiles(communityTripletLocation)))
{
string triplet = Path.GetFileNameWithoutExtension(tripletFile);
Sources.Add(new ManagerSource(Manager, triplet, Vcpkg.URI_VCPKG_IO));
}
}

return Sources;
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
<RuntimeIdentifier>win-$(Platform)</RuntimeIdentifier>
<Platforms>x64</Platforms>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<WindowsSdkPackageVersion>10.0.22621.47</WindowsSdkPackageVersion>
<SdkVersion>8.0.401</SdkVersion>
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
<PublishSelfContained>true</PublishSelfContained>
<Authors>Martí Climent and the contributors</Authors>
<PublisherName>Martí Climent</PublisherName>
<Nullable>enable</Nullable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Configurations>Debug;Release</Configurations>
</PropertyGroup>

<PropertyGroup>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\UniGetUI.Core.Classes\UniGetUI.Core.Classes.csproj" />
<ProjectReference Include="..\UniGetUI.Core.Data\UniGetUI.Core.Data.csproj" />
<ProjectReference Include="..\UniGetUI.Core.IconStore\UniGetUI.Core.IconEngine.csproj" />
<ProjectReference Include="..\UniGetUI.Core.LanguageEngine\UniGetUI.Core.LanguageEngine.csproj" />
<ProjectReference Include="..\UniGetUI.Core.Logger\UniGetUI.Core.Logging.csproj" />
<ProjectReference Include="..\UniGetUI.Core.Settings\UniGetUI.Core.Settings.csproj" />
<ProjectReference Include="..\UniGetUI.Core.Tools\UniGetUI.Core.Tools.csproj" />
<ProjectReference Include="..\UniGetUI.Interface.Enums\UniGetUI.Interface.Enums.csproj" />
<ProjectReference Include="..\UniGetUI.PackageEngine.Enums\UniGetUI.PackageEngine.Structs.csproj" />
<ProjectReference Include="..\UniGetUI.PAckageEngine.Interfaces\UniGetUI.PackageEngine.Interfaces.csproj" />
<ProjectReference Include="..\UniGetUI.PackageEngine.PackageManagerClasses\UniGetUI.PackageEngine.Classes.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Include="..\SharedAssemblyInfo.cs" Link="SharedAssemblyInfo.cs" />
</ItemGroup>
</Project>
Loading
Loading