Create Code Generation Plugin System
Priority
P1 (High) - Enables language-specific code generation
Labels
Estimated Effort
3-4 weeks
Description
Build the plugin architecture for code generators. This allows language-specific generators to be developed as separate libraries and loaded dynamically.
Requirements:
- Stable Rust ABI interface (challenging!)
- Dynamic library loading
- Plugin discovery
- Version compatibility checking
Current State
Location: core/src/codelib_gen.rs
Only interface defined (24 lines), no implementation. Single todo!() for the loader.
TODO References
codelib_gen.rs:21 - "Rust ABI Stable code needs to be done, traits and so on and load here"
Technical Challenge
Rust doesn't have a stable ABI by default. Possible solutions:
- Use C ABI wrapper (traditional approach)
- Use
abi_stable crate (Rust-to-Rust stable ABI)
- Use process-based plugins (spawn external process)
- WebAssembly plugins (WASM runtime)
Need to research and decide on approach.
Acceptance Criteria
Tasks
Plugin Interface (Draft)
pub trait Generator {
fn name(&self) -> &str;
fn version(&self) -> &str;
fn supports_version(&self, ir_version: &str) -> bool;
fn generate(&self, frozen_units: &[FrozenUnit]) -> Result<String>;
}
Dependencies
Blocks
None
Create Code Generation Plugin System
Priority
P1 (High) - Enables language-specific code generation
Labels
corecodegenpluginsP1Estimated Effort
3-4 weeks
Description
Build the plugin architecture for code generators. This allows language-specific generators to be developed as separate libraries and loaded dynamically.
Requirements:
Current State
Location:
core/src/codelib_gen.rsOnly interface defined (24 lines), no implementation. Single
todo!()for the loader.TODO References
codelib_gen.rs:21- "Rust ABI Stable code needs to be done, traits and so on and load here"Technical Challenge
Rust doesn't have a stable ABI by default. Possible solutions:
abi_stablecrate (Rust-to-Rust stable ABI)Need to research and decide on approach.
Acceptance Criteria
~/.comline/plugins/,./plugins/)Tasks
libloadingor similar)Plugin Interface (Draft)
Dependencies
Blocks
None