cargo-truce 0.40.0

Build tool for truce audio plugins
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
//! Project configuration (read from `truce.toml`).
//!
//! `truce.toml` carries **project-level** facts only: vendor info,
//! plugin definitions, suite definitions, and packaging metadata
//! (publisher name, license file, installer icon).
//!
//! **Per-developer credentials and machine-specific paths
//! (signing identities, AAX SDK location, notarization Apple ID /
//! team ID, Authenticode certs) live in `.cargo/config.toml`'s
//! `[env]` table.** Cargo injects those into the environment before
//! invoking `cargo truce`, so the resolvers below just read
//! `std::env::var`. A direct-read fallback (`read_cargo_config_env`)
//! covers the rare case where `cargo-truce` runs outside cargo.
//!
//! There is no truce.toml-side option for any of these — by design.
//! The split keeps secrets out of the tracked file and removes the
//! "which copy wins?" question every time a developer onboards.

use crate::{BoxErr, project_root};
use serde::Deserialize;
use std::fs;
use std::path::PathBuf;

#[derive(Deserialize)]
pub(crate) struct Config {
    #[serde(default)]
    #[cfg_attr(not(target_os = "macos"), allow(dead_code))]
    pub(crate) macos: MacosConfig,
    #[serde(default)]
    #[cfg_attr(not(target_os = "windows"), allow(dead_code))]
    pub(crate) windows: WindowsConfig,
    pub(crate) vendor: VendorConfig,
    pub(crate) plugin: Vec<PluginDef>,
    /// Packaging metadata (welcome HTML, license HTML, etc.). Consumed
    /// by `cmd_package_macos` only — Windows packaging uses
    /// `WindowsConfig::packaging`, Linux has no packaging path.
    #[serde(default)]
    #[cfg_attr(not(target_os = "macos"), allow(dead_code))]
    pub(crate) packaging: PackagingConfig,
    /// Suite installers — repeatable. Each entry produces one
    /// installer per platform that bundles the listed plugins.
    /// Empty = per-plugin output only (today's behaviour).
    #[serde(default, rename = "suite")]
    pub(crate) suites: Vec<SuiteDef>,
}

#[derive(Deserialize, Default)]
#[cfg_attr(not(target_os = "windows"), allow(dead_code))]
pub(crate) struct WindowsConfig {
    #[serde(default)]
    pub(crate) packaging: WindowsPackagingConfig,
}

#[derive(Deserialize, Default)]
#[cfg_attr(not(target_os = "windows"), allow(dead_code))]
pub(crate) struct WindowsPackagingConfig {
    /// Publisher name shown in the installer and Apps & Features.
    /// Defaults to [vendor].name when absent.
    pub(crate) publisher: Option<String>,
    /// Publisher URL shown in the installer.
    /// Defaults to [vendor].url when absent.
    pub(crate) publisher_url: Option<String>,
    /// Installer-window icon (.ico, relative to workspace root).
    pub(crate) installer_icon: Option<String>,
    /// Welcome/finish wizard bitmap (.bmp, 164x314, relative to workspace root).
    pub(crate) welcome_bmp: Option<String>,
    /// License shown on the wizard's license page (.rtf or .txt).
    pub(crate) license_rtf: Option<String>,
    /// Override for the stable `AppId` Inno Setup uses to detect upgrades.
    /// Defaults to `{vendor_id}.{bundle_id}` when absent.
    pub(crate) app_id: Option<String>,
}

#[derive(Deserialize, Default)]
pub(crate) struct MacosConfig {
    /// Notarization config — only the `cmd_package_macos` path reads
    /// these fields, so on Windows / Linux they're parsed-and-ignored.
    #[serde(default)]
    #[cfg_attr(not(target_os = "macos"), allow(dead_code))]
    pub(crate) packaging: MacosPackagingConfig,
}

#[derive(Deserialize, Default)]
#[cfg_attr(not(target_os = "macos"), allow(dead_code))]
pub(crate) struct MacosPackagingConfig {
    /// Whether to run `xcrun notarytool submit` on the produced
    /// `.pkg`. Project-level decision (release vs. dev build);
    /// the credentials it uses come from env vars
    /// (`TRUCE_NOTARY_PROFILE` keychain profile, or
    /// `APPLE_ID` + `TEAM_ID` + `APP_SPECIFIC_PASSWORD`).
    #[serde(default)]
    pub(crate) notarize: bool,
    /// Welcome-page HTML for the productbuild Distribution wizard
    /// (relative to workspace root). macOS-only — Windows has its own
    /// `[windows.packaging] welcome_bmp` slot with a different file
    /// format (164x314 .bmp).
    pub(crate) welcome_html: Option<String>,
    /// License-page HTML for the productbuild Distribution wizard.
    /// macOS-only — Windows uses `[windows.packaging] license_rtf`.
    pub(crate) license_html: Option<String>,
}

#[derive(Deserialize, Default)]
pub(crate) struct PackagingConfig {
    /// Default format list for `cargo truce package` when no
    /// `--formats` flag is passed. Cross-platform — both the macOS
    /// `.pkg` and Windows Inno Setup paths read it. Linux's tarball
    /// pipeline ignores it (Linux ships every default-feature format
    /// the plugin built, no opt-in).
    #[serde(default)]
    #[cfg_attr(not(any(target_os = "macos", target_os = "windows")), allow(dead_code))]
    pub(crate) formats: Vec<String>,
    /// Preferred scope for `cargo truce package`: `"user"`,
    /// `"system"`, or `"ask"`. Absent = `"ask"` (the indie-installer
    /// convention where the end user picks at install time). CLI
    /// flags (`--user` / `--system` / `--ask`) override.
    /// Linux has no packaging pipeline, so the field is read only on
    /// macOS / Windows.
    #[cfg_attr(not(any(target_os = "macos", target_os = "windows")), allow(dead_code))]
    pub(crate) preferred_scope: Option<String>,
}

#[derive(Deserialize)]
pub(crate) struct VendorConfig {
    pub(crate) name: String,
    /// Reverse-DNS vendor identifier (e.g. `com.acme`). Used by macOS
    /// `CFBundleIdentifier` plists and Windows Inno Setup paths;
    /// Linux VST3 bundles don't include a plist, so the field looks
    /// dead there. Keep cfg-gated to silence the lint without changing
    /// the schema.
    #[cfg_attr(not(any(target_os = "macos", target_os = "windows")), allow(dead_code))]
    pub(crate) id: String,
    /// Vendor website URL. Used by the Windows Inno Setup installer's
    /// "Publisher URL" field; unused on macOS.
    #[serde(default)]
    #[cfg_attr(not(target_os = "windows"), allow(dead_code))]
    pub(crate) url: Option<String>,
    pub(crate) au_manufacturer: String,
}

/// Install-time view of a `[[plugin]]` entry.
///
/// Wraps the shared `truce_build::PluginDef` schema (consumed by the
/// proc macros) and adds install-only fields (`au3_subtype`,
/// `au_tag`). `Deref` exposes the shared fields so call sites read
/// `p.name` / `p.bundle_id` directly without going through `p.shared`.
#[derive(Deserialize)]
pub(crate) struct PluginDef {
    #[serde(flatten)]
    pub(crate) shared: truce_build::PluginDef,
    #[serde(default)]
    pub(crate) au3_subtype: Option<String>,
    #[serde(default = "default_au_tag")]
    #[cfg_attr(not(target_os = "macos"), allow(dead_code))]
    pub(crate) au_tag: String,
    /// Per-plugin Windows app icon (`.ico`, path relative to workspace
    /// root). Embedded as `RT_GROUP_ICON` in the standalone `.exe`.
    /// Distinct from `[windows.packaging] installer_icon` (Inno-wizard
    /// chrome): a vendor with one installer-window logo can still ship
    /// different per-product app icons.
    #[serde(default)]
    #[cfg_attr(not(target_os = "windows"), allow(dead_code))]
    pub(crate) windows_icon: Option<String>,
    /// Per-plugin macOS app icon (`.icns`, path relative to workspace
    /// root). Copied into the standalone `.app`'s `Contents/Resources/`
    /// and referenced by `CFBundleIconFile` so Finder, the Dock,
    /// Launchpad, and Spotlight pick it up. Linux uses `.desktop` +
    /// freedesktop icons — file formats don't survive a single
    /// cross-OS slot. macOS has no installer-chrome icon equivalent;
    /// `.pkg` files inherit Installer.app's icon by design.
    #[serde(default)]
    #[cfg_attr(not(target_os = "macos"), allow(dead_code))]
    pub(crate) macos_icon: Option<String>,
}

impl std::ops::Deref for PluginDef {
    type Target = truce_build::PluginDef;
    fn deref(&self) -> &Self::Target {
        &self.shared
    }
}

impl PluginDef {
    pub(crate) fn resolved_fourcc(&self) -> &str {
        self.fourcc
            .as_deref()
            .or(self.au_subtype.as_deref())
            .expect("truce.toml: each [[plugin]] requires `fourcc` or `au_subtype`")
    }
    pub(crate) fn resolved_au_type(&self) -> &str {
        // Keep in sync with `truce-derive::plugin_info`. NoteEffect →
        // `aumi` (Apple's MIDI Processor). `aumi` plugins declare no
        // audio buses per Apple spec — wrappers that can't express
        // that (AAX) synthesize dummy audio I/O internally.
        self.au_type
            .as_deref()
            .unwrap_or(match self.category.as_str() {
                "instrument" => "aumu",
                "midi" | "note_effect" => "aumi",
                _ => "aufx",
            })
    }
    pub(crate) fn au3_sub(&self) -> &str {
        self.au3_subtype
            .as_deref()
            .unwrap_or(self.resolved_fourcc())
    }

    /// Name used for the AU v3 containing `.app` bundle directory.
    /// When `au3_name` is set in truce.toml it wins (both display
    /// name in host browsers and bundle path stay in sync). Otherwise
    /// we fall back to the historical `"{name} v3"` disambiguator so
    /// projects that haven't opted in are unaffected. macOS-only —
    /// AU v3 only installs to `/Applications/` on macOS.
    #[cfg(target_os = "macos")]
    pub(crate) fn au3_app_name(&self) -> String {
        match self.au3_name.as_deref() {
            Some(n) if !n.is_empty() => n.to_string(),
            _ => format!("{} v3", self.name),
        }
    }
    #[cfg(target_os = "macos")]
    pub(crate) fn fw_name(&self) -> String {
        let cap = format!(
            "{}{}",
            self.bundle_id[..1].to_uppercase(),
            &self.bundle_id[1..]
        );
        format!("Truce{cap}AU")
    }
    /// Dylib filename stem derived from the crate name (hyphens → underscores).
    pub(crate) fn dylib_stem(&self) -> String {
        self.crate_name.replace('-', "_")
    }
}

fn default_au_tag() -> String {
    "Effects".to_string()
}

/// One `[[suite]]` entry from `truce.toml`. Bundles a subset of the
/// workspace's plugins into a single installer per platform.
///
/// Defaults: `plugins` omitted → all workspace plugins;
/// `version` omitted → workspace version. `plugins` and
/// `exclude_plugins` are mutually exclusive — supplying both is a
/// hard error caught at validation time.
#[derive(Deserialize, Debug)]
pub(crate) struct SuiteDef {
    pub(crate) name: String,
    pub(crate) bundle_id: String,
    /// Explicit plugin list. Names match `[[plugin]].crate` (or
    /// `[[plugin]].bundle_id` — both accepted). Omit for "all".
    #[serde(default)]
    pub(crate) plugins: Option<Vec<String>>,
    /// Plugins to exclude from the otherwise-implicit "all". Mutually
    /// exclusive with `plugins`.
    #[serde(default)]
    pub(crate) exclude_plugins: Option<Vec<String>>,
    /// Suite-level version. Falls back to `[workspace.package].version`.
    #[serde(default)]
    pub(crate) version: Option<String>,
    /// Display blurb in the installer welcome page (where supported).
    #[serde(default)]
    #[cfg_attr(not(any(target_os = "macos", target_os = "windows")), allow(dead_code))]
    pub(crate) description: Option<String>,
}

impl SuiteDef {
    /// Validate the suite against the workspace config. Returns the
    /// resolved plugin set + format set the suite should ship.
    ///
    /// `workspace_plugins` is the full `Config::plugin` slice. Plugin
    /// names in the suite's `plugins` / `exclude_plugins` fields can
    /// be either the cargo crate name (`[[plugin]].crate`) or the
    /// `bundle_id`; both forms resolve here.
    pub(crate) fn resolve<'a>(
        &'a self,
        workspace_plugins: &'a [PluginDef],
    ) -> Result<ResolvedSuite<'a>, BoxErr> {
        if self.plugins.is_some() && self.exclude_plugins.is_some() {
            return Err(format!(
                "[[suite]] '{}' sets both `plugins` and `exclude_plugins` — \
                 these are mutually exclusive",
                self.name,
            )
            .into());
        }

        let resolve_one = |needle: &str| -> Result<&'a PluginDef, BoxErr> {
            workspace_plugins
                .iter()
                .find(|p| p.crate_name == needle || p.bundle_id == needle)
                .ok_or_else(|| {
                    format!(
                        "[[suite]] '{}': plugin '{}' is not in the workspace. \
                         Available: {}",
                        self.name,
                        needle,
                        workspace_plugins
                            .iter()
                            .map(|p| p.crate_name.as_str())
                            .collect::<Vec<_>>()
                            .join(", "),
                    )
                    .into()
                })
        };

        let plugins: Vec<&PluginDef> = if let Some(list) = &self.plugins {
            list.iter()
                .map(|s| resolve_one(s))
                .collect::<Result<Vec<_>, _>>()?
        } else if let Some(excl) = &self.exclude_plugins {
            let exclude_set: Vec<&PluginDef> = excl
                .iter()
                .map(|s| resolve_one(s))
                .collect::<Result<Vec<_>, _>>()?;
            workspace_plugins
                .iter()
                .filter(|p| !exclude_set.iter().any(|e| std::ptr::eq(*e, *p)))
                .collect()
        } else {
            workspace_plugins.iter().collect()
        };

        if plugins.is_empty() {
            return Err(format!(
                "[[suite]] '{}' resolves to zero plugins after \
                 plugins/exclude_plugins resolution",
                self.name,
            )
            .into());
        }

        Ok(ResolvedSuite { def: self, plugins })
    }
}

/// Result of [`SuiteDef::resolve`]. Borrows from the original
/// workspace config so we don't clone every plugin per suite.
pub(crate) struct ResolvedSuite<'a> {
    pub(crate) def: &'a SuiteDef,
    pub(crate) plugins: Vec<&'a PluginDef>,
}

