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

Docs codegen #3445

Merged
merged 46 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
f94b152
fix `\examples` not outputting anything in cpp
jprochazk Sep 25, 2023
08608cf
support `\example` args with image + actually generate docs
jprochazk Sep 25, 2023
879818e
Merge branch 'main' into jan/codegen-docs
jprochazk Sep 27, 2023
24df56a
generate image stacks
jprochazk Sep 27, 2023
6c20cf4
unrelated diff
jprochazk Sep 27, 2023
271c4ab
update annotation_context
jprochazk Sep 27, 2023
62e6254
remove `affix_fuzzer`
jprochazk Sep 27, 2023
618af58
add images to `fbs` files from existing docs
jprochazk Sep 27, 2023
3cd6ecf
surround component names in backticks
jprochazk Sep 27, 2023
7e2a9dc
remove unnecessary blank lines
jprochazk Sep 27, 2023
5cce931
fix lint
jprochazk Sep 27, 2023
418e1e3
fix spelling
jprochazk Sep 27, 2023
d3013fc
Merge branch 'main' into jan/codegen-docs
jprochazk Sep 27, 2023
9aa0410
temporarily copy data_types top-level docs
jprochazk Sep 27, 2023
1539b2c
update doc output dir + titles
jprochazk Sep 27, 2023
f1db4ea
update old docs
jprochazk Sep 27, 2023
adbb7d3
use proper headings for example titles in rs/cpp
jprochazk Sep 27, 2023
47c1123
update codegen
jprochazk Sep 27, 2023
2efc288
update docs + delete `data_types_test`
jprochazk Sep 27, 2023
f49d064
remove pointless alt text (doesnt describe the image)
jprochazk Sep 27, 2023
7fc84c3
show images in `rs` and `py` output
jprochazk Sep 27, 2023
cc103c3
update codegen
jprochazk Sep 27, 2023
9c633d1
Merge branch 'main' into jan/codegen-docs
jprochazk Sep 27, 2023
8f7b449
update codegen
jprochazk Sep 27, 2023
24d6bea
docstring `join` macro
jprochazk Sep 28, 2023
bad9696
update `components` section output
jprochazk Sep 28, 2023
d6dc1e8
Update crates/re_types/src/lib.rs
jprochazk Sep 28, 2023
539d960
Update crates/re_types_builder/src/codegen/common.rs
jprochazk Sep 28, 2023
64590cc
Update crates/re_types_builder/src/codegen/common.rs
jprochazk Sep 28, 2023
f77496b
`Example.content` -> `lines`
jprochazk Sep 28, 2023
7c63393
remove commented out code
jprochazk Sep 28, 2023
dd69cb3
move `required` value into variable
jprochazk Sep 28, 2023
21e399e
remove trailing whitespace from docstring line
jprochazk Sep 28, 2023
a4960dd
use `ok()` instead of `let _ =`
jprochazk Sep 28, 2023
693e8b0
use helper for testing archetype detection
jprochazk Sep 28, 2023
98e55e7
quote `title` in frontmatter
jprochazk Sep 28, 2023
875b628
`components_and_apis` -> `write_archetype_fields`
jprochazk Sep 28, 2023
21f9bce
use PascalCase component names
jprochazk Sep 28, 2023
77048e7
remove commented out code
jprochazk Sep 28, 2023
fe6f0a0
`examples_list` -> `write_examples_list` + handle plural section title
jprochazk Sep 28, 2023
0953d10
Merge branch 'main' into jan/codegen-docs
jprochazk Sep 28, 2023
4fd889e
use `:?` instead of manual quotes
jprochazk Sep 28, 2023
19a0201
Merge branch 'main' into jan/codegen-docs
jprochazk Sep 28, 2023
311e49f
remove old archetype docs
jprochazk Sep 28, 2023
cb70526
fix links on data_types index
jprochazk Sep 28, 2023
3bd57da
update broken links + index page
jprochazk Sep 28, 2023
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
70 changes: 39 additions & 31 deletions crates/re_types/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,24 @@ const SOURCE_HASH_PATH: &str = "./source_hash.txt";
const DEFINITIONS_DIR_PATH: &str = "./definitions";
const ENTRYPOINT_PATH: &str = "./definitions/rerun/archetypes.fbs";
const DOC_EXAMPLES_DIR_PATH: &str = "../../docs/code-examples";
const DOC_CONTENT_DIR_PATH: &str = "../../docs/content/reference/data_types";
const CPP_OUTPUT_DIR_PATH: &str = "../../rerun_cpp";
const RUST_OUTPUT_DIR_PATH: &str = ".";
const PYTHON_OUTPUT_DIR_PATH: &str = "../../rerun_py/rerun_sdk/rerun";
const PYTHON_TESTING_OUTPUT_DIR_PATH: &str = "../../rerun_py/tests/test_types";

