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
2 changes: 1 addition & 1 deletion codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ license = "GPL-3.0-only"
# Interim: track `core` by git rev (see design/runtime-repo-structure.md — no
# crates.io publishing at this stage). Local iteration: uncomment the
# workspace-root [patch] onto a sibling checkout.
comline-core = { git = "https://github.com/ComlineProject/core", rev = "5c1f3474b462ed912f4f2f5a518b87a5f6576aaa" }
comline-core = { git = "https://github.com/ComlineProject/core", rev = "016e38603152444f9b51fddfd46b1e6b1d73f1d8" }

eyre = "0.6.8"
7 changes: 7 additions & 0 deletions codegen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ pub struct GenRequest<'a> {
/// built-in default. The value is a framing name the generator recognises
/// (`"jsonrpc"`, `"datagram"`, …); an unknown one falls back to the default.
pub default_framing: Option<String>,
/// The target's language/toolchain version - the `#`-suffix of the
/// language the congregation declared (`rust#1.70.0` -> `"1.70.0"`,
/// `typescript#5.0` -> `"5.0"`), which is also what selected this
/// generator. A generator records it in whatever its own ecosystem's
/// manifest calls that (`rust-version` in a `Cargo.toml`), and ignores
/// it otherwise - `Mode::Code` has no manifest to put it in.
pub lang_version: String,
/// `comline.toml`'s `[generate] external_std` - `true` means `std`
/// should be referenced as its own crate instead of inlined into this
/// package's own generated output. Only a generator that knows how to
Expand Down
6 changes: 3 additions & 3 deletions conformance/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ publish = false
# to their own repos. See design/runtime-repo-structure.md (rollout step 3).

[dependencies]
comline-core = { git = "https://github.com/ComlineProject/core", rev = "5c1f3474b462ed912f4f2f5a518b87a5f6576aaa" }
comline-core = { git = "https://github.com/ComlineProject/core", rev = "016e38603152444f9b51fddfd46b1e6b1d73f1d8" }

[dev-dependencies]
comline-codegen = { path = "../codegen" }
comline-codegen-rust = { git = "https://github.com/ComlineProject/comline-rust", rev = "eb8396a337e0efe452cea32cdb0e6a50dd56f2d5" }
comline-codegen-typescript = { git = "https://github.com/ComlineProject/comline-typescript", rev = "d8a1df17b83752314a34d9c0b7817e4feb16820e" }
comline-codegen-rust = { git = "https://github.com/ComlineProject/comline-rust", rev = "5b1ba2b099cc295c6768935623f4c084f134e6b8" }
comline-codegen-typescript = { git = "https://github.com/ComlineProject/comline-typescript", rev = "c484b764b4341d8a8529eb52613e4ce2fb6c35d5" }
14 changes: 12 additions & 2 deletions conformance/tests/conformance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,24 @@ fn golden_path(fixture: &str, lang: &str, ext: &str) -> PathBuf {
.join(format!("{lang}.{ext}"))
}

fn request(schemas: &[(String, Vec<FrozenUnit>)]) -> GenRequest<'_> {
fn request<'a>(schemas: &'a [(String, Vec<FrozenUnit>)], lang: &str) -> GenRequest<'a> {
GenRequest {
mode: Mode::Code,
schemas,
package: PackageMeta {
name: "conformance".to_string(),
version: "0.0.0".to_string(),
},
// Each generator's own registered version. `Mode::Code` has no
// manifest to record it in, so no golden depends on it - but a
// request that named the wrong one would still be a lie about what
// is being asked for.
lang_version: match lang {
"rust" => comline_codegen_rust::LANG_VERSION,
"typescript" => comline_codegen_typescript::LANG_VERSION,
other => panic!("unknown language `{other}`"),
}
.to_string(),
default_framing: None,
external_std: false,
}
Expand All @@ -52,7 +62,7 @@ fn corpus_matches_golden() {
for fx in corpus() {
let schemas = vec![(fx.namespace.to_string(), fx.units.clone())];
for &(lang, ext) in LANGS {
let req = request(&schemas);
let req = request(&schemas, lang);
let files = generate(lang, &req);
assert_eq!(
files.len(),
Expand Down
Loading