Skip to content

Commit

Permalink
pluginchecker ignore builtin dependencies for now
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikMennen committed Nov 13, 2024
1 parent 748c19d commit 188fede
Showing 1 changed file with 18 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ public static CompatibilityReport CheckCompatibilityPath(string path)
try
{
var pluginName = Path.GetFileName(path);

var depFilePath = Path.Combine(path, "compatibility.txt");

var compatibilityIssues = "";

if (!File.Exists(depFilePath))
{
compatibilityIssues += $"compatibility.txt not found in plugin folder\n";
Expand All @@ -33,7 +33,7 @@ public static CompatibilityReport CheckCompatibility(string? deps)
var compatibilityIssues = "";

if (deps == null) return new CompatibilityReport(false, "Error checking compatibility");

var depsList = deps.Trim().Split('\n');

foreach (var dep in depsList)
Expand All @@ -43,21 +43,25 @@ public static CompatibilityReport CheckCompatibility(string? deps)
var versionString = parts[1].Trim();
var dependencyVersion = Version.Parse(NormalizeVersion(versionString));

if(dependencyName is "OneWare.Markdown.Avalonia.Tight") dependencyName = "Markdown.Avalonia";
if(dependencyName is "OneWare.Markdown.Avalonia.SyntaxHigh") dependencyName = "Markdown.Avalonia.SyntaxHigh";

var assemblies = AppDomain.CurrentDomain.GetAssemblies();
switch (dependencyName)
{
//TODO
case "OneWare.Markdown.Avalonia.Tight":
case "OneWare.Markdown.Avalonia.SyntaxHigh":
case "OneWare.AvaloniaEdit":
case "OneWare.AvaloniaEdit.TextMate":
continue;
}

var test = assemblies.SingleOrDefault(x => x.GetName().Name == "Markdown.Avalonia");

var coreDep = assemblies.SingleOrDefault(x => x.GetName().Name == dependencyName)?.GetName();
var coreDep = AppDomain.CurrentDomain.GetAssemblies()
.SingleOrDefault(x => x.GetName().Name == dependencyName)?.GetName();

if (coreDep == null)
{
compatibilityIssues += $"Dependency {dependencyName} not found\n";
continue;
continue;
}

if (coreDep.Version < dependencyVersion)
compatibilityIssues +=
$"Required {dependencyName} : {dependencyVersion} > {coreDep.Version}\n";
Expand All @@ -73,7 +77,7 @@ public static CompatibilityReport CheckCompatibility(string? deps)
return new CompatibilityReport(false, e.Message);
}
}

static string NormalizeVersion(string version)
{
string[] parts = version.Split('.');
Expand All @@ -82,6 +86,7 @@ static string NormalizeVersion(string version)
Array.Resize(ref parts, parts.Length + 1);
parts[^1] = "0";
}

return string.Join('.', parts);
}
}

0 comments on commit 188fede

Please sign in to comment.