/// This uses [`rayon::scope`] to spawn all closures as tasks
/// running in parallel. It blocks until all tasks are done.
macro_rules! join {
jprochazk marked this conversation as resolved.
Show resolved Hide resolved
($($task:expr,)*) => {join!($($task),*)};
($($task:expr),*) => {{
#![allow(clippy::redundant_closure_call)]
::rayon::scope(|scope| {
jprochazk marked this conversation as resolved.
Show resolved Hide resolved
$(scope.spawn(|_| ($task)());)*
})
}}
}

fn main() {
if cfg!(target_os = "windows") {
// TODO(#2591): Codegen is temporarily disabled on Windows due to hashing issues.
Expand Down Expand Up @@ -77,40 +90,35 @@ fn main() {
let (objects, arrow_registry) =
re_types_builder::generate_lang_agnostic(DEFINITIONS_DIR_PATH, ENTRYPOINT_PATH);

join3(
|| {
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,
&arrow_registry,
);
},
join!(
|| 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,
&arrow_registry,
),
|| re_types_builder::generate_docs(
&reporter,
DOC_CONTENT_DIR_PATH,
&objects,
&arrow_registry
),
);

report.panic_on_errors();

write_versioning_hash(SOURCE_HASH_PATH, new_hash);
}

// Do 3 things in parallel
fn join3(a: impl FnOnce() + Send, b: impl FnOnce() + Send, c: impl FnOnce() + Send) {
rayon::join(a, || rayon::join(b, c));
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ namespace rerun.archetypes;
/// path-hierarchy when searching up through the ancestors of a given entity
/// path.
///
/// \example annotation_context_rects
/// \example annotation_context_rects title="Rectangles" image="https://static.rerun.io/annotation_context_rects/9b446c36011ed30fce7dc6ed03d5fd9557460f70/1200w.png"
/// \example annotation_context_segmentation title="Segmentation" image="https://static.rerun.io/annotation_context_segmentation/0e21c0a04e456fec41d16b0deaa12c00cddf2d9b/1200w.png"
/// \example annotation_context_connections title="Connections" image="https://static.rerun.io/annotation_context_connections/4a8422bc154699c5334f574ff01b55c5cd1748e3/1200w.png"
table AnnotationContext (
"attr.rust.derive": "Eq, PartialEq",
order: 100
Expand Down
2 changes: 1 addition & 1 deletion crates/re_types/definitions/rerun/archetypes/arrows3d.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace rerun.archetypes;

/// A batch of 3D arrows with optional colors, radii, labels, etc.
///
/// \example arrow3d_simple
/// \example arrow3d_simple image="https://static.rerun.io/arrow3d_simple/c8a8b1cbca40acdf02fb5bf264658ad66e07ca40/1200w.png"
table Arrows3D (
"attr.rust.derive": "PartialEq",
"attr.rust.new_pub_crate",
Expand Down
2 changes: 1 addition & 1 deletion crates/re_types/definitions/rerun/archetypes/asset3d.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace rerun.archetypes;

// ---

/// A prepacked 3D asset (.gltf, .glb, .obj, etc).
/// A prepacked 3D asset (`.gltf`, `.glb`, `.obj`, etc).
///
/// \example asset3d_simple "Simple 3D asset"
/// \example asset3d_out_of_tree "3D asset with out-of-tree transform"
Expand Down
2 changes: 1 addition & 1 deletion crates/re_types/definitions/rerun/archetypes/bar_chart.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ include "rerun/components.fbs";
namespace rerun.archetypes;


/// A Barchart.
/// A bar chart.
///
/// The x values will be the indices of the array, and the bar heights will be the provided values.
///
Expand Down
4 changes: 2 additions & 2 deletions crates/re_types/definitions/rerun/archetypes/boxes3d.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ namespace rerun.archetypes;

/// A batch of 3d boxes with half-extents and optional center, rotations, rotations, colors etc.
///
/// \example box3d_simple "Simple 3D boxes"
/// \example box3d_batch "Batch of 3D boxes"
/// \example box3d_simple title="Simple 3D boxes" image="https://static.rerun.io/box3d_simple/d6a3f38d2e3360fbacac52bb43e44762635be9c8/1200w.png"
/// \example box3d_batch title="Batch of 3D boxes" image="https://static.rerun.io/box3d_batch/28368d2872b2c98186a49fbd063b433e324a88ba/1200w.png"
table Boxes3D (
"attr.rust.derive": "PartialEq",
"attr.rust.new_pub_crate",
Expand Down
3 changes: 2 additions & 1 deletion crates/re_types/definitions/rerun/archetypes/depth_image.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ 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`.
///
/// \example depth_image_simple
/// \example depth_image_simple title="Simple example" image="https://static.rerun.io/depth_image_simple/9598554977873ace2577bddd79184ac120ceb0b0/1200w.png"
/// \example depth_image_3d title="Depth to 3D example" image="https://static.rerun.io/depth_image_3d/f78674bdae0eb25786c6173307693c5338f38b87/1200w.png"
table DepthImage (
"attr.rust.derive": "PartialEq",
order: 100
Expand Down
2 changes: 1 addition & 1 deletion crates/re_types/definitions/rerun/archetypes/image.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace rerun.archetypes;
/// Leading and trailing unit-dimensions are ignored, so that
/// `1x640x480x3x1` is treated as a `640x480x3` RGB image.
///
/// \example image_simple
/// \example image_simple image="https://static.rerun.io/image_simple/06ba7f8582acc1ffb42a7fd0006fad7816f3e4e4/1200w.png"
table Image (
"attr.rust.derive": "PartialEq",
order: 100
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ namespace rerun.archetypes;

/// A batch of line strips with positions and optional colors, radii, labels, etc.
///
/// \example line_strip2d_batch "Many strips"
/// \example line_segments2d_simple "Many individual segments"
/// \example line_strip2d_simple image="https://static.rerun.io/line_strip2d_simple/c4e6ce937544e66b497450fd64ac3ac2f244f0e1/1200w.png"
/// \example line_segments2d_simple image="https://static.rerun.io/line_segment2d_simple/53df596662dd9ffaaea5d09d091ef95220346c83/1200w.png"
/// \example line_strip2d_batch image="https://static.rerun.io/line_strip2d_batch/d8aae7ca3d6c3b0e3b636de60b8067fa2f0b6db9/1200w.png"
table LineStrips2D (
"attr.rust.derive": "PartialEq",
order: 100
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ namespace rerun.archetypes;

/// A batch of line strips with positions and optional colors, radii, labels, etc.
///
/// \example line_strip3d_batch "Many strips"
/// \example line_segments3d_simple "Many individual segments"
/// \example line_strip3d_simple title="Simple example" image="https://static.rerun.io/line_strip3d_simple/13036c0e71f78d3cec37d5724f97b47c4cf3c429/1200w.png"
/// \example line_segments3d_simple title="Many individual segments" image="https://static.rerun.io/line_segment3d_simple/aa800b2a6e6a7b8e32e762b42861bae36f5014bb/1200w.png"
/// \example line_strip3d_batch title="Many strips" image="https://static.rerun.io/line_strip3d_batch/102e5ec5271475657fbc76b469267e4ec8e84337/1200w.png"
table LineStrips3D (
"attr.rust.derive": "PartialEq",
order: 100
Expand Down
2 changes: 1 addition & 1 deletion crates/re_types/definitions/rerun/archetypes/pinhole.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace rerun.archetypes;

/// Camera perspective projection (a.k.a. intrinsics).
///
/// \example pinhole_simple
/// \example pinhole_simple image="https://static.rerun.io/pinhole_simple/9af9441a94bcd9fd54e1fea44fb0c59ff381a7f2/1200w.png"
table Pinhole (
"attr.rust.derive": "PartialEq",
order: 100
Expand Down
3 changes: 2 additions & 1 deletion crates/re_types/definitions/rerun/archetypes/points2d.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ namespace rerun.archetypes;

/// A 2D point cloud with positions and optional colors, radii, labels, etc.
///
/// \example point2d_simple
/// \example point2d_simple image="https://static.rerun.io/point2d_simple/a8e801958bce5aa4e080659c033630f86ce95f71/1200w.png"
/// \example point2d_random image="https://static.rerun.io/point2d_random/8e8ac75373677bd72bd3f56a15e44fcab309a168/1200w.png"
table Points2D (
"attr.rust.derive": "PartialEq",
order: 100
Expand Down
3 changes: 2 additions & 1 deletion crates/re_types/definitions/rerun/archetypes/points3d.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ namespace rerun.archetypes;

/// A 3D point cloud with positions and optional colors, radii, labels, etc.
///
/// \example point3d_simple
/// \example point3d_simple image="https://static.rerun.io/point3d_simple/32fb3e9b65bea8bd7ffff95ad839f2f8a157a933/1200w.png"
/// \example point3d_random image="https://static.rerun.io/point3d_random/7e94e1806d2c381943748abbb3bedb68d564de24/1200w.png"
table Points3D (
"attr.rust.derive": "PartialEq",
order: 100
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace rerun.archetypes;
/// Leading and trailing unit-dimensions are ignored, so that
/// `1x640x480x1` is treated as a `640x480` image.
///
/// \example segmentation_image_simple
/// \example segmentation_image_simple image="https://static.rerun.io/segmentation_image_simple/eb49e0b8cb870c75a69e2a47a2d202e5353115f6/1200w.png"
table SegmentationImage (
"attr.rust.derive": "PartialEq",
order: 100
Expand Down
3 changes: 2 additions & 1 deletion crates/re_types/definitions/rerun/archetypes/tensor.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ namespace rerun.archetypes;

/// A generic n-dimensional Tensor.
///
/// \example tensor_simple
/// \example tensor_simple image="https://static.rerun.io/tensor_simple/1aead2554496737e9267a5ab5220dbc89da851ee/1200w.png"
/// \example tensor_one_dim image="https://static.rerun.io/tensor_one_dim/cbf24b466fe9d9639777aefb34f1a00c3f30d7ab/1200w.png"
table Tensor (
"attr.rust.derive": "PartialEq",
order: 100
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace rerun.archetypes;

// ---

/// Log a double-precision scalar that will be visualized as a timeseries plot.
/// Log a double-precision scalar that will be visualized as a time-series plot.
///
/// The current simulation time will be used for the time/X-axis, hence scalars
/// cannot be timeless!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace rerun.archetypes;

/// A 3D transform.
///
/// \example transform3d_simple
/// \example transform3d_simple image="https://static.rerun.io/transform3d_simple/141368b07360ce3fcb1553079258ae3f42bdb9ac/1200w.png"
table Transform3D (
"attr.rust.derive": "PartialEq",
order: 100
Expand Down
107 changes: 106 additions & 1 deletion crates/re_types/src/archetypes/annotation_context.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions crates/re_types/src/archetypes/arrows3d.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading