Skip to content

feat(catalog): scan an ordered list of plugin folders with dedup-by-id#137

Merged
facontidavide merged 4 commits into
mainfrom
feat/catalog-multi-dir-scan
Jun 28, 2026
Merged

feat(catalog): scan an ordered list of plugin folders with dedup-by-id#137
facontidavide merged 4 commits into
mainfrom
feat/catalog-multi-dir-scan

Conversation

@facontidavide

@facontidavide facontidavide commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

What

Adds PluginRuntimeCatalog::setPluginDirs() so the host can configure an ordered list of plugin directories. scanDirectory() and reload() now scan every configured directory in order and de-duplicate by manifest id: when the same plugin id appears in more than one folder, the first (highest-priority) folder wins and the later copies are skipped with an info diagnostic.

The existing single-directory API (setPluginDir / the constructor) is preserved and maps to a one-element list, so existing callers are unaffected.

Why

PlotJuggler 4 is adding a user-configurable plugin-folder hierarchy (custom folders > --plugin-dir > marketplace dir > <exe>/plugins). The host assembles the ordered list and needs the catalog to scan it with first-wins dedup. The dedup is cheap because inspectPluginDso() already reads the manifest id before committing to load.

Versioning

No version bump in this PR — more PRs will land before the next version upgrade. For the record: this is an additive host-side API change (new setPluginDirs), with no plugin-ABI vtable/struct change (abi/baseline.abi unchanged), so it is MINOR-eligible whenever the version is next bumped.

Test

Exercised via the PlotJuggler 4 host build; single-directory behavior unchanged.

🤖 Generated with Claude Code

Add PluginRuntimeCatalog::setPluginDirs() so the host can configure an
ordered list of plugin directories. scanDirectory() and reload() now scan
every configured directory in order and de-duplicate by manifest id: when
the same plugin id appears in more than one folder, the first
(highest-priority) folder wins and the later copies are skipped with an
info diagnostic. The single-directory API (setPluginDir/ctor) is preserved
and maps to a one-element list.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
facontidavide and others added 3 commits June 27, 2026 18:31
Add two cases to plugin_catalog_test: the same plugin id in two folders
loads once from the first (higher-priority) folder; distinct ids across
folders all load. Links the test against pj_plugin_runtime_catalog.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The RuntimeCatalogDedupsDuplicateIdFirstFolderWins assertion used a
substring match of dir_a.string() against the loaded plugin path, which
failed on Windows (slash/drive-case/canonicalisation differences) even
though the dedup is correct. Compare at the filesystem level with
std::filesystem::equivalent(winner.parent_path(), dir_a) instead. Also
applies clang-format (the prior commit skipped the submodule hook).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@facontidavide facontidavide merged commit a00eefd into main Jun 28, 2026
4 checks passed
@facontidavide facontidavide deleted the feat/catalog-multi-dir-scan branch June 28, 2026 14:38
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