Idea: support ALGLIB via ILRepack / ILMerge
unquietwiki opened this issue ยท 2 comments
I discovered CKAN uses ILRepack to merge together multiple dependencies from NuGet, in order to release as a single EXE file. When I was messing around with the code here before, I noticed that ALGLIB is brought in whole via source; which hides the dependency from other mods, but makes the code harder to audit with debugging and linting tools (particularly since it uses a completely different code style). I feel like using ILRepack or ILMerge, combined with the ALGLIB NuGet, would resolve both issues of code management, and dealing with a third-party dependency in installs. I wanted to propose that here before attempting such on my own as a test.
@sarbian @lamont-granquist wanted to put this on your radar for thoughts. Also hope things are going alright on your respective ends.
I got bored/interested, so I tried it anyway. Used the command line to run ILRepack, instead of the MSBuild task (it needs to be able to find the directory with the Unity stuff easily). The final result is comparable to the original build method, plus only 1 DLL & not 2 or 3 (+System.Buffers +alglib.net).
ilrepack /out:D:\TEMP\MechJeb2.dll /lib:"%KSPDIR%\KSP_x64_Data\Managed" .\MechJeb2.dll .\alglib.net.dll .\System.Buffers.dll