From de909bd985cf27394dc4839f5a06f287c25c081e Mon Sep 17 00:00:00 2001 From: Pedro Ferreira Date: Thu, 25 Sep 2025 12:06:31 +0000 Subject: [PATCH 01/10] devcontainer: add rust tooling to container - Add a new forlder for scripts that can be used to avoid duplicating code across Dockerfiles. - Add a script to install rust and related tools Signed-off-by: Pedro Ferreira --- .devcontainer/Dockerfile | 3 +- .devcontainer/Dockerfile.almalinux | 3 +- .devcontainer/Dockerfile.amazonlinux | 3 +- .devcontainer/Dockerfile.debiantrixie | 3 +- .devcontainer/Dockerfile.ubuntu-legacy | 3 +- .../scripts/common/rust/install-rust.sh | 29 +++++++++++++++++++ 6 files changed, 39 insertions(+), 5 deletions(-) create mode 100755 .devcontainer/scripts/common/rust/install-rust.sh diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index b4af3604..8437333d 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -86,4 +86,5 @@ RUN git clone https://github.com/microsoft/vcpkg \ ENV VCPKG_ROOT="/home/${USERNAME}/vcpkg" -RUN rustup default 1.88.0 +COPY ./scripts/ /tmp/scripts/ +RUN /tmp/scripts/common/rust/install-rust.sh diff --git a/.devcontainer/Dockerfile.almalinux b/.devcontainer/Dockerfile.almalinux index 4b1b378e..19c274f7 100644 --- a/.devcontainer/Dockerfile.almalinux +++ b/.devcontainer/Dockerfile.almalinux @@ -73,4 +73,5 @@ RUN git clone https://github.com/microsoft/vcpkg \ ENV VCPKG_ROOT=/home/$USERNAME/vcpkg -RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=1.88.0 +COPY ./scripts/ /tmp/scripts/ +RUN /tmp/scripts/common/rust/install-rust.sh diff --git a/.devcontainer/Dockerfile.amazonlinux b/.devcontainer/Dockerfile.amazonlinux index e5ce400b..134763dc 100644 --- a/.devcontainer/Dockerfile.amazonlinux +++ b/.devcontainer/Dockerfile.amazonlinux @@ -66,4 +66,5 @@ RUN git clone https://github.com/microsoft/vcpkg \ ENV VCPKG_ROOT=/home/$USERNAME/vcpkg -RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=1.88.0 +COPY ./scripts/ /tmp/scripts/ +RUN /tmp/scripts/common/rust/install-rust.sh diff --git a/.devcontainer/Dockerfile.debiantrixie b/.devcontainer/Dockerfile.debiantrixie index 923648c5..ba0d76d9 100644 --- a/.devcontainer/Dockerfile.debiantrixie +++ b/.devcontainer/Dockerfile.debiantrixie @@ -81,4 +81,5 @@ RUN git clone https://github.com/microsoft/vcpkg \ ENV VCPKG_ROOT="/home/${USERNAME}/vcpkg" -RUN rustup default 1.88.0 +COPY ./scripts/ /tmp/scripts/ +RUN /tmp/scripts/common/rust/install-rust.sh diff --git a/.devcontainer/Dockerfile.ubuntu-legacy b/.devcontainer/Dockerfile.ubuntu-legacy index 69ba26e8..4ca0677c 100644 --- a/.devcontainer/Dockerfile.ubuntu-legacy +++ b/.devcontainer/Dockerfile.ubuntu-legacy @@ -100,4 +100,5 @@ ENV VCPKG_ROOT=/home/$USERNAME/vcpkg COPY register-clang-version.sh /home/$USERNAME/register-clang-version.sh RUN sudo /home/$USERNAME/register-clang-version.sh ${CLANG_VERSION} 100 && rm /home/$USERNAME/register-clang-version.sh -RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=1.88.0 +COPY ./scripts/ /tmp/scripts/ +RUN /tmp/scripts/common/rust/install-rust.sh diff --git a/.devcontainer/scripts/common/rust/install-rust.sh b/.devcontainer/scripts/common/rust/install-rust.sh new file mode 100755 index 00000000..ae7696db --- /dev/null +++ b/.devcontainer/scripts/common/rust/install-rust.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +# SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project. +# SPDX-License-Identifier: Apache-2.0 + +set -eu + +RUST_VERSION=1.88.0 + +if command -v rustup >/dev/null 2>&1; then + rustup default $RUST_VERSION +else + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=$RUST_VERSION + . "$HOME/.cargo/env" +fi + +# Install cargo binstall +curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash + +cargo binstall cargo-audit --locked +cargo binstall cargo-outdated --locked + +# udeps requires the nightly compiler, so using machete (at least for now) +# cargo binstall cargo-udeps --locked +cargo binstall cargo-machete --locked + +cargo binstall cargo-deny --locked +cargo binstall cargo-audit --locked +cargo binstall cargo-nextest --locked From bd62ef6340a6b9c37d978c8138d8aabaab9b43e6 Mon Sep 17 00:00:00 2001 From: Pedro Ferreira Date: Thu, 25 Sep 2025 12:07:07 +0000 Subject: [PATCH 02/10] cmake: add an option to disable building the docs Signed-off-by: Pedro Ferreira --- CMakeLists.txt | 55 ++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 72b11e1c..e4f66480 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,7 @@ else() string(APPEND mxl_VERSION ".0") endif() +option(BUILD_DOCS "Build the docs" ON) option(BUILD_TESTS "Build the tests" ON) option(BUILD_TOOLS "Build the tools" ON) @@ -62,39 +63,41 @@ if (BUILD_TOOLS) add_subdirectory(tools) endif() -find_package(Doxygen) +if(BUILD_DOCS) + find_package(Doxygen) -if(DOXYGEN_FOUND) - include(FetchContent) + if(DOXYGEN_FOUND) + include(FetchContent) - FetchContent_Declare( - doxygen-awesome-css - URL https://github.com/jothepro/doxygen-awesome-css/archive/refs/heads/main.zip - ) - FetchContent_MakeAvailable(doxygen-awesome-css) + FetchContent_Declare( + doxygen-awesome-css + URL https://github.com/jothepro/doxygen-awesome-css/archive/refs/heads/main.zip + ) + FetchContent_MakeAvailable(doxygen-awesome-css) - # Save the location the files were cloned into - # This allows us to get the path to doxygen-awesome.css - FetchContent_GetProperties(doxygen-awesome-css SOURCE_DIR AWESOME_CSS_DIR) + # Save the location the files were cloned into + # This allows us to get the path to doxygen-awesome.css + FetchContent_GetProperties(doxygen-awesome-css SOURCE_DIR AWESOME_CSS_DIR) - # Generate the Doxyfile - set(DOXYFILE_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in) - set(DOXYFILE_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) - configure_file(${DOXYFILE_IN} ${DOXYFILE_OUT} @ONLY) + # Generate the Doxyfile + set(DOXYFILE_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in) + set(DOXYFILE_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) + configure_file(${DOXYFILE_IN} ${DOXYFILE_OUT} @ONLY) - set(DOXYGEN_OUTPUT_DIR "${CMAKE_BINARY_DIR}/docs") + set(DOXYGEN_OUTPUT_DIR "${CMAKE_BINARY_DIR}/docs") - add_custom_target(doc - COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYFILE_OUT} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Generating API documentation with Doxygen" - BYPRODUCTS "${DOXYGEN_OUTPUT_DIR}/html/index.html" - VERBATIM - ) + add_custom_target(doc + COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYFILE_OUT} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Generating API documentation with Doxygen" + BYPRODUCTS "${DOXYGEN_OUTPUT_DIR}/html/index.html" + VERBATIM + ) - install(DIRECTORY "${CMAKE_BINARY_DIR}/docs/html" - DESTINATION share/doc/mxl - FILES_MATCHING PATTERN "*") + install(DIRECTORY "${CMAKE_BINARY_DIR}/docs/html" + DESTINATION share/doc/mxl + FILES_MATCHING PATTERN "*") + endif() endif() if(EXISTS "/etc/os-release") From f328860411f755708b79fae69c1904b3fe1a9257 Mon Sep 17 00:00:00 2001 From: Pedro Ferreira Date: Thu, 25 Sep 2025 12:09:00 +0000 Subject: [PATCH 03/10] build.rs: use CMake presets Signed-off-by: Pedro Ferreira --- rust/mxl-sys/build.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/rust/mxl-sys/build.rs b/rust/mxl-sys/build.rs index 390ce970..5ea02f47 100644 --- a/rust/mxl-sys/build.rs +++ b/rust/mxl-sys/build.rs @@ -48,13 +48,19 @@ fn get_bindgen_specs() -> BindgenSpecs { let mxl_version_header = mxl_version_out_path.join("version.h"); println!("cargo:rerun-if-changed={}", mxl_version_header.display()); // TODO: re-run on build_dir changing? + // TODO: re-run on any changes in lib + + let out_dir = PathBuf::from(std::env::var("OUT_DIR").unwrap()); let dst = cmake::Config::new(repo_root) - .out_dir(build_dir) - .generator("Unix Makefiles") + .generator("Ninja") + .configure_arg("--preset") + .configure_arg(BUILD_VARIANT) + .configure_arg("-B") + .configure_arg(out_dir.join("build")) + .define("BUILD_DOCS", "OFF") .define("BUILD_TESTS", "OFF") .define("BUILD_TOOLS", "OFF") - // .configure_arg(format!("--preset={BUILD_VARIANT}")) .build(); let mxl_version_location = dst.join("include").join("mxl").join("version.h"); From d8c3b147f4307ccf5c979676df893483f6d2c2d5 Mon Sep 17 00:00:00 2001 From: Pedro Ferreira Date: Thu, 25 Sep 2025 12:46:49 +0000 Subject: [PATCH 04/10] build.rs: simplify binding generation Assume that mxl is always built in the target directory. Signed-off-by: Pedro Ferreira --- rust/mxl-sys/build.rs | 33 ++++++--------------------------- rust/mxl/src/config.rs | 7 +++---- 2 files changed, 9 insertions(+), 31 deletions(-) diff --git a/rust/mxl-sys/build.rs b/rust/mxl-sys/build.rs index 5ea02f47..2eaf1d9f 100644 --- a/rust/mxl-sys/build.rs +++ b/rust/mxl-sys/build.rs @@ -1,5 +1,4 @@ use std::env; -use std::fs; use std::path::PathBuf; #[cfg(debug_assertions)] @@ -29,28 +28,14 @@ fn get_bindgen_specs() -> BindgenSpecs { .to_string(), ]; if cfg!(not(feature = "mxl-not-built")) { - let build_dir = repo_root.join("build").join(BUILD_VARIANT); - let build_version_dir = build_dir - .join("lib") - .join("include") - .to_string_lossy() - .to_string(); + let out_dir = PathBuf::from(std::env::var("OUT_DIR").unwrap()); + let build_version_dir = out_dir.join("include").to_string_lossy().to_string(); includes_dirs.push(build_version_dir); - let mxl_version_out_path = manifest_dir.join("mxl"); - if !fs::exists(&mxl_version_out_path) - .expect("Error checking if out path for version header file exists") - { - fs::create_dir(&mxl_version_out_path) - .expect("Failed to create out path for version header file"); - } - let mxl_version_header = mxl_version_out_path.join("version.h"); - println!("cargo:rerun-if-changed={}", mxl_version_header.display()); - // TODO: re-run on build_dir changing? - // TODO: re-run on any changes in lib - - let out_dir = PathBuf::from(std::env::var("OUT_DIR").unwrap()); + // Rebuild if any file in lib/ changes + let lib_root = repo_root.join("lib"); + println!("cargo:rerun-if-changed={}", lib_root.display()); let dst = cmake::Config::new(repo_root) .generator("Ninja") @@ -63,13 +48,7 @@ fn get_bindgen_specs() -> BindgenSpecs { .define("BUILD_TOOLS", "OFF") .build(); - let mxl_version_location = dst.join("include").join("mxl").join("version.h"); - assert!(matches!(std::fs::exists(&mxl_version_location), Ok(true))); - - fs::copy(&mxl_version_location, &mxl_version_header) - .expect("Could copy mxl version header"); - - println!("cargo:rustc-link-search={}", dst.join("lib64").display()); + println!("cargo:rustc-link-search={}", dst.join("lib").display()); println!("cargo:rustc-link-lib=mxl"); } diff --git a/rust/mxl/src/config.rs b/rust/mxl/src/config.rs index f89891ae..0b333e8b 100644 --- a/rust/mxl/src/config.rs +++ b/rust/mxl/src/config.rs @@ -3,10 +3,9 @@ use std::str::FromStr; include!(concat!(env!("OUT_DIR"), "/constants.rs")); pub fn get_mxf_so_path() -> std::path::PathBuf { - std::path::PathBuf::from_str(MXL_BUILD_DIR) - .expect("build error: 'MXL_BUILD_DIR' is invalid") - .join("lib") - .join("libmxl.so") + // The mxl-sys build script ensures that the build directory is in the library path + // so we can just return the library name here. + "libmxl.so".into() } pub fn get_mxl_repo_root() -> std::path::PathBuf { From 0cc57dc2dff881751a99b8fa5186f6d77b864705 Mon Sep 17 00:00:00 2001 From: Pedro Ferreira Date: Thu, 25 Sep 2025 16:03:31 +0000 Subject: [PATCH 05/10] rust: update to 1.90.0 Signed-off-by: Pedro Ferreira --- .devcontainer/scripts/common/rust/install-rust.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.devcontainer/scripts/common/rust/install-rust.sh b/.devcontainer/scripts/common/rust/install-rust.sh index ae7696db..fbab8779 100755 --- a/.devcontainer/scripts/common/rust/install-rust.sh +++ b/.devcontainer/scripts/common/rust/install-rust.sh @@ -5,9 +5,9 @@ set -eu -RUST_VERSION=1.88.0 +RUST_VERSION=1.90.0 -if command -v rustup >/dev/null 2>&1; then +if command -v rustup > /dev/null 2>&1; then rustup default $RUST_VERSION else curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain=$RUST_VERSION From e08a5109cd16feb1afe5ae141e0cb458d14bd651 Mon Sep 17 00:00:00 2001 From: Pedro Ferreira Date: Thu, 25 Sep 2025 18:52:40 +0000 Subject: [PATCH 06/10] rust: correct typo in get_mxl_so_path Signed-off-by: Pedro Ferreira --- rust/mxl/examples/flow-reader.rs | 4 ++-- rust/mxl/examples/flow-writer.rs | 4 ++-- rust/mxl/src/config.rs | 2 +- rust/mxl/tests/basic_tests.rs | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/rust/mxl/examples/flow-reader.rs b/rust/mxl/examples/flow-reader.rs index 98bd2a2c..5fce9794 100644 --- a/rust/mxl/examples/flow-reader.rs +++ b/rust/mxl/examples/flow-reader.rs @@ -3,7 +3,7 @@ mod common; use std::time::Duration; use clap::Parser; -use mxl::config::get_mxf_so_path; +use mxl::config::get_mxl_so_path; use tracing::{info, warn}; const READ_TIMEOUT: Duration = Duration::from_secs(5); @@ -30,7 +30,7 @@ fn main() -> Result<(), mxl::Error> { common::setup_logging(); let opts: Opts = Opts::parse(); - let mxl_api = mxl::load_api(get_mxf_so_path())?; + let mxl_api = mxl::load_api(get_mxl_so_path())?; let mxl_instance = mxl::MxlInstance::new(mxl_api, &opts.mxl_domain, "")?; let reader = mxl_instance.create_flow_reader(&opts.flow_id)?; let flow_info = reader.get_info()?; diff --git a/rust/mxl/examples/flow-writer.rs b/rust/mxl/examples/flow-writer.rs index 7fe5ba13..b91bfc3a 100644 --- a/rust/mxl/examples/flow-writer.rs +++ b/rust/mxl/examples/flow-writer.rs @@ -3,7 +3,7 @@ mod common; use clap::Parser; use tracing::info; -use mxl::config::get_mxf_so_path; +use mxl::config::get_mxl_so_path; #[derive(Debug, Parser)] #[command(version = clap::crate_version!(), author = clap::crate_authors!())] @@ -30,7 +30,7 @@ fn main() -> Result<(), mxl::Error> { common::setup_logging(); let opts: Opts = Opts::parse(); - let mxl_api = mxl::load_api(get_mxf_so_path())?; + let mxl_api = mxl::load_api(get_mxl_so_path())?; let mxl_instance = mxl::MxlInstance::new(mxl_api, &opts.mxl_domain, "")?; let flow_def = mxl::tools::read_file(opts.flow_config_file.as_str()).map_err(|error| { mxl::Error::Other(format!( diff --git a/rust/mxl/src/config.rs b/rust/mxl/src/config.rs index 0b333e8b..d4001870 100644 --- a/rust/mxl/src/config.rs +++ b/rust/mxl/src/config.rs @@ -2,7 +2,7 @@ use std::str::FromStr; include!(concat!(env!("OUT_DIR"), "/constants.rs")); -pub fn get_mxf_so_path() -> std::path::PathBuf { +pub fn get_mxl_so_path() -> std::path::PathBuf { // The mxl-sys build script ensures that the build directory is in the library path // so we can just return the library name here. "libmxl.so".into() diff --git a/rust/mxl/tests/basic_tests.rs b/rust/mxl/tests/basic_tests.rs index 7242077c..fb5295bf 100644 --- a/rust/mxl/tests/basic_tests.rs +++ b/rust/mxl/tests/basic_tests.rs @@ -4,7 +4,7 @@ /// change in the future. For now, feel free to just edit the path to your library. use std::time::Duration; -use mxl::{MxlInstance, OwnedGrainData, OwnedSamplesData, config::get_mxf_so_path}; +use mxl::{MxlInstance, OwnedGrainData, OwnedSamplesData, config::get_mxl_so_path}; use tracing::info; static LOG_ONCE: std::sync::Once = std::sync::Once::new(); @@ -32,7 +32,7 @@ fn setup_test(test: &str) -> mxl::MxlInstance { .init(); }); - let mxl_api = mxl::load_api(get_mxf_so_path()).unwrap(); + let mxl_api = mxl::load_api(get_mxl_so_path()).unwrap(); let domain = setup_empty_domain(test); mxl::MxlInstance::new(mxl_api, &domain, "").unwrap() } From 74b767fc64f583081f6ef6ce32c7b57b8f10b891 Mon Sep 17 00:00:00 2001 From: Pedro Ferreira Date: Tue, 24 Jun 2025 12:02:34 +0000 Subject: [PATCH 07/10] doc: fix warnings in doc generation for bindings Signed-off-by: Pedro Ferreira --- rust/mxl-sys/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rust/mxl-sys/src/lib.rs b/rust/mxl-sys/src/lib.rs index 666331b0..2e4dc43d 100644 --- a/rust/mxl-sys/src/lib.rs +++ b/rust/mxl-sys/src/lib.rs @@ -2,6 +2,8 @@ #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(missing_docs)] +#![allow(rustdoc::broken_intra_doc_links)] +#![allow(rustdoc::invalid_html_tags)] // Suppress expected warnings from bindgen-generated code. // See https://github.com/rust-lang/rust-bindgen/issues/1651. #![allow(deref_nullptr)] From 35cc921ab6a9bf311e639f3a77054a89300fdaa0 Mon Sep 17 00:00:00 2001 From: Pedro Ferreira Date: Thu, 25 Sep 2025 19:06:43 +0000 Subject: [PATCH 08/10] devcontainer: add rust analyzer plugin Signed-off-by: Pedro Ferreira --- .devcontainer/almalinux/devcontainer.json | 5 +++-- .devcontainer/amazonlinux/devcontainer.json | 5 +++-- .devcontainer/debiantrixie/devcontainer.json | 5 +++-- .devcontainer/ubuntu20/devcontainer.json | 5 +++-- .devcontainer/ubuntu22/devcontainer.json | 5 +++-- .devcontainer/ubuntu24/devcontainer.json | 5 +++-- .devcontainer/ubuntu25/devcontainer.json | 5 +++-- 7 files changed, 21 insertions(+), 14 deletions(-) diff --git a/.devcontainer/almalinux/devcontainer.json b/.devcontainer/almalinux/devcontainer.json index c80d44b2..252bbf68 100644 --- a/.devcontainer/almalinux/devcontainer.json +++ b/.devcontainer/almalinux/devcontainer.json @@ -28,7 +28,8 @@ "matepek.vscode-catch2-test-adapter", "llvm-vs-code-extensions.vscode-clangd", "xaver.clang-format", - "bierner.markdown-mermaid" + "bierner.markdown-mermaid", + "rust-lang.rust-analyzer" ], "settings": { "C_Cpp.intelliSenseEngine": "disabled", @@ -50,4 +51,4 @@ "gpu": "optional" }, "remoteUser": "devcontainer" -} \ No newline at end of file +} diff --git a/.devcontainer/amazonlinux/devcontainer.json b/.devcontainer/amazonlinux/devcontainer.json index 7d456894..2610a3e6 100644 --- a/.devcontainer/amazonlinux/devcontainer.json +++ b/.devcontainer/amazonlinux/devcontainer.json @@ -32,7 +32,8 @@ "matepek.vscode-catch2-test-adapter", "llvm-vs-code-extensions.vscode-clangd", "xaver.clang-format", - "bierner.markdown-mermaid" + "bierner.markdown-mermaid", + "rust-lang.rust-analyzer" ], "settings": { "C_Cpp.intelliSenseEngine": "disabled", @@ -51,4 +52,4 @@ "DISPLAY": "${localEnv:DISPLAY}" }, "remoteUser": "devcontainer" -} \ No newline at end of file +} diff --git a/.devcontainer/debiantrixie/devcontainer.json b/.devcontainer/debiantrixie/devcontainer.json index bb5b17b3..684157d1 100644 --- a/.devcontainer/debiantrixie/devcontainer.json +++ b/.devcontainer/debiantrixie/devcontainer.json @@ -28,7 +28,8 @@ "matepek.vscode-catch2-test-adapter", "llvm-vs-code-extensions.vscode-clangd", "xaver.clang-format", - "bierner.markdown-mermaid" + "bierner.markdown-mermaid", + "rust-lang.rust-analyzer" ], "settings": { "C_Cpp.intelliSenseEngine": "disabled", @@ -50,4 +51,4 @@ "gpu": "optional" }, "remoteUser": "devcontainer" -} \ No newline at end of file +} diff --git a/.devcontainer/ubuntu20/devcontainer.json b/.devcontainer/ubuntu20/devcontainer.json index b3321a83..e7783184 100644 --- a/.devcontainer/ubuntu20/devcontainer.json +++ b/.devcontainer/ubuntu20/devcontainer.json @@ -30,7 +30,8 @@ "matepek.vscode-catch2-test-adapter", "llvm-vs-code-extensions.vscode-clangd", "xaver.clang-format", - "bierner.markdown-mermaid" + "bierner.markdown-mermaid", + "rust-lang.rust-analyzer" ], "settings": { "C_Cpp.intelliSenseEngine": "disabled", @@ -52,4 +53,4 @@ "gpu": "optional" }, "remoteUser": "devcontainer" -} \ No newline at end of file +} diff --git a/.devcontainer/ubuntu22/devcontainer.json b/.devcontainer/ubuntu22/devcontainer.json index 57c7dbd3..02c77d4d 100644 --- a/.devcontainer/ubuntu22/devcontainer.json +++ b/.devcontainer/ubuntu22/devcontainer.json @@ -30,7 +30,8 @@ "matepek.vscode-catch2-test-adapter", "llvm-vs-code-extensions.vscode-clangd", "xaver.clang-format", - "bierner.markdown-mermaid" + "bierner.markdown-mermaid", + "rust-lang.rust-analyzer" ], "settings": { "C_Cpp.intelliSenseEngine": "disabled", @@ -52,4 +53,4 @@ "gpu": "optional" }, "remoteUser": "devcontainer" -} \ No newline at end of file +} diff --git a/.devcontainer/ubuntu24/devcontainer.json b/.devcontainer/ubuntu24/devcontainer.json index 9777cf7f..52f08331 100644 --- a/.devcontainer/ubuntu24/devcontainer.json +++ b/.devcontainer/ubuntu24/devcontainer.json @@ -30,7 +30,8 @@ "matepek.vscode-catch2-test-adapter", "llvm-vs-code-extensions.vscode-clangd", "xaver.clang-format", - "bierner.markdown-mermaid" + "bierner.markdown-mermaid", + "rust-lang.rust-analyzer" ], "settings": { "C_Cpp.intelliSenseEngine": "disabled", @@ -52,4 +53,4 @@ "gpu": "optional" }, "remoteUser": "devcontainer" -} \ No newline at end of file +} diff --git a/.devcontainer/ubuntu25/devcontainer.json b/.devcontainer/ubuntu25/devcontainer.json index 1343790e..87ea80b5 100644 --- a/.devcontainer/ubuntu25/devcontainer.json +++ b/.devcontainer/ubuntu25/devcontainer.json @@ -30,7 +30,8 @@ "matepek.vscode-catch2-test-adapter", "llvm-vs-code-extensions.vscode-clangd", "xaver.clang-format", - "bierner.markdown-mermaid" + "bierner.markdown-mermaid", + "rust-lang.rust-analyzer" ], "settings": { "C_Cpp.intelliSenseEngine": "disabled", @@ -52,4 +53,4 @@ "gpu": "optional" }, "remoteUser": "devcontainer" -} \ No newline at end of file +} From 979c324499c539d9a233f926133a28d203324130 Mon Sep 17 00:00:00 2001 From: Pedro Ferreira Date: Tue, 12 Aug 2025 10:56:22 +0100 Subject: [PATCH 09/10] reuse: add licensing information to Rust files Signed-off-by: Pedro Ferreira --- .github/workflows/rust.yml | 3 +++ rust/.gitattributes | 3 +++ rust/.gitignore | 3 +++ rust/Cargo.lock.license | 2 ++ rust/Cargo.toml | 3 +++ rust/README.md | 5 +++++ rust/flake.nix | 3 +++ rust/mxl-sys/.gitignore | 3 +++ rust/mxl-sys/Cargo.toml | 3 +++ rust/mxl-sys/build.rs | 3 +++ rust/mxl-sys/src/lib.rs | 3 +++ rust/mxl-sys/tests/simple_test.rs | 3 +++ rust/mxl-sys/wrapper-with-version-h.h | 3 +++ rust/mxl-sys/wrapper-without-version-h.h | 3 +++ rust/mxl/Cargo.toml | 3 +++ rust/mxl/build.rs | 3 +++ rust/mxl/examples/common/mod.rs | 3 +++ rust/mxl/examples/flow-reader.rs | 3 +++ rust/mxl/examples/flow-writer.rs | 3 +++ rust/mxl/src/api.rs | 3 +++ rust/mxl/src/config.rs | 3 +++ rust/mxl/src/error.rs | 3 +++ rust/mxl/src/flow.rs | 3 +++ rust/mxl/src/flow/reader.rs | 3 +++ rust/mxl/src/flow/writer.rs | 3 +++ rust/mxl/src/grain.rs | 3 +++ rust/mxl/src/grain/data.rs | 3 +++ rust/mxl/src/grain/reader.rs | 3 +++ rust/mxl/src/grain/write_access.rs | 3 +++ rust/mxl/src/grain/writer.rs | 3 +++ rust/mxl/src/instance.rs | 3 +++ rust/mxl/src/lib.rs | 3 +++ rust/mxl/src/samples.rs | 3 +++ rust/mxl/src/samples/data.rs | 3 +++ rust/mxl/src/samples/reader.rs | 3 +++ rust/mxl/src/samples/write_access.rs | 3 +++ rust/mxl/src/samples/writer.rs | 3 +++ rust/mxl/src/tools.rs | 3 +++ rust/mxl/tests/basic_tests.rs | 3 +++ 39 files changed, 118 insertions(+) create mode 100644 rust/Cargo.lock.license diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index bbacba38..a2fa3889 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project. +# SPDX-License-Identifier: Apache-2.0 + name: Test the rust bindings on: diff --git a/rust/.gitattributes b/rust/.gitattributes index 383338e0..265e6dd7 100644 --- a/rust/.gitattributes +++ b/rust/.gitattributes @@ -1 +1,4 @@ +# SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +# SPDX-License-Identifier: Apache-2.0 + Cargo.lock -diff diff --git a/rust/.gitignore b/rust/.gitignore index 09c22a05..91712988 100644 --- a/rust/.gitignore +++ b/rust/.gitignore @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +# SPDX-License-Identifier: Apache-2.0 + .DS_Store .idea .vscode diff --git a/rust/Cargo.lock.license b/rust/Cargo.lock.license new file mode 100644 index 00000000..e8d14bb3 --- /dev/null +++ b/rust/Cargo.lock.license @@ -0,0 +1,2 @@ +# SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +# SPDX-License-Identifier: Apache-2.0 diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 65ca6f08..d986b3aa 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +# SPDX-License-Identifier: Apache-2.0 + [workspace] members = ["mxl", "mxl-sys"] diff --git a/rust/README.md b/rust/README.md index 8dcb8a22..d2e6bc81 100644 --- a/rust/README.md +++ b/rust/README.md @@ -1,3 +1,8 @@ + + # Rust bindings for DMF MXL ## Goals diff --git a/rust/flake.nix b/rust/flake.nix index a219b532..eab9efe9 100644 --- a/rust/flake.nix +++ b/rust/flake.nix @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project. +# SPDX-License-Identifier: Apache-2.0 + { description = "Flake for MXL dev"; diff --git a/rust/mxl-sys/.gitignore b/rust/mxl-sys/.gitignore index 8d6e3400..bbf8a55d 100644 --- a/rust/mxl-sys/.gitignore +++ b/rust/mxl-sys/.gitignore @@ -1 +1,4 @@ +# SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project. +# SPDX-License-Identifier: Apache-2.0 + mxl/version.h diff --git a/rust/mxl-sys/Cargo.toml b/rust/mxl-sys/Cargo.toml index 0e4fa65a..58e1dbf1 100644 --- a/rust/mxl-sys/Cargo.toml +++ b/rust/mxl-sys/Cargo.toml @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +# SPDX-License-Identifier: Apache-2.0 + [package] name = "mxl-sys" edition.workspace = true diff --git a/rust/mxl-sys/build.rs b/rust/mxl-sys/build.rs index 2eaf1d9f..4154ed03 100644 --- a/rust/mxl-sys/build.rs +++ b/rust/mxl-sys/build.rs @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +// SPDX-License-Identifier: Apache-2.0 + use std::env; use std::path::PathBuf; diff --git a/rust/mxl-sys/src/lib.rs b/rust/mxl-sys/src/lib.rs index 2e4dc43d..d82df112 100644 --- a/rust/mxl-sys/src/lib.rs +++ b/rust/mxl-sys/src/lib.rs @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +// SPDX-License-Identifier: Apache-2.0 + #![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] diff --git a/rust/mxl-sys/tests/simple_test.rs b/rust/mxl-sys/tests/simple_test.rs index c617fe56..d0357dc4 100644 --- a/rust/mxl-sys/tests/simple_test.rs +++ b/rust/mxl-sys/tests/simple_test.rs @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +// SPDX-License-Identifier: Apache-2.0 + #[test] fn there_is_bindgen_generated_code() { let mxl_version = mxl_sys::mxlVersionType { diff --git a/rust/mxl-sys/wrapper-with-version-h.h b/rust/mxl-sys/wrapper-with-version-h.h index 80c5254f..44b4bd77 100644 --- a/rust/mxl-sys/wrapper-with-version-h.h +++ b/rust/mxl-sys/wrapper-with-version-h.h @@ -1,2 +1,5 @@ +// SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project. +// SPDX-License-Identifier: Apache-2.0 + #include "wrapper-without-version-h.h" #include "mxl/version.h" diff --git a/rust/mxl-sys/wrapper-without-version-h.h b/rust/mxl-sys/wrapper-without-version-h.h index 5248f1e1..e6fb4216 100644 --- a/rust/mxl-sys/wrapper-without-version-h.h +++ b/rust/mxl-sys/wrapper-without-version-h.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project. +// SPDX-License-Identifier: Apache-2.0 + #include "mxl/dataformat.h" #include "mxl/flow.h" #include "mxl/flowinfo.h" diff --git a/rust/mxl/Cargo.toml b/rust/mxl/Cargo.toml index 447c4998..325c59ec 100644 --- a/rust/mxl/Cargo.toml +++ b/rust/mxl/Cargo.toml @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +# SPDX-License-Identifier: Apache-2.0 + [package] name = "mxl" edition.workspace = true diff --git a/rust/mxl/build.rs b/rust/mxl/build.rs index 382d75e1..4451cc68 100644 --- a/rust/mxl/build.rs +++ b/rust/mxl/build.rs @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +// SPDX-License-Identifier: Apache-2.0 + use std::env; use std::path::PathBuf; diff --git a/rust/mxl/examples/common/mod.rs b/rust/mxl/examples/common/mod.rs index 221a4629..e37eb881 100644 --- a/rust/mxl/examples/common/mod.rs +++ b/rust/mxl/examples/common/mod.rs @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +// SPDX-License-Identifier: Apache-2.0 + pub fn setup_logging() { tracing_subscriber::fmt() .with_env_filter( diff --git a/rust/mxl/examples/flow-reader.rs b/rust/mxl/examples/flow-reader.rs index 5fce9794..60987c87 100644 --- a/rust/mxl/examples/flow-reader.rs +++ b/rust/mxl/examples/flow-reader.rs @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +// SPDX-License-Identifier: Apache-2.0 + mod common; use std::time::Duration; diff --git a/rust/mxl/examples/flow-writer.rs b/rust/mxl/examples/flow-writer.rs index b91bfc3a..67ca8b09 100644 --- a/rust/mxl/examples/flow-writer.rs +++ b/rust/mxl/examples/flow-writer.rs @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +// SPDX-License-Identifier: Apache-2.0 + mod common; use clap::Parser; diff --git a/rust/mxl/src/api.rs b/rust/mxl/src/api.rs index 5cf81e9f..2c9ab3f9 100644 --- a/rust/mxl/src/api.rs +++ b/rust/mxl/src/api.rs @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +// SPDX-License-Identifier: Apache-2.0 + use std::path::Path; use dlopen2::wrapper::{Container, WrapperApi}; diff --git a/rust/mxl/src/config.rs b/rust/mxl/src/config.rs index d4001870..69295d47 100644 --- a/rust/mxl/src/config.rs +++ b/rust/mxl/src/config.rs @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +// SPDX-License-Identifier: Apache-2.0 + use std::str::FromStr; include!(concat!(env!("OUT_DIR"), "/constants.rs")); diff --git a/rust/mxl/src/error.rs b/rust/mxl/src/error.rs index a56a4aad..d5372feb 100644 --- a/rust/mxl/src/error.rs +++ b/rust/mxl/src/error.rs @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +// SPDX-License-Identifier: Apache-2.0 + pub type Result = core::result::Result; #[derive(Debug, thiserror::Error)] diff --git a/rust/mxl/src/flow.rs b/rust/mxl/src/flow.rs index d82e0eca..d0b3f753 100644 --- a/rust/mxl/src/flow.rs +++ b/rust/mxl/src/flow.rs @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +// SPDX-License-Identifier: Apache-2.0 + pub mod reader; pub mod writer; diff --git a/rust/mxl/src/flow/reader.rs b/rust/mxl/src/flow/reader.rs index a5bfd678..82aa123a 100644 --- a/rust/mxl/src/flow/reader.rs +++ b/rust/mxl/src/flow/reader.rs @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +// SPDX-License-Identifier: Apache-2.0 + use std::sync::Arc; use crate::{ diff --git a/rust/mxl/src/flow/writer.rs b/rust/mxl/src/flow/writer.rs index 250578db..b1234073 100644 --- a/rust/mxl/src/flow/writer.rs +++ b/rust/mxl/src/flow/writer.rs @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +// SPDX-License-Identifier: Apache-2.0 + use std::sync::Arc; use crate::{ diff --git a/rust/mxl/src/grain.rs b/rust/mxl/src/grain.rs index 9bfae8f0..2205933c 100644 --- a/rust/mxl/src/grain.rs +++ b/rust/mxl/src/grain.rs @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +// SPDX-License-Identifier: Apache-2.0 + pub mod data; pub mod reader; pub mod write_access; diff --git a/rust/mxl/src/grain/data.rs b/rust/mxl/src/grain/data.rs index fabdd135..d8cd9879 100644 --- a/rust/mxl/src/grain/data.rs +++ b/rust/mxl/src/grain/data.rs @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +// SPDX-License-Identifier: Apache-2.0 + pub struct GrainData<'a> { pub user_data: &'a [u8], pub payload: &'a [u8], diff --git a/rust/mxl/src/grain/reader.rs b/rust/mxl/src/grain/reader.rs index 227e3e8a..8ecdec7f 100644 --- a/rust/mxl/src/grain/reader.rs +++ b/rust/mxl/src/grain/reader.rs @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +// SPDX-License-Identifier: Apache-2.0 + use std::{sync::Arc, time::Duration}; use crate::{ diff --git a/rust/mxl/src/grain/write_access.rs b/rust/mxl/src/grain/write_access.rs index 04447aef..69657eb9 100644 --- a/rust/mxl/src/grain/write_access.rs +++ b/rust/mxl/src/grain/write_access.rs @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +// SPDX-License-Identifier: Apache-2.0 + use std::{marker::PhantomData, sync::Arc}; use tracing::error; diff --git a/rust/mxl/src/grain/writer.rs b/rust/mxl/src/grain/writer.rs index a2399e0b..2c06b708 100644 --- a/rust/mxl/src/grain/writer.rs +++ b/rust/mxl/src/grain/writer.rs @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +// SPDX-License-Identifier: Apache-2.0 + use std::sync::Arc; use super::write_access::GrainWriteAccess; diff --git a/rust/mxl/src/instance.rs b/rust/mxl/src/instance.rs index 95861b5e..8e703cd1 100644 --- a/rust/mxl/src/instance.rs +++ b/rust/mxl/src/instance.rs @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +// SPDX-License-Identifier: Apache-2.0 + use std::{ffi::CString, sync::Arc}; use dlopen2::wrapper::Container; diff --git a/rust/mxl/src/lib.rs b/rust/mxl/src/lib.rs index b2ce1e5e..723739d7 100644 --- a/rust/mxl/src/lib.rs +++ b/rust/mxl/src/lib.rs @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +// SPDX-License-Identifier: Apache-2.0 + mod api; mod error; mod flow; diff --git a/rust/mxl/src/samples.rs b/rust/mxl/src/samples.rs index 9bfae8f0..2205933c 100644 --- a/rust/mxl/src/samples.rs +++ b/rust/mxl/src/samples.rs @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +// SPDX-License-Identifier: Apache-2.0 + pub mod data; pub mod reader; pub mod write_access; diff --git a/rust/mxl/src/samples/data.rs b/rust/mxl/src/samples/data.rs index 4c079690..ef7797d9 100644 --- a/rust/mxl/src/samples/data.rs +++ b/rust/mxl/src/samples/data.rs @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +// SPDX-License-Identifier: Apache-2.0 + use std::marker::PhantomData; use crate::Error; diff --git a/rust/mxl/src/samples/reader.rs b/rust/mxl/src/samples/reader.rs index e6f75dcd..5612f319 100644 --- a/rust/mxl/src/samples/reader.rs +++ b/rust/mxl/src/samples/reader.rs @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +// SPDX-License-Identifier: Apache-2.0 + use std::sync::Arc; use crate::{ diff --git a/rust/mxl/src/samples/write_access.rs b/rust/mxl/src/samples/write_access.rs index bbb57ce1..08fe9632 100644 --- a/rust/mxl/src/samples/write_access.rs +++ b/rust/mxl/src/samples/write_access.rs @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +// SPDX-License-Identifier: Apache-2.0 + use std::{marker::PhantomData, sync::Arc}; use tracing::error; diff --git a/rust/mxl/src/samples/writer.rs b/rust/mxl/src/samples/writer.rs index 4c0193f5..f1e9ac37 100644 --- a/rust/mxl/src/samples/writer.rs +++ b/rust/mxl/src/samples/writer.rs @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +// SPDX-License-Identifier: Apache-2.0 + use std::sync::Arc; use crate::{Error, Result, SamplesWriteAccess, instance::InstanceContext}; diff --git a/rust/mxl/src/tools.rs b/rust/mxl/src/tools.rs index 312af218..156e6593 100644 --- a/rust/mxl/src/tools.rs +++ b/rust/mxl/src/tools.rs @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +// SPDX-License-Identifier: Apache-2.0 + pub fn read_file(file_path: impl AsRef) -> Result { use std::io::Read; diff --git a/rust/mxl/tests/basic_tests.rs b/rust/mxl/tests/basic_tests.rs index fb5295bf..544f8c0d 100644 --- a/rust/mxl/tests/basic_tests.rs +++ b/rust/mxl/tests/basic_tests.rs @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2025 2025 Contributors to the Media eXchange Layer project. +// SPDX-License-Identifier: Apache-2.0 + /// Tests of the basic low level synchronous API. /// /// The tests now require an MXL library of a specific name to be present in the system. This should From 21224d096d6aecc2ab4974734d2d194f6104f2af Mon Sep 17 00:00:00 2001 From: Pedro Ferreira Date: Tue, 12 Aug 2025 16:57:38 +0100 Subject: [PATCH 10/10] rust test: add a nextest config file Signed-off-by: Pedro Ferreira --- rust/.config/nextest.toml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 rust/.config/nextest.toml diff --git a/rust/.config/nextest.toml b/rust/.config/nextest.toml new file mode 100644 index 00000000..6a109e17 --- /dev/null +++ b/rust/.config/nextest.toml @@ -0,0 +1,5 @@ +[profile.ci] +fail-fast = false + +[profile.ci.junit] +path = "junit.xml"