Skip to content

Conversation

@Yusyuriv
Copy link
Member

@Yusyuriv Yusyuriv commented May 23, 2024

What I did

I did four things (in the order of their impact on the size):

  1. Removed NLog.Web.AspNetCore dependency (and NLog.Schema, but that's most likely barely noticeable). As far as I can tell, it wasn't used anywhere directly, but had a pretty big contibution to the build size. Removing this dependency made the build about 25-30 MB smaller. The only part where this dependency was kind of used is in Flow.Launcher.Plugin.Program/Main.cs:
    using Microsoft.Extensions.Caching.Memory;
    This seems to be one of the dependencies it was bringing with itself. I added dependency on Microsoft.Extensions.Caching.Memory directly to the Program plugin.
  2. Flow.Launcher.Plugin.BrowserBookmark included all kinds of SQLite runtimes: browser-wasm, osx-arm64, linux-x64, etc. Since Flow Launcher is a Windows-only program, I don't see the point of having all the additional runtimes. I deleted all of them except ones starting with win-. This freed up about 20 MB.
  3. In Flow.Launcher project, I removed all Resources.[lang].resx files. There were 22 of them, and all of them had the same data: normal icon of Flow Launcher and game mode icon, but the icons were included at build step as base64-encoded strings, so each of those .resx files was adding about 150 KB to the size. Not that much, but it's nice to free that space.
  4. Added <SatelliteResourceLanguages>en</SatelliteResourceLanguages> in all plugin projects. This prevents dependencies like Microsoft.VisualStudio.Threading/Validation from adding their own translation files to the output of plugin builds. Users shouldn't be able to see these messages anyway, so there's no point in keeping them in the builds. Besides, Flow.Launcher itself and a few plugins already had that attribute. Again, these files were tiny, this is just a nice visual cleanup.
    No more this Everything's nice and clean
    Folder with folders for different languages Folder with no language folders

Result

Before After
Size before Size after

Notice that the build after these changes has much fewer files and folders, which is a plus in my book.

The testing I've done

  • It correctly launches from Rider both in regular mode and in debug mode and works as expected. Logs are getting written correctly (since this is a change regarding a part of NLog).
  • dotnet publish Flow.Launcher/Flow.Launcher.csproj -c Release -o bin/Release-new --self-contained works, the output launches and works normally
  • dotnet publish "Plugins/Flow.Launcher.Plugin.$name/Flow.Launcher.Plugin.$name.csproj" -c Release -o "bin/Release-new/Plugins/Flow.Launcher.Plugin.$name" works, Flow Launcher correctly picks up built plugins and the plugins do work

Screenshot of the BrowserBookmark plugin working after these changes:
BrowserBookmark

@Yusyuriv Yusyuriv self-assigned this May 23, 2024
@Yusyuriv Yusyuriv marked this pull request as ready for review May 23, 2024 08:36
@Yusyuriv Yusyuriv merged commit ec26321 into dev May 26, 2024
@Yusyuriv Yusyuriv deleted the reduce-build-size branch May 26, 2024 00:06
@jjw24 jjw24 added the enhancement New feature or request label Jun 24, 2024
@jjw24 jjw24 added this to the 1.19.0 milestone Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants