Skip to content

Commit 83c7f30

Browse files
committed
Remove legacy [vendor] config (which was never supported)
This was the original spec for workspace vendoring, and was later simplified to workspace.vendor, but this was never removed. Safe because we never did anything with this.
1 parent 6dd4ddb commit 83c7f30

File tree

1 file changed

+4
-171
lines changed

1 file changed

+4
-171
lines changed

crates/pcb-zen-core/src/config.rs

Lines changed: 4 additions & 171 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ pub struct PcbToml {
5757
#[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
5858
pub patch: BTreeMap<String, PatchSpec>,
5959

60-
/// Vendor configuration (V2 only)
61-
#[serde(skip_serializing_if = "Option::is_none")]
62-
pub vendor: Option<VendorConfig>,
63-
6460
/// Access control configuration section
6561
#[serde(skip_serializing_if = "Option::is_none")]
6662
pub access: Option<AccessConfig>,
@@ -568,85 +564,6 @@ impl std::fmt::Display for Lockfile {
568564
}
569565
}
570566

571-
/// V2 Vendor configuration
572-
///
573-
/// Controls which dependencies are vendored. Dependencies are always resolved
574-
/// from the vendor directory first if present, falling back to network fetch.
575-
///
576-
/// # Example (Vendor Everything)
577-
/// ```toml
578-
/// [vendor]
579-
/// directory = "vendor"
580-
/// match = ["*"]
581-
/// ```
582-
///
583-
/// # Example (Selective Vendoring)
584-
/// ```toml
585-
/// [vendor]
586-
/// directory = "vendor"
587-
/// match = [
588-
/// "github.com/diodeinc/registry/reference/ti",
589-
/// "github.com/diodeinc/stdlib"
590-
/// ]
591-
/// ```
592-
///
593-
/// # Example (Vendor All Registry Components)
594-
/// ```toml
595-
/// [vendor]
596-
/// directory = "vendor"
597-
/// match = ["github.com/diodeinc/registry/reference"]
598-
/// ```
599-
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
600-
pub struct VendorConfig {
601-
/// Directory where vendored dependencies are stored
602-
/// Defaults to "vendor" if not specified
603-
#[serde(default = "default_vendor_directory")]
604-
pub directory: String,
605-
606-
/// List of package prefixes to vendor
607-
///
608-
/// **Default: vendor everything** (empty list = all packages)
609-
///
610-
/// Examples:
611-
/// - `[]` (empty/default) → vendors all dependencies
612-
/// - `["*"]` → vendors all dependencies (explicit)
613-
/// - `["github.com/org/repo"]` → vendors only packages matching this prefix
614-
/// - `["prefix1", "prefix2"]` → vendors packages matching any prefix
615-
#[serde(default, rename = "match")]
616-
pub match_patterns: Vec<String>,
617-
}
618-
619-
impl VendorConfig {
620-
/// Check if a package should be vendored based on match patterns
621-
///
622-
/// # Arguments
623-
/// * `package_url` - The package URL (e.g., "github.com/diodeinc/stdlib")
624-
///
625-
/// # Returns
626-
/// `true` if the package matches any vendor pattern
627-
pub fn should_vendor(&self, package_url: &str) -> bool {
628-
// Empty patterns means vendor everything (default behavior)
629-
if self.match_patterns.is_empty() {
630-
return true;
631-
}
632-
633-
// Check for wildcard
634-
if self.match_patterns.contains(&"*".to_string()) {
635-
return true;
636-
}
637-
638-
// Check if package URL matches any prefix pattern
639-
self.match_patterns
640-
.iter()
641-
.any(|pattern| package_url.starts_with(pattern))
642-
}
643-
}
644-
645-
/// Default vendor directory
646-
fn default_vendor_directory() -> String {
647-
"vendor".to_string()
648-
}
649-
650567
/// Default members pattern
651568
pub fn default_members() -> Vec<String> {
652569
vec![
@@ -1111,103 +1028,19 @@ name = "TestBoard"
11111028
}
11121029

11131030
#[test]
1114-
fn test_v2_vendor_config() {
1031+
fn test_workspace_vendor_config() {
11151032
let content = r#"
11161033
[workspace]
11171034
pcb-version = "0.3"
1118-
1119-
[board]
1120-
name = "Test"
1121-
path = "test.zen"
1122-
1123-
[vendor]
1124-
directory = "my-vendor"
1125-
match = ["github.com/diodeinc/registry/reference/ti"]
1035+
vendor = ["github.com/diodeinc/registry/reference/ti"]
11261036
"#;
11271037

11281038
let config = PcbToml::parse(content).unwrap();
1129-
let vendor = config.vendor.as_ref().unwrap();
1130-
assert_eq!(vendor.directory, "my-vendor");
1039+
let workspace = config.workspace.as_ref().unwrap();
11311040
assert_eq!(
1132-
vendor.match_patterns,
1041+
workspace.vendor,
11331042
vec!["github.com/diodeinc/registry/reference/ti"]
11341043
);
1135-
1136-
// Test should_vendor
1137-
assert!(vendor.should_vendor("github.com/diodeinc/registry/reference/ti/tps54331"));
1138-
assert!(!vendor.should_vendor("github.com/diodeinc/stdlib"));
1139-
}
1140-
1141-
#[test]
1142-
fn test_v2_vendor_config_defaults() {
1143-
let content = r#"
1144-
[workspace]
1145-
pcb-version = "0.3"
1146-
1147-
[board]
1148-
name = "Test"
1149-
path = "test.zen"
1150-
1151-
[vendor]
1152-
"#;
1153-
1154-
let config = PcbToml::parse(content).unwrap();
1155-
let vendor = config.vendor.as_ref().unwrap();
1156-
assert_eq!(vendor.directory, "vendor"); // default
1157-
assert!(vendor.match_patterns.is_empty()); // default empty = vendor all
1158-
1159-
// Empty patterns should vendor everything
1160-
assert!(vendor.should_vendor("github.com/diodeinc/stdlib"));
1161-
assert!(vendor.should_vendor("github.com/any/package"));
1162-
}
1163-
1164-
#[test]
1165-
fn test_v2_workspace_vendor_config() {
1166-
let content = r#"
1167-
[workspace]
1168-
pcb-version = "0.3"
1169-
members = ["boards/*"]
1170-
1171-
[vendor]
1172-
directory = "workspace-vendor"
1173-
match = ["github.com/diodeinc/registry/reference"]
1174-
"#;
1175-
1176-
let config = PcbToml::parse(content).unwrap();
1177-
let vendor = config.vendor.as_ref().unwrap();
1178-
assert_eq!(vendor.directory, "workspace-vendor");
1179-
assert_eq!(
1180-
vendor.match_patterns,
1181-
vec!["github.com/diodeinc/registry/reference"]
1182-
);
1183-
1184-
// Test should_vendor with workspace pattern
1185-
assert!(vendor.should_vendor("github.com/diodeinc/registry/reference/ti/tps54331"));
1186-
assert!(!vendor.should_vendor("github.com/diodeinc/stdlib"));
1187-
}
1188-
1189-
#[test]
1190-
fn test_v2_vendor_wildcard() {
1191-
let content = r#"
1192-
[workspace]
1193-
pcb-version = "0.3"
1194-
1195-
[board]
1196-
name = "Test"
1197-
path = "test.zen"
1198-
1199-
[vendor]
1200-
match = ["*"]
1201-
"#;
1202-
1203-
let config = PcbToml::parse(content).unwrap();
1204-
let vendor = config.vendor.as_ref().unwrap();
1205-
assert_eq!(vendor.match_patterns, vec!["*"]);
1206-
1207-
// Wildcard should vendor everything
1208-
assert!(vendor.should_vendor("github.com/diodeinc/stdlib"));
1209-
assert!(vendor.should_vendor("github.com/any/package"));
1210-
assert!(vendor.should_vendor("gitlab.com/kicad/symbols"));
12111044
}
12121045

12131046
#[test]

0 commit comments

Comments
 (0)