Rjf/update codegen#518
Open
robfitzgerald wants to merge 14 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR rewrites the routee-compass-codegen crate to embed the codegen templates as real, compiled Rust modules (Traversal, Constraint, InputPlugin, OutputPlugin) and switches the CLI to a generic “copy selected template files” flow, so core API changes break compilation and force template updates.
Changes:
- Replaced per-component generators with a unified
generate_modulethat reads template source files from the crate and copies them into a new module directory. - Added compiled template modules for Traversal, Constraint, InputPlugin, and OutputPlugin (with stubbed
todo!()implementations). - Updated the
cargo compassCLI to support selecting which template files to copy (and added--forceto more subcommands).
Reviewed changes
Copilot reviewed 33 out of 33 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| rust/routee-compass-codegen/Cargo.toml | Adds dependencies needed for compiled templates (core/app crates, serde_json, thiserror). |
| rust/routee-compass-codegen/src/main.rs | Updates CLI to use a file-list based generator flow and adds --force in more commands. |
| rust/routee-compass-codegen/src/generator/mod.rs | Reorganizes generator module; adds component type + error + run module and includes templates with #[allow(unused)]. |
| rust/routee-compass-codegen/src/generator/component_type.rs | Adds component enum and template file retrieval from embedded source tree. |
| rust/routee-compass-codegen/src/generator/error.rs | Introduces typed errors for template read failures. |
| rust/routee-compass-codegen/src/generator/run.rs | Implements unified module generation + overwrite-protected file writing. |
| rust/routee-compass-codegen/src/generator/util.rs | Removes old standalone write helper (functionality moved into run.rs). |
| rust/routee-compass-codegen/src/generator/traversal/mod.rs | Adds compiled traversal template module layout/exports. |
| rust/routee-compass-codegen/src/generator/traversal/builder.rs | Adds traversal builder template (compiled). |
| rust/routee-compass-codegen/src/generator/traversal/config.rs | Adds traversal config template (compiled). |
| rust/routee-compass-codegen/src/generator/traversal/engine.rs | Adds traversal engine template (compiled). |
| rust/routee-compass-codegen/src/generator/traversal/model.rs | Adds traversal model template (compiled). |
| rust/routee-compass-codegen/src/generator/traversal/params.rs | Adds traversal params template (compiled). |
| rust/routee-compass-codegen/src/generator/traversal/service.rs | Adds traversal service template (compiled). |
| rust/routee-compass-codegen/src/generator/traversal.rs | Removes old string-template generator implementation. |
| rust/routee-compass-codegen/src/generator/constraint/mod.rs | Adds compiled constraint template module layout/exports and module docs. |
| rust/routee-compass-codegen/src/generator/constraint/builder.rs | Adds constraint builder template (compiled). |
| rust/routee-compass-codegen/src/generator/constraint/config.rs | Adds constraint config template (compiled). |
| rust/routee-compass-codegen/src/generator/constraint/engine.rs | Adds constraint engine template (compiled). |
| rust/routee-compass-codegen/src/generator/constraint/model.rs | Adds constraint model template (compiled). |
| rust/routee-compass-codegen/src/generator/constraint/params.rs | Adds constraint params template (compiled). |
| rust/routee-compass-codegen/src/generator/constraint/service.rs | Adds constraint service template (compiled). |
| rust/routee-compass-codegen/src/generator/constraint.rs | Removes old placeholder constraint generator. |
| rust/routee-compass-codegen/src/generator/input_plugin/mod.rs | Adds compiled input plugin template module layout/exports. |
| rust/routee-compass-codegen/src/generator/input_plugin/builder.rs | Adds input plugin builder template (compiled). |
| rust/routee-compass-codegen/src/generator/input_plugin/config.rs | Adds input plugin config template (compiled). |
| rust/routee-compass-codegen/src/generator/input_plugin/plugin.rs | Adds input plugin implementation template (compiled). |
| rust/routee-compass-codegen/src/generator/input_plugin.rs | Removes old placeholder input plugin generator. |
| rust/routee-compass-codegen/src/generator/output_plugin/mod.rs | Adds compiled output plugin template module layout/exports. |
| rust/routee-compass-codegen/src/generator/output_plugin/builder.rs | Adds output plugin builder template (compiled). |
| rust/routee-compass-codegen/src/generator/output_plugin/config.rs | Adds output plugin config template (compiled). |
| rust/routee-compass-codegen/src/generator/output_plugin/plugin.rs | Adds output plugin implementation template (compiled). |
| rust/routee-compass-codegen/src/generator/output_plugin.rs | Removes old placeholder output plugin generator. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
i was reviewing the codegen crate and found that code changes in the core crate had broken the templates.
this PR rewrites the routee-compass-codegen crate so that the source template material is wired into the RouteE Compass codebase and therefore compiled. if any changes happen to the definitions for traversal/constraint/input plugin/output plugin traits, it will break the code in the codegen crate, forcing the developer to update those templates. this simplifies the task of ensuring that they remain up-to-date, relying on the developer to honor maintaining those files along with any changes to core trait APIs.
all template code avoids making references to the crate routee-compass-codegen so that, on fs copy, the files are internally linked and do not break references.
along the way,
each template module is flagged with #[allow_unused] to avoid sending warnings.