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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
25 changes: 11 additions & 14 deletions crates/build/re_build_tools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,27 @@

//! This crate is to be used from `build.rs` build scripts.

use anyhow::Context as _;

use std::process::Command;
use std::sync::atomic::{AtomicBool, Ordering};

use anyhow::Context as _;

mod git;
mod hashing;
mod rebuild_detector;
mod rustfmt;

pub use self::git::{git_branch, git_commit_hash, git_commit_short_hash};
pub use self::hashing::{
compute_crate_hash, compute_dir_filtered_hash, compute_dir_hash, compute_file_hash,
compute_strings_hash, iter_dir, read_versioning_hash, write_versioning_hash,
};
pub(crate) use self::rebuild_detector::Packages;

pub use self::{
git::{git_branch, git_commit_hash, git_commit_short_hash},
hashing::{
compute_crate_hash, compute_dir_filtered_hash, compute_dir_hash, compute_file_hash,
compute_strings_hash, iter_dir, read_versioning_hash, write_versioning_hash,
},
rebuild_detector::{
get_and_track_env_var, is_tracked_env_var_set, rebuild_if_crate_changed, rerun_if_changed,
rerun_if_changed_glob, rerun_if_changed_or_doesnt_exist, write_file_if_necessary,
},
rustfmt::rustfmt_str,
pub use self::rebuild_detector::{
get_and_track_env_var, is_tracked_env_var_set, rebuild_if_crate_changed, rerun_if_changed,
rerun_if_changed_glob, rerun_if_changed_or_doesnt_exist, write_file_if_necessary,
};
pub use self::rustfmt::rustfmt_str;

// ------------------

Expand Down
9 changes: 4 additions & 5 deletions crates/build/re_build_tools/src/rebuild_detector.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#![expect(clippy::unwrap_used)]

use std::{
collections::{HashMap, HashSet},
path::{Path, PathBuf},
};
use std::collections::{HashMap, HashSet};
use std::path::{Path, PathBuf};

use cargo_metadata::{CargoOpt, Metadata, MetadataCommand, Package, PackageId, camino::Utf8Path};
use cargo_metadata::camino::Utf8Path;
use cargo_metadata::{CargoOpt, Metadata, MetadataCommand, Package, PackageId};

use crate::should_output_cargo_build_instructions;

Expand Down
3 changes: 1 addition & 2 deletions crates/build/re_dev_tools/src/build_examples/example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

use std::collections::BTreeMap;
use std::fmt::Display;
use std::path::Path;
use std::path::PathBuf;
use std::path::{Path, PathBuf};
use std::str::FromStr;

use anyhow::Context as _;
Expand Down
6 changes: 4 additions & 2 deletions crates/build/re_dev_tools/src/build_examples/install.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use std::process::Command;

use indicatif::MultiProgress;

use super::Channel;
use crate::build_examples::wait_for_output::wait_for_output;
use indicatif::MultiProgress;
use std::process::Command;

/// Install the selected examples in the current environment.
#[derive(argh::FromArgs)]
Expand Down
9 changes: 3 additions & 6 deletions crates/build/re_dev_tools/src/build_examples/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@ mod rrd;
mod snippets;
mod wait_for_output;

use example::Channel;
use wait_for_output::wait_for_output;

pub use example::{Example, ExamplesManifest, Language};

// -----------------------------------------------------------------------------

use argh::FromArgs;
use example::Channel;
pub use example::{Example, ExamplesManifest, Language};
use wait_for_output::wait_for_output;

/// Build examples and their manifest.
#[derive(FromArgs)]
Expand Down
9 changes: 5 additions & 4 deletions crates/build/re_dev_tools/src/build_examples/notebook.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use super::{Channel, Example, wait_for_output};
use indicatif::MultiProgress;
use rayon::prelude::IntoParallelIterator as _;
use rayon::prelude::ParallelIterator as _;
use std::fs;
use std::process::Command;

use indicatif::MultiProgress;
use rayon::prelude::{IntoParallelIterator as _, ParallelIterator as _};

use super::{Channel, Example, wait_for_output};

/// Collect examples in the repository and run them to produce `.rrd` files.
#[derive(argh::FromArgs)]
#[argh(subcommand, name = "notebook")]
Expand Down
12 changes: 6 additions & 6 deletions crates/build/re_dev_tools/src/build_examples/rrd.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use super::{Channel, Example, wait_for_output};
use indicatif::MultiProgress;
use rayon::prelude::IntoParallelIterator as _;
use rayon::prelude::ParallelIterator as _;
use std::fs::create_dir_all;
use std::path::Path;
use std::path::PathBuf;
use std::path::{Path, PathBuf};
use std::process::Command;

use indicatif::MultiProgress;
use rayon::prelude::{IntoParallelIterator as _, ParallelIterator as _};

use super::{Channel, Example, wait_for_output};

/// Collect examples in the repository and run them to produce `.rrd` files.
#[derive(argh::FromArgs)]
#[argh(subcommand, name = "rrd")]
Expand Down
9 changes: 3 additions & 6 deletions crates/build/re_dev_tools/src/build_examples/snippets.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
use std::collections::HashMap;
use std::fs::create_dir_all;
use std::fs::read_to_string;
use std::path::Path;
use std::path::PathBuf;
use std::fs::{create_dir_all, read_to_string};
use std::path::{Path, PathBuf};
use std::process::Command;

use camino::Utf8Path;
use indicatif::MultiProgress;
use rayon::prelude::IntoParallelIterator as _;
use rayon::prelude::ParallelIterator as _;
use rayon::prelude::{IntoParallelIterator as _, ParallelIterator as _};

use super::wait_for_output;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
use std::io::IsTerminal as _;
use std::io::stdout;
use std::io::{IsTerminal as _, stdout};
use std::process::Command;
use std::time::Duration;

use indicatif::MultiProgress;
use indicatif::ProgressBar;
use indicatif::{MultiProgress, ProgressBar};

/// Returns an error on non-zero returncode.
pub fn wait_for_output(
Expand Down
3 changes: 2 additions & 1 deletion crates/build/re_dev_tools/src/build_search_index/build.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use super::{DEFAULT_INDEX, DEFAULT_KEY, DEFAULT_URL, ingest, meili};
use cargo_metadata::semver::Version;

use super::{DEFAULT_INDEX, DEFAULT_KEY, DEFAULT_URL, ingest, meili};

/// Index documentation, examples, and API references for all languages
#[derive(argh::FromArgs)]
#[argh(subcommand, name = "build")]
Expand Down
13 changes: 6 additions & 7 deletions crates/build/re_dev_tools/src/build_search_index/ingest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@ mod python;
/// C++ API reference generated by Doxygen
mod cpp;

use camino::Utf8Path;
use cargo_metadata::Package;
use cargo_metadata::semver::Version;
use indicatif::MultiProgress;
use indicatif::ProgressBar;
use std::borrow::Cow;
use std::cell::Cell;
use std::cell::RefCell;
use std::cell::{Cell, RefCell};
use std::io::IsTerminal as _;
use std::time::Duration;

use camino::Utf8Path;
use cargo_metadata::Package;
use cargo_metadata::semver::Version;
use indicatif::{MultiProgress, ProgressBar};

pub fn run(
release_version: Option<Version>,
exclude_crates: &[String],
Expand Down
18 changes: 7 additions & 11 deletions crates/build/re_dev_tools/src/build_search_index/ingest/cpp.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
#![expect(clippy::unwrap_used)] // build tool, so okay here

use super::Context;
use super::DocumentData;
use super::DocumentKind;
use crate::build_search_index::util::CommandExt as _;
use crate::build_search_index::util::ProgressBarExt as _;
use camino::Utf8PathBuf;
use itertools::Itertools as _;
use roxmltree::Children;
use roxmltree::Descendants;
use roxmltree::Document;
use roxmltree::Node;
use std::collections::HashSet;
use std::fmt::Display;
use std::fs::read_to_string;
use std::process::Command;

use camino::Utf8PathBuf;
use itertools::Itertools as _;
use roxmltree::{Children, Descendants, Document, Node};

use super::{Context, DocumentData, DocumentKind};
use crate::build_search_index::util::{CommandExt as _, ProgressBarExt as _};

macro_rules! document {
($dom:ident, $path:expr) => {
let dom = read_to_string($path)?;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#![expect(clippy::unwrap_used)] // build tool, so okay here

use std::path::Path;

use super::{Context, DocumentData, DocumentKind};
use crate::build_search_index::util::ProgressBarExt as _;
use std::path::Path;

pub fn ingest(ctx: &Context) -> anyhow::Result<()> {
let progress = ctx.progress_bar("docs");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use super::{Context, DocumentData, DocumentKind};
use crate::build_search_index::util::CommandExt as _;
use crate::build_search_index::util::ProgressBarExt as _;
use std::collections::{BTreeMap, HashMap};
use std::process::Command;

use anyhow::Context as _;
use serde::Deserialize;
use std::collections::BTreeMap;
use std::collections::HashMap;
use std::process::Command;

use super::{Context, DocumentData, DocumentKind};
use crate::build_search_index::util::{CommandExt as _, ProgressBarExt as _};

const RERUN_SDK: &str = "rerun_sdk";

Expand Down
23 changes: 9 additions & 14 deletions crates/build/re_dev_tools/src/build_search_index/ingest/rust.rs
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
#![expect(clippy::unwrap_used)] // build tool, so okay here

use super::{Context, DocumentData, DocumentKind};
use crate::build_search_index::util::ProgressBarExt as _;
use anyhow::Context as _;
use cargo_metadata::semver::Version;
use indicatif::ProgressBar;
use rayon::prelude::IntoParallelIterator as _;
use rayon::prelude::ParallelIterator as _;
use rustdoc_types::Crate;
use rustdoc_types::Id as ItemId;
use rustdoc_types::Impl;
use rustdoc_types::Item;
use rustdoc_types::ItemEnum;
use rustdoc_types::Type;
use rustdoc_types::Use;
use std::collections::HashSet;
use std::fmt::Display;
use std::fs::File;
use std::io::BufReader;
use std::sync::mpsc;

use anyhow::Context as _;
use cargo_metadata::semver::Version;
use indicatif::ProgressBar;
use rayon::prelude::{IntoParallelIterator as _, ParallelIterator as _};
use rustdoc_types::{Crate, Id as ItemId, Impl, Item, ItemEnum, Type, Use};

use super::{Context, DocumentData, DocumentKind};
use crate::build_search_index::util::ProgressBarExt as _;

/// Ingest rust documentation for all published crates in the current workspace.
///
/// It collects the following top-level `pub` items:
Expand Down
10 changes: 5 additions & 5 deletions crates/build/re_dev_tools/src/build_search_index/repl.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::io::{Write as _, stdin, stdout};
use std::ops::ControlFlow;

use cargo_metadata::semver::Version;

use super::meili::SearchClient;
use super::{DEFAULT_INDEX, DEFAULT_KEY, DEFAULT_URL, ingest, meili};
use cargo_metadata::semver::Version;
use std::io::Write as _;
use std::io::stdin;
use std::io::stdout;
use std::ops::ControlFlow;

/// Simple terminal search client
#[derive(argh::FromArgs)]
Expand Down
6 changes: 3 additions & 3 deletions crates/build/re_dev_tools/src/build_search_index/util.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use indicatif::ProgressBar;
use std::borrow::Cow;
use std::ffi::OsStr;
use std::io;
use std::path::Path;
use std::process::Command;
use std::process::Stdio;
use std::process::{Command, Stdio};

use indicatif::ProgressBar;

pub trait CommandExt {
fn with_cwd<P>(self, cwd: P) -> Self
Expand Down
1 change: 0 additions & 1 deletion crates/build/re_dev_tools/src/build_web_viewer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ mod lib;

use argh::FromArgs;
use cargo_metadata::camino::Utf8PathBuf;

use lib::{Profile, Target, build, default_build_dir};

/// Build the web-viewer.
Expand Down
3 changes: 1 addition & 2 deletions crates/build/re_types_builder/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

use std::path::Path;

use xshell::{Shell, cmd};

use re_build_tools::{compute_file_hash, read_versioning_hash, write_versioning_hash};
use xshell::{Shell, cmd};

// ---

Expand Down
3 changes: 1 addition & 2 deletions crates/build/re_types_builder/src/bin/build_re_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
// TODO(#3408): remove unwrap()
#![expect(clippy::unwrap_used)]

use camino::Utf8Path;
use re_build_tools::{
read_versioning_hash, set_output_cargo_build_instructions, write_versioning_hash,
};
use re_types_builder::{SourceLocations, compute_re_types_hash};

use camino::Utf8Path;

const RE_TYPES_SOURCE_HASH_PATH: &str = "crates/store/re_types/source_hash.txt";
const DEFINITIONS_DIR_PATH: &str = "crates/store/re_types/definitions";
const ENTRYPOINT_PATH: &str = "crates/store/re_types/definitions/entry_point.fbs";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use proc_macro2::Ident;
use quote::{format_ident, quote};

use crate::{Object, ObjectClass, Objects, Type};

use super::forward_decl::{ForwardDecl, ForwardDecls};
use crate::{Object, ObjectClass, Objects, Type};

pub fn arrow_array_builder_type(typ: &Type, objects: &Objects) -> Ident {
arrow_array_builder_type_and_declaration(typ, objects, &mut ForwardDecls::default())
Expand Down
3 changes: 1 addition & 2 deletions crates/build/re_types_builder/src/codegen/cpp/includes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ use std::collections::BTreeSet;
use proc_macro2::TokenStream;
use quote::quote;

use crate::objects::is_testing_fqname;

use super::{ANGLE_BRACKET_LEFT_TOKEN, ANGLE_BRACKET_RIGHT_TOKEN, NEWLINE_TOKEN};
use crate::objects::is_testing_fqname;

/// Keeps track of necessary includes for a file.
pub struct Includes {
Expand Down
3 changes: 1 addition & 2 deletions crates/build/re_types_builder/src/codegen/cpp/method.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use proc_macro2::TokenStream;
use quote::quote;

use crate::{Docs, Objects, Reporter};

use super::{NEWLINE_TOKEN, lines_from_docs, quote_doc_comment, quote_doc_lines};
use crate::{Docs, Objects, Reporter};

#[derive(Default)]
pub struct MethodDeclaration {
Expand Down
Loading
Loading