Modularize generator/src/{rust,js,rhai,openrpc} into build/emit/* (follow-up to #56) #58
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_rpc#58
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
#56 split the 2653-line
crates/generator/src/build/build.rsinto focused submodules underbuild/{config,builder,error,fs,layout}.rs+build/emit/*.rs. Public API unchanged, no behaviour change.The issue body proposed
emit/{rust_types,rust_rpc,openrpc,js,rhai,python}.rsas per-output-target emit files. But in this crate, that per-target code lives incrate::generate::Generator(and the modules it dispatches to:crate::rust::*,crate::js::*,crate::rhai::*,crate::openrpc::*), NOT inbuild.rs. So #56 split along whatbuild.rsactually does (bins, server-crate mods, SDK scaffolding, docs index) and leftGeneratoruntouched — that move would have been a much larger refactor with behaviour-change risk.This issue tracks finishing the job: pull per-target emission OUT of
Generatorand intobuild/emit/so the file names match the issue body of #56 and a reader can find each output target in one place.Current location of per-target emitters
types_generated.rs,types_wasm_generated.rs)crates/generator/src/rust/rust_struct.rsosis_server_generated.rs)crates/generator/src/rust/rust_osis.rsrpc_generated.rs+ preservedrpc.rsstub)crates/generator/src/rust/(alongside the above)schema.openrpc.jsonper domain)crates/generator/src/openrpc/crates/generator/src/js/crates/generator/src/rhai/crate::generate::Generator(generate.rs) is the orchestrator that calls into each.Proposed split
Move the dispatch logic + the actual emit wrappers into
build/emit/:The lower-level emitter modules (
crates/generator/src/{rust,js,rhai,openrpc}/) stay — they hold the actual generation logic. Thebuild/emit/*.rswrappers become the single entry point for each output target, andGenerator::generate()shrinks to a thin dispatch.Why this is bigger than #56
build/↔generate/boundary (current public/internal split between consumer-facing config and codegen internals).Generator.output_dir,sdk_output_dir,server_output_dir) currently flows throughGenerator's builder methods. Moving emit out means rethinking how paths are passed.Acceptance
crates/generator/src/build/emit/corresponds to exactly one output target, named per the proposal above.crate::generate::Generatorbecomes a thin orchestrator (≤ 300 LOC) that hands off to the emit modules.recipe_serverbuilds unchanged;cargo test -p hero_rpc_generatorstays green;cargo build --workspacestays green.OschemaBuilder,OschemaBuildConfig,BuildError,BuildResultstay re-exported fromhero_rpc_osis::build).Notes
service.tomlsource of truth). This issue can land before or after #55 — but it should land after the new emitter is settled if before, to avoid double work.generator/src/build/build.rs#56