Skip to content
Merged
Changes from all commits
Commits
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
33 changes: 30 additions & 3 deletions src/Build/src/ClearPluginAssemblies/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ protected static void Clear(string paths, IList<string> fileNames, bool saveLoca
if (directoryInfo.GetFiles().Length == 0 && directoryInfo.GetDirectories().Length == 0 && !saveLocalesFolders)
directoryInfo.Delete(true);
}

// Delete runtimes folder after clearing assemblies
DeleteRuntimesFolder(pluginPath);
}
catch
{
Expand All @@ -49,14 +52,38 @@ protected static void Clear(string paths, IList<string> fileNames, bool saveLoca
}
}

/// <summary>
/// Deletes the runtimes folder from the plugin directory.
/// The runtimes folder contains platform-specific native libraries for cross-platform support.
/// Since we build for a specific OS, these folders are unnecessary and waste disk space.
/// </summary>
/// <param name="pluginPath">The path to the plugin directory</param>
protected static void DeleteRuntimesFolder(string pluginPath)
{
try
{
var runtimesPath = Path.Combine(pluginPath, "runtimes");
if (Directory.Exists(runtimesPath))
{
Directory.Delete(runtimesPath, recursive: true);
Console.WriteLine($"Deleted runtimes folder from: {pluginPath}");
}
}
catch (Exception ex)
{
// Log the error but don't fail the build
Console.WriteLine($"Warning: Could not delete runtimes folder from {pluginPath}: {ex.Message}");
}
}

private static void Main(string[] args)
{
var outputPath = string.Empty;
var pluginPaths = string.Empty;
var saveLocalesFolders = true;

var settings = args.FirstOrDefault(a => a.Contains('|')) ?? string.Empty;
if(string.IsNullOrEmpty(settings))
if (string.IsNullOrEmpty(settings))
return;

foreach (var arg in settings.Split('|'))
Expand All @@ -79,8 +106,8 @@ private static void Main(string[] args)
break;
}
}
if(!Directory.Exists(outputPath))

if (!Directory.Exists(outputPath))
return;

var di = new DirectoryInfo(outputPath);
Expand Down