Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support \example in codegen #3378

Merged
merged 23 commits into from
Sep 20, 2023
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
23 changes: 21 additions & 2 deletions crates/re_types/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,32 @@ fn main() {
panic!("re_types' fbs definitions and generated code are out-of-sync!");
}

let (report, reporter) = re_types_builder::report::init();

// passes 1 through 3: bfbs, semantic, arrow registry
let (objects, arrow_registry) =
re_types_builder::generate_lang_agnostic(DEFINITIONS_DIR_PATH, ENTRYPOINT_PATH);

join3(
|| re_types_builder::generate_cpp_code(CPP_OUTPUT_DIR_PATH, &objects, &arrow_registry),
|| re_types_builder::generate_rust_code(RUST_OUTPUT_DIR_PATH, &objects, &arrow_registry),
|| {
re_types_builder::generate_cpp_code(
&reporter,
CPP_OUTPUT_DIR_PATH,
&objects,
&arrow_registry,
);
},
|| {
re_types_builder::generate_rust_code(
&reporter,
RUST_OUTPUT_DIR_PATH,
&objects,
&arrow_registry,
);
},
|| {
re_types_builder::generate_python_code(
&reporter,
PYTHON_OUTPUT_DIR_PATH,
PYTHON_TESTING_OUTPUT_DIR_PATH,
&objects,
Expand All @@ -100,6 +117,8 @@ fn main() {
},
);

report.panic_on_errors();

write_versioning_hash(SOURCE_HASH_PATH, new_hash);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,7 @@ namespace rerun.archetypes;
/// path-hierarchy when searching up through the ancestors of a given entity
/// path.
///
/// \py Example
/// \py -------
/// \py
/// \py ```python
/// \py \include:../../../../../docs/code-examples/annotation_context_rects.py
/// \py ```
///
/// \rs ## Example
/// \rs
/// \rs ```ignore
/// \rs \include:../../../../../docs/code-examples/annotation_context_rects.rs
/// \rs ```
///
/// \cpp ## Example
/// \cpp
/// \cpp ```
/// \cpp \include:../../../../../docs/code-examples/annotation_context_rects.cpp
/// \cpp ```
/// \example annotation_context_rects
table AnnotationContext (
"attr.rust.derive": "Eq, PartialEq",
order: 100
Expand Down
19 changes: 1 addition & 18 deletions crates/re_types/definitions/rerun/archetypes/arrows3d.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,7 @@ namespace rerun.archetypes;

/// A batch of 3D arrows with optional colors, radii, labels, etc.
///
/// \py Example
/// \py -------
/// \py
/// \py ```python
/// \py \include:../../../../../docs/code-examples/arrow3d_simple.py
/// \py ```
///
/// \rs ## Example
/// \rs
/// \rs ```ignore
/// \rs \include:../../../../../docs/code-examples/arrow3d_simple.rs
/// \rs ```
///
/// \cpp ## Example
/// \cpp
/// \cpp ```
/// \cpp \include:../../../../../docs/code-examples/arrow3d_simple.cpp
/// \cpp ```
/// \example arrow3d_simple
table Arrows3D (
"attr.rust.derive": "PartialEq",
order: 100
Expand Down
22 changes: 1 addition & 21 deletions crates/re_types/definitions/rerun/archetypes/boxes2d.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,7 @@ namespace rerun.archetypes;

/// A batch of 2d boxes with half-extents and optional center, rotations, rotations, colors etc.
///
/// \py Example
/// \py -------
/// \py
/// \py Simple 2D boxes:
/// \py ```python
/// \py \include:../../../../../docs/code-examples/box2d_simple.py
/// \py ```
///
/// \rs ## Example
/// \rs
/// \rs Simple 2D boxes:
/// \rs ```ignore
/// \rs \include:../../../../../docs/code-examples/box2d_simple.rs
/// \rs ```
///
/// \cpp ## Example
/// \cpp
/// \cpp Simple 2D boxes:
/// \cpp ```
/// \cpp \include:../../../../../docs/code-examples/box2d_simple.cpp
/// \cpp ```
/// \example box2d_simple "Simple 2D boxes"
table Boxes2D (
"attr.rust.derive": "PartialEq",
"attr.rust.new_pub_crate",
Expand Down
38 changes: 2 additions & 36 deletions crates/re_types/definitions/rerun/archetypes/boxes3d.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,8 @@ namespace rerun.archetypes;

/// A batch of 3d boxes with half-extents and optional center, rotations, rotations, colors etc.
///
/// \py Example
/// \py -------
/// \py
/// \py Simple 3D boxes:
/// \py ```python
/// \py \include:../../../../../docs/code-examples/box3d_simple.py
/// \py ```
/// \py
/// \py Batch of 3D boxes:
/// \py ```python
/// \py \include:../../../../../docs/code-examples/box3d_batch.py
/// \py ```
///
/// \rs ## Example
/// \rs
/// \rs Simple 3D boxes:
/// \rs ```ignore
/// \rs \include:../../../../../docs/code-examples/box3d_simple.rs
/// \rs ```
/// \rs
/// \rs Batch of 3D boxes:
/// \rs ```ignore
/// \rs \include:../../../../../docs/code-examples/box3d_batch.rs
/// \rs ```
///
/// \cpp ## Example
/// \cpp
/// \cpp Simple 3D boxes:
/// \cpp ```
/// \cpp \include:../../../../../docs/code-examples/box3d_simple.cpp
/// \cpp ```
/// \cpp
/// \cpp Batch of 3D boxes:
/// \cpp ```
/// \cpp \include:../../../../../docs/code-examples/box3d_batch.cpp
/// \cpp ```
/// \example box3d_simple "Simple 3D boxes"
/// \example box3d_batch "Batch of 3D boxes"
table Boxes3D (
"attr.rust.derive": "PartialEq",
"attr.rust.new_pub_crate",
Expand Down
35 changes: 2 additions & 33 deletions crates/re_types/definitions/rerun/archetypes/clear.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,39 +9,8 @@ namespace rerun.archetypes;

/// Empties all the components of an entity.
///
/// \py Examples
/// \py --------
/// \py
/// \py Flat:
/// \py ```python
/// \py \include:../../../../../docs/code-examples/clear_simple.py
/// \py ```
/// \py Recursive:
/// \py ```python
/// \py \include:../../../../../docs/code-examples/clear_recursive.py
/// \py ```
///
/// \rs ## Examples
/// \rs
/// \rs Flat:
/// \rs ```ignore
/// \rs \include:../../../../../docs/code-examples/clear_simple.rs
/// \rs ```
/// \rs Recursive:
/// \rs ```ignore
/// \rs \include:../../../../../docs/code-examples/clear_recursive.rs
/// \rs ```
///
/// \cpp ## Examples
/// \cpp
/// \cpp Flat:
/// \cpp ```
/// \cpp \include:../../../../../docs/code-examples/clear_simple.cpp
/// \cpp ```
/// \cpp Recursive:
/// \cpp ```
/// \cpp \include:../../../../../docs/code-examples/clear_recursive.cpp
/// \cpp ```
/// \example clear_simple "Flat"
/// \example clear_recursive "Recursive"
table Clear (
"attr.rust.derive": "PartialEq, Eq",
order: 100
Expand Down
13 changes: 1 addition & 12 deletions crates/re_types/definitions/rerun/archetypes/depth_image.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,7 @@ namespace rerun.archetypes;
/// The shape of the `TensorData` must be mappable to an `HxW` tensor.
/// Each pixel corresponds to a depth value in units specified by `meter`.
///
/// \py Example
/// \py -------
/// \py
/// \py ```python
/// \py \include:../../../../../docs/code-examples/depth_image_simple.py
/// \py ```
///
/// \rs ## Example
/// \rs
/// \rs ```ignore
/// \rs \include:../../../../../docs/code-examples/depth_image_simple.rs
/// \rs ```
/// \example depth_image_simple
table DepthImage (
"attr.rust.derive": "PartialEq",
order: 100
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,7 @@ namespace rerun.archetypes;
/// If a transform or pinhole is logged on the same path, this archetype's components
/// will be ignored.
///
/// \py Example
/// \py -------
/// \py
/// \py ```python
/// \py \include:../../../../../docs/code-examples/disconnected_space.py
/// \py ```
///
/// \rs ## Example
/// \rs
/// \rs ```ignore
/// \rs \include:../../../../../docs/code-examples/disconnected_space.rs
/// \rs ```
///
/// \cpp ## Example
/// \cpp
/// \cpp ```
/// \cpp \include:../../../../../docs/code-examples/disconnected_space.cpp
/// \cpp ```
/// \example disconnected_space
table DisconnectedSpace (
"attr.rust.derive": "Copy, PartialEq, Eq",
order: 100
Expand Down
13 changes: 1 addition & 12 deletions crates/re_types/definitions/rerun/archetypes/image.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,7 @@ namespace rerun.archetypes;
/// Leading and trailing unit-dimensions are ignored, so that
/// `1x640x480x3x1` is treated as a `640x480x3` RGB image.
///
/// \py Example
/// \py -------
/// \py
/// \py ```python
/// \py \include:../../../../../docs/code-examples/image_simple.py
/// \py ```
///
/// \rs ## Example
/// \rs
/// \rs ```ignore
/// \rs \include:../../../../../docs/code-examples/image_simple.rs
/// \rs ```
/// \example image_simple
table Image (
"attr.rust.derive": "PartialEq",
order: 100
Expand Down
38 changes: 2 additions & 36 deletions crates/re_types/definitions/rerun/archetypes/line_strips2d.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,8 @@ namespace rerun.archetypes;

/// A batch of line strips with positions and optional colors, radii, labels, etc.
///
/// \py Example
/// \py -------
/// \py
/// \py Many strips:
/// \py ```python
/// \py \include:../../../../../docs/code-examples/line_strip2d_batch.py
/// \py ```
/// \py
/// \py Many individual segments:
/// \py ```python
/// \py \include:../../../../../docs/code-examples/line_segments2d_simple.py
/// \py ```
///
/// \rs ## Example
/// \rs
/// \rs Many strips:
/// \rs ```ignore
/// \rs \include:../../../../../docs/code-examples/line_strip2d_batch.rs
/// \rs ```
/// \rs
/// \rs Many individual segments:
/// \rs ```ignore
/// \rs \include:../../../../../docs/code-examples/line_segments2d_simple.rs
/// \rs ```
///
/// \cpp ## Example
/// \cpp
/// \cpp Many strips:
/// \cpp ```ignore
/// \cpp \include:../../../../../docs/code-examples/line_strip2d_batch.cpp
/// \cpp ```
/// \cpp
/// \cpp Many individual segments:
/// \cpp ```ignore
/// \cpp \include:../../../../../docs/code-examples/line_segments2d_simple.cpp
/// \cpp ```
/// \example line_strip2d_batch "Many strips"
/// \example line_segments2d_simple "Many individual segments"
table LineStrips2D (
"attr.rust.derive": "PartialEq",
order: 100
Expand Down
38 changes: 2 additions & 36 deletions crates/re_types/definitions/rerun/archetypes/line_strips3d.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,8 @@ namespace rerun.archetypes;

/// A batch of line strips with positions and optional colors, radii, labels, etc.
///
/// \py Example
/// \py -------
/// \py
/// \py Many strips:
/// \py ```python
/// \py \include:../../../../../docs/code-examples/line_strip3d_batch.py
/// \py ```
/// \py
/// \py Many individual segments:
/// \py ```python
/// \py \include:../../../../../docs/code-examples/line_segments3d_simple.py
/// \py ```
///
/// \rs ## Example
/// \rs
/// \rs Many strips:
/// \rs ```ignore
/// \rs \include:../../../../../docs/code-examples/line_strip3d_batch.rs
/// \rs ```
/// \rs
/// \rs Many individual segments:
/// \rs ```ignore
/// \rs \include:../../../../../docs/code-examples/line_segments3d_simple.rs
/// \rs ```
///
/// \cpp ## Example
/// \cpp
/// \cpp Many strips:
/// \cpp ```ignore
/// \cpp \include:../../../../../docs/code-examples/line_strip3d_batch.cpp
/// \cpp ```
/// \cpp
/// \cpp Many individual segments:
/// \cpp ```ignore
/// \cpp \include:../../../../../docs/code-examples/line_segments3d_simple.cpp
/// \cpp ```
/// \example line_strip3d_batch "Many strips"
/// \example line_segments3d_simple "Many individual segments"
table LineStrips3D (
"attr.rust.derive": "PartialEq",
order: 100
Expand Down
13 changes: 1 addition & 12 deletions crates/re_types/definitions/rerun/archetypes/points2d.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,7 @@ namespace rerun.archetypes;

/// A 2D point cloud with positions and optional colors, radii, labels, etc.
///
/// \py Example
/// \py -------
/// \py
/// \py ```python
/// \py \include:../../../../../docs/code-examples/point2d_simple.py
/// \py ```
///
/// \rs ## Example
/// \rs
/// \rs ```ignore
/// \rs \include:../../../../../docs/code-examples/point2d_simple.rs
/// \rs ```
/// \example point2d_simple
table Points2D (
"attr.rust.derive": "PartialEq",
order: 100
Expand Down
Loading