Skip to content

Commit

Permalink
add versions
Browse files Browse the repository at this point in the history
  • Loading branch information
dellis1972 committed Oct 12, 2024
1 parent 15aebb0 commit b1b4d36
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions MonoGame.Framework.Content.Pipeline/ExternalTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ namespace Microsoft.Xna.Framework.Content.Pipeline
internal class ExternalTool
{
public static string Crunch = "mgcb-crunch";
private static string CrunchVersion = "1.0.4.2";
public static string BasisU = "mgcb-basisu";
private static string BasisUVersion = "1.16.4.2";

public static int Run(string command, string arguments)
{
Expand All @@ -32,19 +34,16 @@ public static int Run(string command, string arguments)
return result;
}

public static void RestoreDotnetTool(string command, string toolName, string path)
public static void RestoreDotnetTool(string command, string toolName, string toolVersion, string path)
{
if (Directory.Exists (Path.Combine(path, toolName)))
return;
Directory.CreateDirectory(path);
var exe = CurrentPlatform.OS == OS.Windows ? "dotnet.exe" : "dotnet";
var dotnetRoot = Environment.GetEnvironmentVariable("DOTNET_ROOT");
if (!string.IsNullOrEmpty(dotnetRoot))
{
exe = Path.Combine(dotnetRoot, exe);
}
var version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
if (Run(exe, $"tool {command} {toolName} --version {version} --tool-path .", out string _, out string _, workingDirectory: path) != 0)
if (Run(exe, $"tool {command} {toolName} --version {toolVersion} --tool-path .", out string _, out string _, workingDirectory: path) != 0)
{
// install the latest
Run(exe, $"tool {command} {toolName} --tool-path .", out _, out _, workingDirectory: path);
Expand All @@ -61,8 +60,8 @@ public static void RestoreDotnetTools()
path= Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "osx");
if (File.Exists(Path.Combine(path, $"tools_{version}.txt")))
return;
RestoreDotnetTool("install", Crunch, path);
RestoreDotnetTool("install", BasisU, path);
RestoreDotnetTool("install", Crunch, CrunchVersion, path);
RestoreDotnetTool("install", BasisU, BasisUVersion, path);
File.WriteAllText(Path.Combine(path, $"tools_{version}.txt"), version);
}

Expand Down

0 comments on commit b1b4d36

Please sign in to comment.