Skip to content

Build - add beta build support for windows (and linux maybe)#245

Open
broken-droid wants to merge 8 commits into
Moonfin-Client:mainfrom
broken-droid:build/beta-variants
Open

Build - add beta build support for windows (and linux maybe)#245
broken-droid wants to merge 8 commits into
Moonfin-Client:mainfrom
broken-droid:build/beta-variants

Conversation

@broken-droid
Copy link
Copy Markdown
Contributor

@broken-droid broken-droid commented May 17, 2026

Summary

add beta build support for windows, and probably linux since it's similar
add an env var in your launch config for MOONFIN_BETA_BUILD to true - this is needed for cmake changes
also pass it in command line with --dart-define - this is for flutter constants in the app for changing paths

added build-windows-beta.ps1 script to handle setting the env and passing --dart-define for building if you want something that runs on command line.

Beta builds will now have separate path locations for their data if you set env and pass the dart-define.

Using build flavors with 'beta' will use these path changes too.

example launch.json for vscode

    {
      "name": "Moonfin (Windows - Beta)",
      "request": "launch",
      "type": "dart",
      "program": "lib/main.dart",
      "flutterMode": "debug",
      "deviceId": "windows",
      "env": {
        "MOONFIN_BETA_BUILD": "true"
      },
      "args": [
        "--dart-define=MOONFIN_BETA_BUILD=true"
      ]
    },

Windows wasn't able to get dart-define at the cmake level, only in flutter compilation. So you need to do both steps for windows.
Linux may be able to get them during cmake, but safer to just match windows and use both the env and pass --dart-define to make sure until someone can try.

Type of Change

  • Build/CI change

Changes Made

  • added handling of env var 'MOONFIN_BETA_BUILD' in both windows and linux CMakeLists.txt
  • conditionally set different output file properties in Runner.rc
  • conditionally change the window title in the application in main.cpp/my_application.cc
  • add a static helper in storage_path_service.dart that checks for the 'MOONFIN_BETA_BUILD', from passing --dart-define. This is used to set different write paths depending on build type.
  • added flavor detection, and flavors with 'beta' will use the beta app paths too.
  • getOfflineRoot, getDatabaseFile, and getImageCacheDir now use the conditional path string instead of the hardcoded 'Moonfin'
  • database_connection_impl.io.dart now uses the static helper that was added to storage_path_service.dart to use a conditional path too

Platform

  • Windows
  • Linux
  • All / Shared code
    Some hardcoded paths were changed, this will affect all platforms if the env var is used in your build configuration.

Testing

  • Tested on physical device
  • Manual testing completed
  • Not tested (explain why):
    only windows was tested, linux might work if someone tries

Test Steps

  1. Add MOONFIN_BETA_BUILD env to launch.json
  2. Run/Debug
  3. Verify new build exe name, and distinct storage paths for the beta variant

Checklist

  • Code builds successfully
  • Code follows project style and conventions
  • No unnecessary commented-out code
  • No new warnings introduced

@mattsigal
Copy link
Copy Markdown

Hero!

@broken-droid broken-droid force-pushed the build/beta-variants branch from 6e5b0ae to 39fc56e Compare May 17, 2026 04:40
@broken-droid
Copy link
Copy Markdown
Contributor Author

macos and ios should be able to have a setup like android with flavors. I can give it a shot if you want, but I can't try it out.

@broken-droid
Copy link
Copy Markdown
Contributor Author

broken-droid commented May 17, 2026

also, maybe paths should change for windows

getApplicationCacheDirectory - local profile, includes application name
getApplicationDocumentsDirectory - user documents folder
getApplicationSupportDirectory - roaming profile, includes application name

does the db path need to be visible, or are other files going in there too?
Usually cache related things would go in local. Configs and auth stuff in roaming.

Probably doesn't matter that much and I'm not sure what other platforms need, just a thought

… so we'll just check for that. Also runtime may not have the env set anymore which wouldn't make sense.

Windows can't see dart-define in the cmake process, linux might be able to.

Changed getImageCacheDir path for windows, since it includes the app name already
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants