Skip to content

WIP: Multi-pack support - #363

Draft
Fabrimat wants to merge 15 commits into
Bedrock-OSS:developfrom
Fabrimat:multi-packs
Draft

Fabrimat wants to merge 15 commits into
Bedrock-OSS:developfrom
Fabrimat:multi-packs

Conversation

@Fabrimat

@Fabrimat Fabrimat commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Important

This PR is just a prototype, not meant to be merged yet!
It contains a lot of untested AI code, as also the description might not be the best (sorry!)
The goal is to explore possible ways to bring multi pack support into regolith, if you have suggestions feel free to jump in!

Adds support for projects with more than one behavior and/or resource pack. Until now a Regolith project was hard-wired to exactly one BP and one RP; this PR generalizes the whole pipeline (config → tmp setup → filters → export → watcher → apply-filter) to an arbitrary number of packs per type.

Bumps latestCompatibleVersion to 1.9.0. Everything below is gated on formatVersion >= 1.9.0 — projects on older format versions behave exactly as before.

Config format

The packs object accepts a new plural map form, keyed by pack name:

"packs": {
    "behaviorPacks": { "BP": "./packs/BP", "BP1": "./packs/BP1" },
    "resourcePacks": { "RP": "./packs/RP" }
}
  • Pack names must be BP/RP (the primary pack) or BP1, BP2, … (BP0 is rejected). The primary pack always exists, even when it has no source on disk (a pack fully generated by filters is allowed).
  • The old singular behaviorPack/resourcePack strings still work and are still what gets written back out for single-pack projects, so existing config.json files round-trip unchanged.
  • Mixing the singular and plural form for the same pack type is an error, and so is using the plural form on formatVersion < 1.9.0.

Export targets get per-pack overrides, resolved as per-pack map → singular bpName/rpName (primary only) → default <projectName>_bp<index>:

"export": {
    "target": "exact",
    "bpPaths": { "BP": "...", "BP1": "..." },
    "bpNames": { "BP1": "My Second Pack" }
}

exact targets now fail with a clear error when a pack has no configured path.

Main changes

  • config.go — new Pack/Packs data model with ordering helpers, version-gated parsing, and a custom MarshalJSON that keeps the legacy single-pack output. ExportTarget gains bpNames/rpNames/bpPaths/rpPaths.
  • profile.go — SetupTmpFiles creates one tmp folder per pack (tmp/BP, tmp/BP1, tmp/RP, …) instead of the fixed BP/RP pair; all folders are still prepared concurrently.
  • export.go — new GetPackExportPath/GetExportName resolve destination and name per pack for every target type (development, world, exact, local, none); ExportProject resolves all packs of all targets up front (keeping export atomic and collision-checked) and then exports each pack from its own tmp folder. InplaceExportProject (apply-filter) restores every pack source.
  • file_protection.go — deletion-safety and edited-file tracking now work per pack directory instead of per BP/RP pair.
  • watcher.go — watches every pack source and dispatches the correct bp/rp/data interruption.
  • Symlink export is automatically disabled for multi-pack projects (it can only express a single BP/RP pair); it's unchanged for single-pack projects.
  • Removed the now-unused BehaviorFolder/ResourceFolder accessors.

Tests

New test/multi_pack_test.go (21 tests) plus a test/testdata/multi_pack project, covering config parsing/marshalling in both forms, version gating and validation errors, name/path resolution, tmp folder setup, watcher roots, in-place export, and end-to-end local, exact, development and world exports (including the missing-path failure case).

Note for filter authors

Some filters will most likely need an update. Anything that assumes the working directory contains exactly BP/ and RP/ — hard-coded paths, globs over the two folders, or logic that writes to "the" behavior pack — will simply not see the extra packs in a multi-pack project. Single-pack projects are unaffected, so this is not an immediate break, but filters should be reviewed to iterate over the pack folders present in tmp rather than assuming the fixed pair.

This branch has not been deployed

No deployments
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