/// Read a per-developer build env var. Cargo injects values from
/// `.cargo/config.toml`'s `[env]` table into the environment of any
/// subcommand it spawns, so `std::env::var(key)` is the normal path.
/// As a fallback for the rare `cargo-truce` invocation that doesn't
/// go through cargo (e.g. running `target/release/cargo-truce`
/// directly), parse `.cargo/config.toml` ourselves.
///
/// Returns `None` for missing or empty values (an empty string from
/// either source is treated as unset). Cargo's `force = true`
/// override on a `[env]` entry is handled transparently because
/// cargo has already applied it to the process environment by the
/// time we read.
pub(crate) fn read_build_env(key: &str) -> Option<String> {
    if let Ok(v) = std::env::var(key)
        && !v.is_empty()
    {
        return Some(v);
    }
    let root = project_root();
    let path = root.join(".cargo/config.toml");
    let content = fs::read_to_string(&path).ok()?;
    let doc: toml::Table = content.parse().ok()?;
    let env = doc.get("env")?.as_table()?;
    // Supports both `KEY = "value"` and `KEY = { value = "...", force = true }`.
    let raw = match env.get(key)? {
        toml::Value::String(s) => s.clone(),
        toml::Value::Table(t) => t.get("value")?.as_str()?.to_string(),
        _ => return None,
    };
    if raw.is_empty() { None } else { Some(raw) }
}

/// Resolved application signing identity. `"-"` means ad-hoc /
/// unsigned (the default). Read from the `TRUCE_SIGNING_IDENTITY`
/// build env. The accessor stays in this module so all callers have
/// one path to follow when they need to know "where does this come
/// from?"
pub(crate) fn application_identity() -> String {
    read_build_env("TRUCE_SIGNING_IDENTITY").unwrap_or_else(|| "-".to_string())
}

/// Resolved installer signing identity. `None` means the installer
/// won't be signed. Read from the `TRUCE_INSTALLER_SIGNING_IDENTITY`
/// build env. macOS-only — only the `productbuild` step in
/// `cmd_package_macos` consumes this.
#[cfg(target_os = "macos")]
pub(crate) fn installer_identity() -> Option<String> {
    read_build_env("TRUCE_INSTALLER_SIGNING_IDENTITY")
}

/// Read `MACOSX_DEPLOYMENT_TARGET` from the build env, defaulting
/// to "11.0".
pub(crate) fn deployment_target() -> String {
    read_build_env("MACOSX_DEPLOYMENT_TARGET").unwrap_or_else(|| "11.0".to_string())
}

/// Resolve the AAX SDK path from the `AAX_SDK_PATH` build env. The
/// path must point at an extant directory; a stale value emits a
/// warning and resolves to `None` so callers can degrade gracefully.
pub(crate) fn resolve_aax_sdk_path() -> Option<PathBuf> {
    let raw = read_build_env("AAX_SDK_PATH")?;
    let path = PathBuf::from(&raw);
    if path.exists() {
        return Some(path);
    }
    eprintln!(
        "warning: AAX_SDK_PATH={raw} (from .cargo/config.toml [env] or shell env) but \
         directory does not exist"
    );
    None
}

pub(crate) fn load_config() -> std::result::Result<Config, BoxErr> {
    let root = project_root();
    let path = root.join("truce.toml");
    if !path.exists() {
        return Err(format!(
            "truce.toml not found at {}. Run 'cargo truce new' to scaffold a project, or create truce.toml manually.",
            path.display()
        )
        .into());
    }
    let content = fs::read_to_string(&path)?;
    let config: Config = toml::from_str(&content)?;
    if config.plugin.is_empty() {
        return Err("No [[plugin]] entries in truce.toml".into());
    }
    Ok(config)
}

#[cfg(test)]
mod suite_tests {
    use super::*;

    fn plugin(crate_name: &str, bundle_id: &str) -> PluginDef {
        PluginDef {
            shared: truce_build::PluginDef {
                name: crate_name.into(),
                bundle_id: bundle_id.into(),
                crate_name: crate_name.into(),
                version: None,
                fourcc: None,
                category: "effect".into(),
                au_type: None,
                au_subtype: None,
                aax_category: None,
                vst3_name: None,
                clap_name: None,
                vst2_name: None,
                au_name: None,
                au3_name: None,
                aax_name: None,
                lv2_name: None,
            },
            au3_subtype: None,
            au_tag: default_au_tag(),
            windows_icon: None,
            macos_icon: None,
        }
    }

