From a126bfd4dd086fdf3ccd5492788dbe54bacc10ee Mon Sep 17 00:00:00 2001 From: Paul Pacheco Date: Tue, 22 Sep 2020 11:56:54 -0500 Subject: [PATCH] Simplify method signature --- .../Mirror/Editor/Weaver/CompilationFinishedHook.cs | 4 +++- Assets/Mirror/Editor/Weaver/Weaver.cs | 12 +++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Assets/Mirror/Editor/Weaver/CompilationFinishedHook.cs b/Assets/Mirror/Editor/Weaver/CompilationFinishedHook.cs index 8e195c55c..7c659b2c3 100644 --- a/Assets/Mirror/Editor/Weaver/CompilationFinishedHook.cs +++ b/Assets/Mirror/Editor/Weaver/CompilationFinishedHook.cs @@ -142,9 +142,11 @@ static void OnCompilationFinished(string assemblyPath, CompilerMessage[] message } HashSet dependencyPaths = GetDependecyPaths(assemblyPath); + dependencyPaths.Add(Path.GetDirectoryName(mirrorRuntimeDll)); + dependencyPaths.Add(Path.GetDirectoryName(unityEngineCoreModuleDLL)); // passing null in the outputDirectory param will do an in-place update of the assembly - if (Weaver.Process(unityEngineCoreModuleDLL, mirrorRuntimeDll, assemblyPath, dependencyPaths.ToArray(), HandleWarning, HandleError)) + if (Weaver.Process(assemblyPath, dependencyPaths.ToArray(), HandleWarning, HandleError)) { // NOTE: WeaveFailed is critical for unit tests but isn't used elsewhere WeaveFailed = false; diff --git a/Assets/Mirror/Editor/Weaver/Weaver.cs b/Assets/Mirror/Editor/Weaver/Weaver.cs index e8fc13be6..32c8aed29 100644 --- a/Assets/Mirror/Editor/Weaver/Weaver.cs +++ b/Assets/Mirror/Editor/Weaver/Weaver.cs @@ -281,15 +281,13 @@ static bool WeaveModule(ModuleDefinition moduleDefinition) } } - static bool Weave(string assName, IEnumerable dependencies, string unityEngineDLLPath, string mirrorNetDLLPath) + static bool Weave(string assName, IEnumerable dependencies) { using (DefaultAssemblyResolver asmResolver = new DefaultAssemblyResolver()) using (CurrentAssembly = AssemblyDefinition.ReadAssembly(assName, new ReaderParameters { ReadWrite = true, ReadSymbols = true, AssemblyResolver = asmResolver })) { asmResolver.AddSearchDirectory(Path.GetDirectoryName(assName)); asmResolver.AddSearchDirectory(Helpers.UnityEngineDllDirectoryName()); - asmResolver.AddSearchDirectory(Path.GetDirectoryName(unityEngineDLLPath)); - asmResolver.AddSearchDirectory(Path.GetDirectoryName(mirrorNetDLLPath)); if (dependencies != null) { foreach (string path in dependencies) @@ -325,14 +323,14 @@ static bool Weave(string assName, IEnumerable dependencies, string unity return true; } - static bool WeaveAssembly(string assembly, IEnumerable dependencies, string unityEngineDLLPath, string mirrorNetDLLPath) + static bool WeaveAssembly(string assembly, IEnumerable dependencies) { WeavingFailed = false; WeaveLists = new WeaverLists(); try { - return Weave(assembly, dependencies, unityEngineDLLPath, mirrorNetDLLPath); + return Weave(assembly, dependencies); } catch (Exception e) { @@ -342,11 +340,11 @@ static bool WeaveAssembly(string assembly, IEnumerable dependencies, str } - public static bool Process(string unityEngine, string netDLL, string assembly, string[] extraAssemblyPaths, Action printWarning, Action printError) + public static bool Process(string assembly, string[] extraAssemblyPaths, Action printWarning, Action printError) { Log.WarningMethod = printWarning; Log.ErrorMethod = printError; - return WeaveAssembly(assembly, extraAssemblyPaths, unityEngine, netDLL); + return WeaveAssembly(assembly, extraAssemblyPaths); } } }