Skip to content

Commit 8431cfb

Browse files
committed
implement codegen foundations for snippet index
1 parent 41c24f0 commit 8431cfb

File tree

11 files changed

+964
-2
lines changed

11 files changed

+964
-2
lines changed

Cargo.lock

+2
Original file line numberDiff line numberDiff line change
@@ -6693,8 +6693,10 @@ dependencies = [
66936693
"re_log",
66946694
"re_tracing",
66956695
"rust-format",
6696+
"serde",
66966697
"syn 2.0.85",
66976698
"tempfile",
6699+
"toml",
66986700
"unindent",
66996701
"xshell",
67006702
]

crates/build/re_types_builder/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ proc-macro2.workspace = true
4747
quote.workspace = true
4848
rayon.workspace = true
4949
rust-format.workspace = true
50+
serde = { workspace = true, features = ["derive"] }
5051
syn.workspace = true
5152
tempfile.workspace = true
53+
toml = { workspace = true, features = ["parse", "preserve_order"] }
5254
unindent.workspace = true
5355
xshell.workspace = true
5456

crates/build/re_types_builder/src/bin/build_re_types.rs

+9
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const CPP_OUTPUT_DIR_PATH: &str = "rerun_cpp";
2121
const PYTHON_OUTPUT_DIR_PATH: &str = "rerun_py/rerun_sdk/rerun";
2222
const PYTHON_TESTING_OUTPUT_DIR_PATH: &str = "rerun_py/tests/test_types";
2323
const DOCS_CONTENT_DIR_PATH: &str = "docs/content/reference/types";
24+
const SNIPPETS_REF_DIR_PATH: &str = "docs/snippets/";
2425

2526
/// This uses [`rayon::scope`] to spawn all closures as tasks
2627
/// running in parallel. It blocks until all tasks are done.
@@ -91,6 +92,7 @@ fn main() {
9192
let python_output_dir_path = workspace_dir.join(PYTHON_OUTPUT_DIR_PATH);
9293
let python_testing_output_dir_path = workspace_dir.join(PYTHON_TESTING_OUTPUT_DIR_PATH);
9394
let docs_content_dir_path = workspace_dir.join(DOCS_CONTENT_DIR_PATH);
95+
let snippets_ref_dir_path = workspace_dir.join(SNIPPETS_REF_DIR_PATH);
9496

9597
let cur_hash = read_versioning_hash(&re_types_source_hash_path);
9698
re_log::debug!("cur_hash: {cur_hash:?}");
@@ -159,6 +161,13 @@ fn main() {
159161
&arrow_registry,
160162
check,
161163
),
164+
|| re_types_builder::generate_snippets_ref(
165+
&reporter,
166+
snippets_ref_dir_path,
167+
&objects,
168+
&arrow_registry,
169+
check,
170+
),
162171
);
163172

164173
report.finalize();
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
mod arrow_datatype;
2+
mod snippets_ref;
23
mod website;
34

4-
pub use self::website::DocsCodeGenerator;
5+
pub use self::{snippets_ref::SnippetsRefCodeGenerator, website::DocsCodeGenerator};

0 commit comments

Comments
 (0)