Repository navigation
feat: mode = "lib" end to end (G2a, cli half) - #17
Merged
Merged
Conversation
added 2 commits
August 31, 2026 18:00
generate.rs now speaks the GeneratedFile contract (generation#5):
- t.mode string -> Mode (code / lib; dylib rejected).
- Per version, build a GenRequest with every schema, the mode, and
PackageMeta { name = congregation name, version = package version or
0.0.0 for an unbuilt tree }, call the generator once, write the files
it returns.
- code mode: one file per schema, still placed by the layout template.
- lib mode: the returned crate goes under <out>/<language>/ verbatim
(Cargo.toml + src/lib.rs + src/<namespace>.rs). The layout template is
not consulted inside the crate.
- lib + multiple package versions -> error for now.
Cargo.toml: bump comline-codelib-gen to db4f166 (lib mode + autobins fix
+ the TypeScript generator from #4).
Tests: lib_mode_emits_a_crate, dylib_mode_is_rejected. 38 pass.
Follow-ups: a namespace literally named main or lib still triggers Rust's
special_module_name warning (nest schema modules under src/schemas/);
clean.rs could ask the generator for its paths rather than lean on the
"dedicated out dir" branch.
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.
De-rot G2a, CLI half. Pairs with generation #5 (
GeneratedFilecontract + rust lib mode) and #6 (autobins fix), both merged.generate.rsSpeaks the new generator contract:
t.modestring →Mode—code/lib;dylibis rejected with a clear message.GenRequest { mode, schemas: <all of them>, package: PackageMeta { name, version } }, call the generator once, write the files it returns.name= the congregation name (::→-);version= the package version, or0.0.0for an unbuilt working tree.code— one file per schema, still placed by thelayouttemplate (unchanged behaviour).lib— the returned crate is written under<out>/<language>/verbatim (Cargo.toml+src/lib.rs+src/<namespace>.rs);layoutis not consulted inside a crate.lib+ multiple package versions → error for now.Wiring
comline-codelib-gengit rev bumped todb4f166(lib mode + autobins fix + the TypeScript generator from generation#4).comline-corestays at the revcomline-codelib-genpins, so the tree still has onecomline-core.Tests
lib_mode_emits_a_crate(assertsCargo.tomlname/edition/serde,src/lib.rsmod list,src/*.rs),dylib_mode_is_rejected. 38 pass. Manually verified: the fixture generates a crate thatcargo checks clean.Follow-ups (noted, not blocking)
mainorlibstill trips Rust'sspecial_module_namewarning (it compiles) — fix by nesting schema modules undersrc/schemas/.clean.rsunchanged: its "dedicatedoutdir → remove wholesale" branch already coverslibmode for the common config; it could instead ask the generator for its paths.layout-drivenlibroot, multi-versionlib, nested namespaces inlib.Design: design/generation.md → G2a.