Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Add macOS "Bundle data folder into .app" checkbox / --bundle-data flag - #714

Open
danoli3 wants to merge 1 commit into
masterfrom
fix/macos-bundle-data-folder-toggle
Open

danoli3 wants to merge 1 commit into
masterfrom
fix/macos-bundle-data-folder-toggle

Conversation

@danoli3

@danoli3 danoli3 commented Nov 25, 2026

Copy link
Copy Markdown
Member

Summary

Adds a macOS-only toggle for the APPSTORE block that bundles `bin/data/` into the built `.app`. Previously users had to hand-edit `Project.xcconfig` to uncomment `OF_BUNDLE_DATA_FOLDER = 1`, and the edit got lost every regen because `.xcodeproj/` (and the xcconfig sitting next to it) is typically gitignored.

  • CLI: new `--bundle-data=1|0` (osx / macos only; no flag leaves the xcconfig unchanged). Applied in `xcodeProject::saveProjectFile` after `saveAppleSettings()` so the explicit flag beats the merge's "preserve user's divergence" behavior, and collapses any duplicate `OF_BUNDLE_DATA_FOLDER` lines a prior merge may have left behind.
  • GUI: Semantic UI checkbox under Bundle ID in advanced mode, shown only when the selected platform includes `osx` or `macos`. State is read back from the project's `Project.xcconfig` on load (via `readProjectSettings` / `assignments()`, which strips commented lines), so the checkbox reflects what's on disk and the user's own toggle is the last word.

CLI verification (scratch macos projects inside the oF tree)

Scenario Result
Fresh gen, no flag `//OF_BUNDLE_DATA_FOLDER = 1` (template default)
Regen `--bundle-data=1` `OF_BUNDLE_DATA_FOLDER = 1`
Regen `--bundle-data=0` `//OF_BUNDLE_DATA_FOLDER = 1`
User hand-uncomments, regen `--bundle-data=0` `//OF_BUNDLE_DATA_FOLDER = 1` (force off, merge override works)
Regen on `-pvs` with `--bundle-data=1` No-op (no `Project.xcconfig` in the vs template)
`--bundle-data=garbage` Warning logged, xcconfig untouched

Also tested `-pmacos` (not just `-posx`) and the duplicate-line collapse (the merge can leave both a template-commented and user-uncommented `OF_BUNDLE_DATA_FOLDER` line; the toggle collapses them to a single one in the requested state).

GUI verification

  • `node --check` on `app.js`, `index.js`, `project-settings.js` — all clean.
  • Unit test of `readProjectSettings` parsing:
    • commented line → `bundleDataFolder: false`
    • uncommented `OF_BUNDLE_DATA_FOLDER = 1` → `bundleDataFolder: true`
    • absent → `bundleDataFolder: false`

The checkbox round-trips through `setProjectSettings` → `bundleDataFolder` in `gen` → `--bundle-data=1|0` on the CLI, and the Semantic UI `.ui.checkbox.checked` class is kept in sync for proper visual state.

Scope

Only `OF_BUNDLE_DATA_FOLDER` for now, matching the specific issue. The sibling `OF_CODESIGN` and `OF_BUNDLE_DYLIBS` lines in the same APPSTORE block could get the same treatment in a follow-up if wanted.

Versions

  • GUI: `0.125.0` → `0.126.0`
  • CLI: `0.130` → `0.131`
  • `python3 scripts/check_release_versions.py origin/master` → `Release versions OK: GUI 0.126.0, CLI 0.131.0`

Test plan

  • CLI `--bundle-data=1` uncomments on `-posx` and `-pmacos`
  • CLI `--bundle-data=0` re-comments, including forcing off a user-enabled project
  • CLI no-flag leaves xcconfig untouched
  • Non-apple targets ignore the flag
  • Invalid flag value warns and leaves xcconfig alone
  • Duplicate `OF_BUNDLE_DATA_FOLDER` lines (from merge) collapse on explicit toggle
  • GUI JS syntax checks pass
  • `readProjectSettings` parses commented / uncommented / absent correctly

The oF osx / macos templates ship an APPSTORE block that's commented out
by default:

    //OF_CODESIGN = 1
    //OF_BUNDLE_DATA_FOLDER = 1
    //OF_BUNDLE_DYLIBS = 1

Uncommenting OF_BUNDLE_DATA_FOLDER = 1 makes xcode_project.sh rsync
bin/data/ into the built .app on macOS — required for App Store builds
and generally nicer for shipping a single bundle. Users were having to
hand-edit Project.xcconfig every regen because .xcodeproj/ (and the
xcconfig sitting next to it) is typically gitignored, so the toggle
got lost on every update.

Add an explicit toggle:

- CLI: --bundle-data=1 uncomments the line; --bundle-data=0 re-comments
  it; no flag leaves the file alone. Applied after saveAppleSettings so
  the merge can't carry the previous project state past an explicit
  flag; if the merge happened to leave both commented and uncommented
  copies (a known quirk when the user had hand-enabled it), the toggle
  also collapses the duplicate. osx / macos targets only; a no-op for
  every other target.
- GUI: a Semantic UI checkbox under Bundle ID in advanced mode, shown
  only when the selected platform includes osx or macos. The current
  state is read back from the project's Project.xcconfig on load (via
  readProjectSettings), so re-generating preserves what's on disk,
  and the user's own toggle is the last word.

GUI 0.126.0, CLI 0.131.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant