Files
nih-plug-template/tools/branding-sites.tsv
T
mikkeli 8c24b83ea3 refactor: move branding into tools/ and drive the checker from a table
Three changes that only make sense together.

**tools/**. check-branding.sh, brand-plugin.sh and branding.conf were
accumulating in the repo root, and a deploy.sh/bat/ps1 set would land
there too. They now live in tools/ and resolve the repo root explicitly
rather than assuming their own directory is it, so they behave the same
however they are invoked.

**One name drives the rest.** branding.conf now derives the package name,
the Rust types and the display name from PLUGIN_NAME, each overridable.
Derivation-by-default removes a class of drift; the override matters
because the derivation is sometimes invalid — "206 Prototype" derives to
"206_prototype", which cargo rejects outright — and because PLUGIN_NAME is
cosmetic while the package name is structural. A display tweak should not
silently rename the crate, its bundle lookup, the CI command and the
lockfile. This template overrides three of them, which a real plugin
normally will not: its names are the template's own rather than derived
from a product name.

An overridden PKG that no longer matches the derivation is reported at
info level, never failed. The override is usually deliberate; a display
rename that forgot the package looks identical from here, and is not.

**The site table is data.** branding-sites.tsv lists every place a name
must appear and in what form; check-branding.sh iterates it instead of
carrying 29 check calls in shell. The scripts are now identical across
every plugin built from this template, with only the table and conf
differing — which matters because the template and codename-206 had
already diverged by two checks, so every sync was a shell merge.

brand-plugin.sh regenerates the rows it owns and preserves the rest, so a
hand-added row for a file this template does not ship survives a rename.
Custom rows are value-substituted like any other tracked file, so they
track the rename rather than going stale — the first cut excluded the
whole table from substitution and got that wrong.

brand-plugin.sh also gained an interactive mode: run it with no arguments
and it prompts for each value with the current one as the default, so
Enter keeps it and a run that answers nothing changes nothing. It only
engages when there is a terminal to ask at, so CI gets the usage message
and exit 2 rather than a hang.

Verified by applying a full rename to a sandboxed copy: 8 files rewritten,
29 owned rows regenerated, 1 custom row preserved and substituted, checker
green at 48/0/7, and the result compiles as bari_206.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WHt4DykxXaQnyaJfyS8KCn
2026-09-01 10:15:34 +09:00

46 lines
2.7 KiB
Plaintext

# branding-sites.tsv - every place a canonical name has to appear, and in what form.
#
# Generated and refreshed by tools/brand-plugin.sh; read by tools/check-branding.sh,
# which asserts each pattern is present in its file. Tab-separated, four columns:
#
# kind req = a missing file is a failure; opt = a missing file is a skip
# owner the brand-plugin.sh rule that manages this row, or "custom" for rows
# you added by hand. Custom rows are preserved across regeneration;
# owned rows are overwritten, so do not hand-edit those.
# file repo-relative path
# pattern literal text that must appear in that file, already resolved
#
# Adding a site for something the template does not ship is a one-line edit here
# with owner "custom" - no shell to change, and it survives the next rename.
#
#kind owner file pattern
req pkg.cargo Cargo.toml name = "nih_plug_template"
req pkg.bundler bundler.toml [nih_plug_template]
opt pkg.lock Cargo.lock name = "nih_plug_template"
opt pkg.ci .github/workflows/ci.yaml cargo xtask bundle nih_plug_template
opt pkg.readme README.md cargo xtask bundle nih_plug_template
req display.bundler bundler.toml name = "Plugin Name"
opt display.notice NOTICE Plugin Name
req name.plugin src/lib.rs const NAME: &'static str = "Plugin Name"
req vendor.plugin src/lib.rs const VENDOR: &'static str = "Your Name"
req email.plugin src/lib.rs const EMAIL: &'static str = "your@email.com"
req authors.cargo Cargo.toml authors = ["Your Name <your@email.com>"]
req homepage.cargo Cargo.toml homepage = "https://github.com/YOUR-USERNAME/YOUR-PLUGIN-NAME"
req url.plugin src/lib.rs const URL: &'static str = env!("CARGO_PKG_HOMEPAGE")
req description.cargo Cargo.toml description = "A minimal NIH-plug audio plugin"
req description.clap src/lib.rs const CLAP_DESCRIPTION: Option<&'static str> = Some("Your plugin description")
req clapid.plugin src/lib.rs const CLAP_ID: &'static str = "com.your-domain.plugin-name"
req vst3id.plugin src/lib.rs const VST3_CLASS_ID: [u8; 16] = *b"Unique16CharId!!"
req struct.def src/lib.rs struct MyPlugin {
req struct.plugin src/lib.rs impl Plugin for MyPlugin {
req struct.clap src/lib.rs impl ClapPlugin for MyPlugin {
req struct.vst3 src/lib.rs impl Vst3Plugin for MyPlugin {
req struct.exportclap src/lib.rs nih_export_clap!(MyPlugin);
req struct.exportvst3 src/lib.rs nih_export_vst3!(MyPlugin);
req params.def src/lib.rs struct PluginParams {
req params.default src/lib.rs impl Default for PluginParams {
req params.field src/lib.rs params: Arc<PluginParams>,
opt deploy.pkg deploy.ps1 $Package = "nih_plug_template"
opt deploy.vst3 deploy.ps1 $vst3Name = "Plugin Name.vst3"
opt deploy.clap deploy.ps1 $clapName = "Plugin Name.clap"