Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,16 @@ toml = "0.8"
# `comline-core` in the tree. Local dev: see .cargo/config.
comline-core = { git = "https://github.com/ComlineProject/core", rev = "aa84d970d3295df59cc3e620bdb71bf96382f97b" }
comline-codegen = { git = "https://github.com/ComlineProject/generation", rev = "4f29f4fce4e2e0b3775e4d687a7188112eaf58e3" }
comline-codegen-rust = { git = "https://github.com/ComlineProject/comline-rust", rev = "070c77759b77f3f9a51ae217734277c95414f71f" }
comline-codegen-typescript = { git = "https://github.com/ComlineProject/comline-typescript", rev = "97d8b2ea3db8b0489eaa8a1ad1fa2e89cfb391e6" }
comline-codegen-rust = { git = "https://github.com/ComlineProject/comline-rust", rev = "070c77759b77f3f9a51ae217734277c95414f71f", optional = true }
comline-codegen-typescript = { git = "https://github.com/ComlineProject/comline-typescript", rev = "97d8b2ea3db8b0489eaa8a1ad1fa2e89cfb391e6", optional = true }

[features]
# Which language generators are compiled in. Drop one to shed its whole
# dependency tree from the build. A build with neither can compile but
# `comline generate` will find no generator.
default = ["gen-rust", "gen-typescript"]
gen-rust = ["dep:comline-codegen-rust"]
gen-typescript = ["dep:comline-codegen-typescript"]

[target.'cfg(unix)'.dependencies]
libc = "0.2"
Expand Down
7 changes: 6 additions & 1 deletion src/commands/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,15 @@ use crate::gen_config::{self, ComlineToml, DeclaredLang, Overrides, VersionSpec}
use crate::{history, ui, watch};

/// The generator registry, composed from the per-language `comline-codegen-*`
/// crates this CLI was built with. (Feature-gating the set is rollout step 6.)
/// crates this CLI was built with — one `register()` per crate, each behind its
/// `gen-<lang>` cargo feature (both on by default). A build without a feature
/// never compiles that generator crate or its dependency tree.
pub(crate) fn generator_registry() -> Registry {
#[allow(unused_mut)]
let mut registry = Registry::new();
#[cfg(feature = "gen-rust")]
comline_codegen_rust::register(&mut registry);
#[cfg(feature = "gen-typescript")]
comline_codegen_typescript::register(&mut registry);
registry
}
Expand Down
Loading