    fn suite(name: &str) -> SuiteDef {
        SuiteDef {
            name: name.into(),
            bundle_id: name.to_lowercase(),
            plugins: None,
            exclude_plugins: None,
            version: None,
            description: None,
        }
    }

    #[test]
    fn default_resolves_to_all_workspace_plugins() {
        let plugins = vec![plugin("a", "a"), plugin("b", "b"), plugin("c", "c")];
        let s = suite("Studio");
        let r = match s.resolve(&plugins) {
            Ok(r) => r,
            Err(e) => panic!("resolve failed: {e}"),
        };
        assert_eq!(r.plugins.len(), 3);
    }

    #[test]
    fn explicit_plugin_list_narrows() {
        let plugins = vec![plugin("a", "a"), plugin("b", "b"), plugin("c", "c")];
        let mut s = suite("Studio");
        s.plugins = Some(vec!["a".into(), "c".into()]);
        let r = match s.resolve(&plugins) {
            Ok(r) => r,
            Err(e) => panic!("resolve failed: {e}"),
        };
        let names: Vec<_> = r.plugins.iter().map(|p| p.crate_name.as_str()).collect();
        assert_eq!(names, vec!["a", "c"]);
    }

    #[test]
    fn exclude_plugins_inverts() {
        let plugins = vec![plugin("a", "a"), plugin("b", "b"), plugin("c", "c")];
        let mut s = suite("Studio");
        s.exclude_plugins = Some(vec!["b".into()]);
        let r = match s.resolve(&plugins) {
            Ok(r) => r,
            Err(e) => panic!("resolve failed: {e}"),
        };
        let names: Vec<_> = r.plugins.iter().map(|p| p.crate_name.as_str()).collect();
        assert_eq!(names, vec!["a", "c"]);
    }

    #[test]
    fn bundle_id_resolves_alongside_crate_name() {
        let plugins = vec![plugin("acme-gain", "gain")];
        let mut s = suite("Studio");
        // Reference by bundle_id rather than crate name.
        s.plugins = Some(vec!["gain".into()]);
        let r = match s.resolve(&plugins) {
            Ok(r) => r,
            Err(e) => panic!("resolve failed: {e}"),
        };
        assert_eq!(r.plugins.len(), 1);
    }

    #[test]
    fn unknown_plugin_errors() {
        let plugins = vec![plugin("a", "a")];
        let mut s = suite("Studio");
        s.plugins = Some(vec!["does-not-exist".into()]);
        let err = match s.resolve(&plugins) {
            Err(e) => e.to_string(),
            Ok(_) => panic!("expected resolve to error"),
        };
        assert!(err.contains("does-not-exist"), "got: {err}");
        assert!(err.contains("Studio"), "got: {err}");
    }

    #[test]
    fn plugins_and_exclude_plugins_both_set_errors() {
        let plugins = vec![plugin("a", "a")];
        let mut s = suite("Studio");
        s.plugins = Some(vec!["a".into()]);
        s.exclude_plugins = Some(vec!["a".into()]);
        let err = match s.resolve(&plugins) {
            Err(e) => e.to_string(),
            Ok(_) => panic!("expected resolve to error"),
        };
        assert!(err.contains("mutually exclusive"));
    }

    #[test]
    fn empty_resolution_errors() {
        // Three plugins, exclude all three → zero remaining.
        let plugins = vec![plugin("a", "a"), plugin("b", "b")];
        let mut s = suite("Studio");
        s.exclude_plugins = Some(vec!["a".into(), "b".into()]);
        let err = match s.resolve(&plugins) {
            Err(e) => e.to_string(),
            Ok(_) => panic!("expected resolve to error"),
        };
        assert!(err.contains("zero plugins"), "got: {err}");
    }
}