From 1908dab36022f8cbf35a2966d1caf46257043980 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Sat, 5 Oct 2019 20:58:48 -0700 Subject: [PATCH] Recompile extension scripts when dependencies are updated All plugins depend on PluginCommon.dll and CommonUtil.dll. If either of those is newer than the plugin DLL, we need to recompile. --- SourceGen/Sandbox/PluginDllCache.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/SourceGen/Sandbox/PluginDllCache.cs b/SourceGen/Sandbox/PluginDllCache.cs index e45bc99..adf5f8c 100644 --- a/SourceGen/Sandbox/PluginDllCache.cs +++ b/SourceGen/Sandbox/PluginDllCache.cs @@ -149,8 +149,17 @@ namespace SourceGen.Sandbox { string destFileName = ef.GenerateDllName(projectPathName); string destPathName = Path.Combine(GetPluginDirPath(), destFileName); - // Compile if necessary. - if (FileUtil.FileMissingOrOlder(destPathName, srcPathName)) { + // Compile if necessary. We do this if the source code is newer, or if the + // DLLs that plugins depend on have been updated. (We're checking the dates on + // the DLLs the app uses, not the copy the plugins use, but earlier we made sure + // that they were the same. This test doesn't handle the case where the DLLs + // get rolled back, but that's probably not interesting for us.) + bool needCompile = FileUtil.FileMissingOrOlder(destPathName, srcPathName) || + FileUtil.FileMissingOrOlder(destPathName, + typeof(PluginCommon.PluginManager).Assembly.Location) || + FileUtil.FileMissingOrOlder(destPathName, + typeof(CommonUtil.CRC32).Assembly.Location); + if (needCompile) { Debug.WriteLine("Compiling " + srcPathName + " to " + destPathName); Assembly asm = CompileCode(srcPathName, destPathName, out report); if (asm == null) {