Skip to content

Commit

Permalink
Bootstrap vcpkg the first time it gets updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
marticliment committed Feb 8, 2025
1 parent 3c9f6c5 commit f03eb8f
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/UniGetUI.PackageEngine.Managers.Vcpkg/Vcpkg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public class Vcpkg : PackageManager
public Dictionary<string, ManagerSource> TripletSourceMap;
public static Uri URI_VCPKG_IO = new Uri("https://vcpkg.io/");

private bool hasBeenBootstrapped;

public Vcpkg()
{
Dependencies = [
Expand Down Expand Up @@ -373,6 +375,30 @@ public override void RefreshPackageIndexes()
processLogger.AddToStdOut(p.StandardOutput.ReadToEnd());
processLogger.AddToStdErr(p.StandardError.ReadToEnd());
processLogger.Close(p.ExitCode);

if (!hasBeenBootstrapped)
{
p = new()
{
StartInfo = new ProcessStartInfo
{
FileName = "cmd.exe",
WorkingDirectory = vcpkgRoot,
Arguments = "/C .\\bootstrap-vcpkg.bat",
UseShellExecute = false,
// RedirectStandardOutput = true,
// RedirectStandardError = true,
CreateNoWindow = true
}
};
IProcessTaskLogger processLogger2 = TaskLogger.CreateNew(LoggableTaskType.RefreshIndexes, p);
p.Start();
p.WaitForExit();
// processLogger2.AddToStdOut(p.StandardOutput.ReadToEnd());
// processLogger2.AddToStdErr(p.StandardError.ReadToEnd());
processLogger2.Close(p.ExitCode);
hasBeenBootstrapped = true;
}
}

public static Tuple<bool, string> GetVcpkgPath()
Expand Down

0 comments on commit f03eb8f

Please sign in to comment.