diff --git a/src/build/packages.rs b/src/build/packages.rs index c17be49..edbd1a1 100644 --- a/src/build/packages.rs +++ b/src/build/packages.rs @@ -358,8 +358,8 @@ fn flatten_dependencies(dependencies: Vec) -> Vec { fn make_package(config: config::Config, package_path: &str, is_pinned_dep: bool, is_root: bool) -> Package { let source_folders = match config.sources.to_owned() { - config::OneOrMore::Single(source) => get_source_dirs(source, None), - config::OneOrMore::Multiple(sources) => { + Some(config::OneOrMore::Single(source)) => get_source_dirs(source, None), + Some(config::OneOrMore::Multiple(sources)) => { let mut source_folders: AHashSet = AHashSet::new(); sources .iter() @@ -369,6 +369,13 @@ fn make_package(config: config::Config, package_path: &str, is_pinned_dep: bool, .for_each(|source| source_folders.extend(source)); source_folders } + None => { + if !is_root { + log::warn!("Package '{}' has not defined any sources, but is not the root package. This is likely a mistake. It is located: {}", config.name, package_path); + } + + AHashSet::new() + } }; Package { diff --git a/src/config.rs b/src/config.rs index 7a6a28f..b242de4 100644 --- a/src/config.rs +++ b/src/config.rs @@ -171,7 +171,9 @@ pub type GenTypeConfig = serde_json::Value; #[derive(Deserialize, Debug, Clone)] pub struct Config { pub name: String, - pub sources: OneOrMore, + // In the case of monorepos, the root source won't necessarily have to have sources. It can + // just be sources in packages + pub sources: Option>, #[serde(rename = "package-specs")] pub package_specs: Option>, pub warnings: Option,