diff --git a/.cargo/config.toml b/.cargo/config.toml index be89a788..55fcae09 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,3 +1,16 @@ [env] # We generally want to bypass updates in the build, they should only really be run in CI as they touch many parts of the host PLOTINATOR_BYPASS_UPDATES = "true" + +# Avoid linking with vcruntime140.dll by statically linking everything, +# and then explicitly linking with ucrtbase.dll dynamically. +# We do this, because vcruntime140.dll is an optional Windows component. +# NOTE: Endorsed by Microsoft devs: https://github.com/microsoft/edit/blob/d74c330f2b74134a7fd5f97f78933472049129d3/.cargo/release.toml +[target.'cfg(target_os = "windows")'] +rustflags = [ + "-Ctarget-feature=+crt-static", + "-Clink-args=/DEFAULTLIB:ucrt.lib", + "-Clink-args=/NODEFAULTLIB:vcruntime.lib", + "-Clink-args=/NODEFAULTLIB:msvcrt.lib", + "-Clink-args=/NODEFAULTLIB:libucrt.lib", +] \ No newline at end of file diff --git a/.github/custom_build_setup/build-setup.yml b/.github/custom_build_setup/build-setup.yml index 4d78bf0a..98483fb9 100644 --- a/.github/custom_build_setup/build-setup.yml +++ b/.github/custom_build_setup/build-setup.yml @@ -1,12 +1,7 @@ -- name: Install Just - uses: extractions/setup-just@v3 -- name: Install HDF5 - shell: bash - run: just init::install-hdf5-headers - -- name: Run MSI installer (windows) +# A workaround for +# https://github.com/axodotdev/cargo-dist/issues/1571 +# See the .cargo/config.toml for more information about these flags. +- name: Update RUSTFLAGS with custom windows linker flags if: runner.os == 'Windows' - shell: pwsh - run: | - cd just\hdf - msiexec /i HDF5-1.14.0-win64.msi /quiet /qn /norestart + shell: bash + run: echo RUSTFLAGS="$RUSTFLAGS -Clink-args=/DEFAULTLIB:ucrt.lib -Clink-args=/NODEFAULTLIB:vcruntime.lib -Clink-args=/NODEFAULTLIB:msvcrt.lib -Clink-args=/NODEFAULTLIB:libucrt.lib" >> "$GITHUB_ENV" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ff526c8c..dedfc81f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -78,7 +78,7 @@ jobs: # but also really annoying to build CI around when it needs secrets to work right.) - id: plan run: | - dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json --allow-dirty > plan-dist-manifest.json + dist ${{ (!github.event.pull_request && format('host --steps=create --tag={0}', github.ref_name)) || 'plan' }} --output-format=json > plan-dist-manifest.json echo "dist ran successfully" cat plan-dist-manifest.json echo "manifest=$(jq -c "." plan-dist-manifest.json)" >> "$GITHUB_OUTPUT" @@ -128,28 +128,16 @@ jobs: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y echo "$HOME/.cargo/bin" >> $GITHUB_PATH fi - - name: "Install Just" - uses: "extractions/setup-just@v3" - - name: "Install HDF5" - run: "just init::install-hdf5-headers" - shell: "bash" - - name: "Run MSI installer (windows)" + - name: "Update RUSTFLAGS with custom windows linker flags" if: "runner.os == 'Windows'" - run: | - cd just\hdf - msiexec /i HDF5-1.14.0-win64.msi /quiet /qn /norestart - shell: "pwsh" + run: "echo RUSTFLAGS=\"$RUSTFLAGS -Clink-args=/DEFAULTLIB:ucrt.lib -Clink-args=/NODEFAULTLIB:vcruntime.lib -Clink-args=/NODEFAULTLIB:msvcrt.lib -Clink-args=/NODEFAULTLIB:libucrt.lib\" >> \"$GITHUB_ENV\"" + shell: "bash" - uses: swatinem/rust-cache@v2 with: key: ${{ join(matrix.targets, '-') }} cache-provider: ${{ matrix.cache_provider }} - name: Install dist run: ${{ matrix.install_dist.run }} - - # Need to overwrite it to fix: https://github.com/astral-sh/cargo-dist/pull/36 - - name: Use patched cargo-dist version (windows) - if: runner.os == 'Windows' - run: cargo install cargo-dist --git https://github.com/CramBL/cargo-dist --branch fix-ignored-msvc-crt-static-flag --rev a4cabb10395c7b275ea40d1636cd2d0e58be8af6 --force # Get the dist-manifest - name: Fetch local artifacts uses: actions/download-artifact@v4 @@ -163,7 +151,7 @@ jobs: - name: Build artifacts run: | # Actually do builds and make zips and whatnot - dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --allow-dirty --output-format=json ${{ matrix.dist_args }} > dist-manifest.json + dist build ${{ needs.plan.outputs.tag-flag }} --print=linkage --output-format=json ${{ matrix.dist_args }} > dist-manifest.json echo "dist ran successfully" - id: cargo-dist name: Post-build @@ -216,7 +204,7 @@ jobs: - id: cargo-dist shell: bash run: | - dist build ${{ needs.plan.outputs.tag-flag }} --allow-dirty --output-format=json "--artifacts=global" > dist-manifest.json + dist build ${{ needs.plan.outputs.tag-flag }} --output-format=json "--artifacts=global" > dist-manifest.json echo "dist ran successfully" # Parse out what we just built and upload it to scratch storage @@ -266,7 +254,7 @@ jobs: - id: host shell: bash run: | - dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --allow-dirty --output-format=json > dist-manifest.json + dist host ${{ needs.plan.outputs.tag-flag }} --steps=upload --steps=release --output-format=json > dist-manifest.json echo "artifacts uploaded and released successfully" cat dist-manifest.json echo "manifest=$(jq -c "." dist-manifest.json)" >> "$GITHUB_OUTPUT" diff --git a/.gitignore b/.gitignore index af76eba6..c1140602 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ target dist **/tests/snapshots/**/*.diff.png **/tests/snapshots/**/*.new.png +**/tests/snapshots/**/*.old.png .firebase diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a3b4a37..7663774e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,11 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [unreleased] +## [1.13.0] + ### Added - Discover broker `$SYS`-topics - Show reachable broker's version if available - Better UX for the MQTT connection window +- Add additional distribution targets: `ARM64 Linux` & `x64 MUSL Linux`. ### Changed diff --git a/Cargo.lock b/Cargo.lock index 1922f9a8..321f608a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2684,7 +2684,7 @@ checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] name = "log_if" -version = "1.12.0" +version = "1.13.0" dependencies = [ "chrono", "log", @@ -3485,7 +3485,7 @@ checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "plot_util" -version = "1.12.0" +version = "1.13.0" dependencies = [ "chrono", "egui", @@ -3502,7 +3502,7 @@ dependencies = [ [[package]] name = "plotinator3000" -version = "1.12.0" +version = "1.13.0" dependencies = [ "axoupdater", "chrono", @@ -3528,7 +3528,7 @@ dependencies = [ "rfd", "semver", "serde", - "skytem_hdf", + "skytem_hdf5", "skytem_logs", "strum 0.27.1", "strum_macros 0.27.1", @@ -3543,11 +3543,11 @@ dependencies = [ [[package]] name = "plotinator_macros" -version = "1.12.0" +version = "1.13.0" [[package]] name = "plotinator_mqtt" -version = "1.12.0" +version = "1.13.0" dependencies = [ "anyhow", "egui_plot", @@ -4446,8 +4446,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" [[package]] -name = "skytem_hdf" -version = "1.12.0" +name = "skytem_hdf5" +version = "1.13.0" dependencies = [ "byteorder", "chrono", @@ -4470,7 +4470,7 @@ dependencies = [ [[package]] name = "skytem_logs" -version = "1.12.0" +version = "1.13.0" dependencies = [ "byteorder", "chrono", @@ -4720,7 +4720,7 @@ dependencies = [ [[package]] name = "test_util" -version = "1.12.0" +version = "1.13.0" dependencies = [ "paste", "testresult", diff --git a/Cargo.toml b/Cargo.toml index fbe11d37..010bd52e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,7 +21,7 @@ members = ["crates/*"] [workspace.package] authors = ["SkyTEM Surveys", "Marc Beck König"] -version = "1.12.0" +version = "1.13.0" edition = "2024" rust-version = "1.85.0" license = "MIT OR Apache-2.0" @@ -33,7 +33,7 @@ test_util.path = "crates/test_util" skytem_logs.path = "crates/skytem_logs" log_if.path = "crates/log_if" plot_util.path = "crates/plot_util" -skytem_hdf.path = "crates/skytem_hdf" +skytem_hdf5.path = "crates/skytem_hdf5" plotinator_mqtt.path = "crates/plotinator_mqtt" plotinator_macros.path = "crates/plotinator_macros" egui = { version = "0.31", features = ["rayon", "callstack"] } @@ -71,7 +71,7 @@ reqwest = "0.12.15" skytem_logs.workspace = true log_if.workspace = true plot_util.workspace = true -skytem_hdf = { workspace = true, optional = true } +skytem_hdf5.workspace = true test_util.workspace = true plotinator_macros.workspace = true egui_plot.workspace = true @@ -108,12 +108,14 @@ egui_kittest = { version = "0.31.1", features = ["eframe", "snapshot", "wgpu", " env_logger = "0.11" zip = "3.0.0" axoupdater = { version = "0.9.0", features = ["blocking"], optional = true} -mimalloc = "0.1.46" plotinator_mqtt = { workspace = true, optional = true} profiling = { workspace = true, optional = true} puffin = { workspace = true, optional = true} puffin_http = { workspace = true, optional = true} +# native (except aarch64-linux): +[target.'cfg(all(not(target_arch = "wasm32"), not(all(target_arch = "aarch64", target_os = "linux"))))'.dependencies] +mimalloc = "0.1.46" # web: [target.'cfg(target_arch = "wasm32")'.dependencies] @@ -125,8 +127,8 @@ web-sys = "0.3.70" elevated-command.workspace = true [features] -default = ["selfupdater", "mqtt"] -hdf = ["dep:skytem_hdf"] +default = ["selfupdater", "mqtt", "hdf5"] +hdf5 = [] selfupdater = ["dep:axoupdater"] mqtt = ["dep:plotinator_mqtt"] profiling = ["dep:profiling", "dep:puffin", "dep:puffin_http"] diff --git a/Justfile b/Justfile index b6314b69..c1fa616a 100644 --- a/Justfile +++ b/Justfile @@ -51,7 +51,7 @@ serve *ARGS: run *ARGS: cargo {{run}} {{ARGS}} -# Run tests +# Run all tests [group("Check"), no-exit-message] test *ARGS="--workspace": cargo {{test}} {{ARGS}} diff --git a/README.md b/README.md index 0bc503e2..54e12deb 100644 --- a/README.md +++ b/README.md @@ -68,21 +68,22 @@ All the boilerplate and workflows etc. is pulled from [this eframe template](htt [cargo-dist](https://github.com/axodotdev/cargo-dist) handles the complexities of setting up build/releases for various platforms. -Read their documentation!! +> [!IMPORTANT] +> [uv](https://github.com/astral-sh/uv) also uses `cargo-dist` and since the original project ran out of funding, the [uv fork](https://github.com/astral-sh/cargo-dist) is used instead Generating the first instance of CI for the release workflow is done via ```shell -cargo dist init +dist init ``` ... And then following the instructions/prompts. -A (very complicated) [release.yml](.github/workflows/release.yml) is generated and metadata is added to [Cargo.toml](Cargo.toml), if distributing for windows, a [main.wxs](wix/main.wxs) is also generated. To update these with changes to the project, simply rerun `cargo dist init`, don't edit the workflow manually, there's a [section on CI customization](https://opensource.axo.dev/cargo-dist/book/ci/customizing.html) in the `cargo dist` docs. +A (very complicated) [release.yml](.github/workflows/release.yml) is generated and metadata is added to [dist-workspace.toml](dist-workspace.toml), if distributing for windows, a [main.wxs](wix/main.wxs) is also generated. To update these with changes to the project, simply rerun `dist init`, don't edit the workflow manually, there's section on CI customizations in their docs, but as of this writing the site is down, Astral (uv authors) will probably host the docs again at some point. When developing/trouble shooting the release pipeline adding `pr-run-mode = "upload"` like this ```toml -[workspace.metadata.dist] +[dist] pr-run-mode = "upload" ``` diff --git a/crates/skytem_hdf/Cargo.toml b/crates/skytem_hdf5/Cargo.toml similarity index 97% rename from crates/skytem_hdf/Cargo.toml rename to crates/skytem_hdf5/Cargo.toml index b812ca18..ef508345 100644 --- a/crates/skytem_hdf/Cargo.toml +++ b/crates/skytem_hdf5/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "skytem_hdf" +name = "skytem_hdf5" authors.workspace = true version.workspace = true edition.workspace = true diff --git a/crates/skytem_hdf/src/bifrost.rs b/crates/skytem_hdf5/src/bifrost.rs similarity index 100% rename from crates/skytem_hdf/src/bifrost.rs rename to crates/skytem_hdf5/src/bifrost.rs diff --git a/crates/skytem_hdf/src/bifrost/stream_descriptor.rs b/crates/skytem_hdf5/src/bifrost/stream_descriptor.rs similarity index 100% rename from crates/skytem_hdf/src/bifrost/stream_descriptor.rs rename to crates/skytem_hdf5/src/bifrost/stream_descriptor.rs diff --git a/crates/skytem_hdf/src/lib.rs b/crates/skytem_hdf5/src/lib.rs similarity index 53% rename from crates/skytem_hdf/src/lib.rs rename to crates/skytem_hdf5/src/lib.rs index f7a5a96d..c8d25908 100644 --- a/crates/skytem_hdf/src/lib.rs +++ b/crates/skytem_hdf5/src/lib.rs @@ -4,15 +4,15 @@ pub(crate) mod util; #[cfg(not(target_arch = "wasm32"))] pub mod bifrost; -// File extensions we recognize as hdf files. -const POSSIBLE_HDF_EXTENSIONS_CASE_INSENSITIVE: [&str; 3] = ["h5", "hdf", "hdf5"]; +// File extensions we recognize as hdf5 files. +const POSSIBLE_HDF5_EXTENSIONS_CASE_INSENSITIVE: [&str; 3] = ["h5", "hdf5", "hdf"]; -pub fn path_has_hdf_extension(path: &std::path::Path) -> bool { +pub fn path_has_hdf5_extension(path: &std::path::Path) -> bool { let Some(extension) = path.extension() else { return false; }; - for possible_extension in POSSIBLE_HDF_EXTENSIONS_CASE_INSENSITIVE { + for possible_extension in POSSIBLE_HDF5_EXTENSIONS_CASE_INSENSITIVE { if extension.eq_ignore_ascii_case(possible_extension) { return true; } diff --git a/crates/skytem_hdf/src/util.rs b/crates/skytem_hdf5/src/util.rs similarity index 100% rename from crates/skytem_hdf/src/util.rs rename to crates/skytem_hdf5/src/util.rs diff --git a/dist-workspace.toml b/dist-workspace.toml index b443989b..96a2fc7b 100644 --- a/dist-workspace.toml +++ b/dist-workspace.toml @@ -10,13 +10,11 @@ ci = "github" # The installers to generate for each app installers = ["shell", "powershell", "msi"] # Target platforms to build apps for (Rust target-triple syntax) -targets = ["aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-pc-windows-msvc"] +targets = ["aarch64-apple-darwin", "aarch64-unknown-linux-gnu", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl", "x86_64-pc-windows-msvc"] # Path that installers should place binaries in install-path = "CARGO_HOME" # Whether to install an updater program install-updater = false # Which actions to run on pull requests pr-run-mode = "upload" -# Whether +crt-static should be used on msvc -msvc-crt-static = false github-build-setup = "../custom_build_setup/build-setup.yml" diff --git a/just/init.just b/just/init.just index c93d6872..3fb653e3 100644 --- a/just/init.just +++ b/just/init.just @@ -3,14 +3,14 @@ set windows-shell := ["powershell.exe", "-c"] [group("Init")] init: install-devtools @echo "Run {{BOLD + YELLOW}}install-extra-devtools{{NORMAL}} for some adittional productivity tools that fit into the existent workflow" - @echo "Run {{BOLD + YELLOW}}apt-install-hdf5-headers{{NORMAL}} to get HDF5 headers for developing HDF5 features on linux" # Trunk is used to serve the app with a webserver, cargo-dist is used to generate and update workflows for distributing installers for various platforms [group("Init"), doc("Install the required tools for performing all dev tasks for the project")] install-devtools: cargo install trunk --locked - cargo install cargo-dist --locked + # Use the uv fork that is still maintained + cargo install cargo-dist --locked --git https://github.com/astral-sh/cargo-dist.git --tag v0.28.5 cargo install typos-cli --locked cargo install cargo-audit --locked @@ -20,39 +20,3 @@ install-extra-devtools: cargo install cargo-nextest --locked cargo install cargo-limit --locked cargo install bacon --locked - -[group("Init")] -apt-install-hdf5-headers: - sudo apt install libhdf5-dev - -[windows] -msi-install-hdf5-headers: - #!/usr/bin/env bash - set -eo pipefail - VERSION="1.14.0" - DL_URL="https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.14/hdf5-${VERSION}/bin/windows/hdf5-${VERSION}-Std-win10_64-vs16.zip" - # Download and extract HDF5 - curl -L -o hdf5.zip "${DL_URL}" - unzip hdf5.zip - if [[ "${GITHUB_ACTIONS}" == "true" ]]; then - just init::set-github-hdf5-env-vars "${VERSION}" - fi - - -[windows] -set-github-hdf5-env-vars VERSION: - echo "HDF5_DIR=C:\\Program Files\\HDF_Group\\HDF5\\{{VERSION}}" >> $GITHUB_ENV - echo "C:\\Program Files\\HDF_Group\\HDF5\\{{VERSION}}\\bin" >> $GITHUB_PATH - -[macos] -brew-install-hdf5-headers: - brew install hdf5 - -[linux] -install-hdf5-headers: apt-install-hdf5-headers - -[macos] -install-hdf5-headers: brew-install-hdf5-headers - -[windows] -install-hdf5-headers: msi-install-hdf5-headers \ No newline at end of file diff --git a/just/mod.just b/just/mod.just index af88a6ee..e496235d 100644 --- a/just/mod.just +++ b/just/mod.just @@ -1,2 +1,3 @@ import 'default_cmd.just' import 'mqtt.just' +import 'snapshots.just' diff --git a/just/snapshots.just b/just/snapshots.just new file mode 100644 index 00000000..4b6c4bc8 --- /dev/null +++ b/just/snapshots.just @@ -0,0 +1,14 @@ +# Run snapshot tests +[group("Snapshot Tests"), no-exit-message] +test-snapshots *ARGS="": + cargo {{test}} test_snapshot {{ARGS}} + +# Run snapshot tests and update the snapshots +[group("Snapshot Tests"), no-exit-message] +test-snapshots-update $UPDATE_SNAPSHOTS="1": + cargo {{test}} test_snapshot + +# Delete all the snapshot images +[group("Snapshot Tests"), no-exit-message] +clean-snapshots: + rm -f tests/snapshots/* diff --git a/src/app/supported_formats.rs b/src/app/supported_formats.rs index ac57958a..bd629244 100644 --- a/src/app/supported_formats.rs +++ b/src/app/supported_formats.rs @@ -15,11 +15,10 @@ use std::{ path::Path, }; -#[cfg(feature = "hdf")] +#[cfg(feature = "hdf5")] #[cfg(not(target_arch = "wasm32"))] mod hdf; pub(crate) mod logs; -mod util; /// Represents a supported format, which can be any of the supported format types. /// @@ -31,7 +30,7 @@ mod util; )] pub enum SupportedFormat { Log(SupportedLog), - #[cfg(feature = "hdf")] + #[cfg(feature = "hdf5")] #[cfg(not(target_arch = "wasm32"))] #[allow(clippy::upper_case_acronyms, reason = "The format is called HDF...")] HDF(hdf::SupportedHdfFormat), @@ -112,8 +111,8 @@ impl SupportedFormat { log::debug!("Parsing content of length: {total_bytes}"); let mut reader = BufReader::new(file); - let log: Self = if util::path_has_hdf_extension(path) { - Self::parse_hdf_from_path(path)? + let log: Self = if skytem_hdf5::path_has_hdf5_extension(path) { + Self::parse_hdf5_from_path(path)? } else if PidLog::file_is_valid(path) { let (log, parsed_bytes) = PidLog::from_reader(&mut reader)?; log::debug!("Read: {parsed_bytes} bytes"); @@ -153,39 +152,39 @@ impl SupportedFormat { Ok(log) } - #[cfg(feature = "hdf")] + #[cfg(feature = "hdf5")] #[cfg(not(target_arch = "wasm32"))] - fn parse_hdf_from_path(path: &Path) -> io::Result { - use skytem_hdf::bifrost::BifrostLoopCurrent; - // Attempt to parse it has an hdf file + fn parse_hdf5_from_path(path: &Path) -> io::Result { + use skytem_hdf5::bifrost::BifrostLoopCurrent; + // Attempt to parse it has an hdf5 file if let Ok(bifrost_loop_current) = BifrostLoopCurrent::from_path(path) { Ok(Self::HDF(bifrost_loop_current.into())) } else { Err(io::Error::new( io::ErrorKind::InvalidInput, - "Unrecognized HDF file", + "Unrecognized HDF5 file", )) } } - #[cfg(not(feature = "hdf"))] + #[cfg(not(feature = "hdf5"))] #[cfg(not(target_arch = "wasm32"))] - fn parse_hdf_from_path(path: &Path) -> io::Result { + fn parse_hdf5_from_path(path: &Path) -> io::Result { Err(io::Error::new( io::ErrorKind::InvalidInput, format!( - "Recognized '{}' as an HDF file. But the HDF feature is turned off.", + "Recognized '{}' as an HDF5 file. But the HDF5 feature is turned off.", path.display() ), )) } #[cfg(target_arch = "wasm32")] - fn parse_hdf_from_path(path: &Path) -> io::Result { + fn parse_hdf5_from_path(path: &Path) -> io::Result { Err(io::Error::new( io::ErrorKind::InvalidInput, format!( - "Recognized '{}' as an HDF file. HDF files are only supported on the native version", + "Recognized '{}' as an HDF5 file. HDF5 files are only supported on the native version", path.display() ), )) @@ -194,12 +193,12 @@ impl SupportedFormat { /// Returns [`None`] if there's no meaningful parsing information such as with HDF5 files. #[allow( clippy::unnecessary_wraps, - reason = "HDF files are not supported on web (yet?) and the lint is triggered when compiling for web since then only logs are supported which always have parse info" + reason = "HDF5 files are not supported on web (yet?) and the lint is triggered when compiling for web since then only logs are supported which always have parse info" )] pub fn parse_info(&self) -> Option { match self { Self::Log(l) => Some(l.parse_info()), - #[cfg(feature = "hdf")] + #[cfg(feature = "hdf5")] #[cfg(not(target_arch = "wasm32"))] Self::HDF(_) => None, } @@ -211,7 +210,7 @@ impl Plotable for SupportedFormat { match self { Self::Log(l) => l.raw_plots(), - #[cfg(feature = "hdf")] + #[cfg(feature = "hdf5")] #[cfg(not(target_arch = "wasm32"))] Self::HDF(hdf) => hdf.raw_plots(), } @@ -220,7 +219,7 @@ impl Plotable for SupportedFormat { fn first_timestamp(&self) -> chrono::DateTime { match self { Self::Log(l) => l.first_timestamp(), - #[cfg(feature = "hdf")] + #[cfg(feature = "hdf5")] #[cfg(not(target_arch = "wasm32"))] Self::HDF(hdf) => hdf.first_timestamp(), } @@ -229,7 +228,7 @@ impl Plotable for SupportedFormat { fn descriptive_name(&self) -> &str { match self { Self::Log(l) => l.descriptive_name(), - #[cfg(feature = "hdf")] + #[cfg(feature = "hdf5")] #[cfg(not(target_arch = "wasm32"))] Self::HDF(hdf) => hdf.descriptive_name(), } @@ -238,7 +237,7 @@ impl Plotable for SupportedFormat { fn labels(&self) -> Option<&[PlotLabels]> { match self { Self::Log(l) => l.labels(), - #[cfg(feature = "hdf")] + #[cfg(feature = "hdf5")] #[cfg(not(target_arch = "wasm32"))] Self::HDF(hdf) => hdf.labels(), } @@ -247,7 +246,7 @@ impl Plotable for SupportedFormat { fn metadata(&self) -> Option> { match self { Self::Log(l) => l.metadata(), - #[cfg(feature = "hdf")] + #[cfg(feature = "hdf5")] #[cfg(not(target_arch = "wasm32"))] Self::HDF(hdf) => hdf.metadata(), } diff --git a/src/app/supported_formats/hdf.rs b/src/app/supported_formats/hdf.rs index 6d103b7a..08b1db54 100644 --- a/src/app/supported_formats/hdf.rs +++ b/src/app/supported_formats/hdf.rs @@ -1,11 +1,11 @@ use chrono::{DateTime, Utc}; use log_if::prelude::*; use serde::{Deserialize, Serialize}; -use skytem_hdf::bifrost::BifrostLoopCurrent; +use skytem_hdf5::bifrost::BifrostLoopCurrent; -/// Represents a supported HDF format, which can be any of the supported HDF format types. +/// Represents a supported HDF5 format, which can be any of the supported HDF5 format types. /// -/// This simply serves to encapsulate all the supported HDF formats in a single type +/// This simply serves to encapsulate all the supported HDF5 formats in a single type #[derive(Debug, Clone, Deserialize, Serialize)] pub enum SupportedHdfFormat { BifrostLoopCurrent(BifrostLoopCurrent), diff --git a/src/app/supported_formats/util.rs b/src/app/supported_formats/util.rs index e16a8c02..e69de29b 100644 --- a/src/app/supported_formats/util.rs +++ b/src/app/supported_formats/util.rs @@ -1,15 +0,0 @@ -// File extensions we recognize as hdf files. -const POSSIBLE_HDF_EXTENSIONS_CASE_INSENSITIVE: [&str; 3] = ["h5", "hdf", "hdf5"]; - -pub fn path_has_hdf_extension(path: &std::path::Path) -> bool { - let Some(extension) = path.extension() else { - return false; - }; - - for possible_extension in POSSIBLE_HDF_EXTENSIONS_CASE_INSENSITIVE { - if extension.eq_ignore_ascii_case(possible_extension) { - return true; - } - } - false -} diff --git a/src/app/util.rs b/src/app/util.rs index 49675425..e09f05a1 100644 --- a/src/app/util.rs +++ b/src/app/util.rs @@ -63,19 +63,19 @@ pub fn draw_empty_state(gui: &mut egui::Ui) { ui.end_row(); - list_supported_hdf_formats(ui); + list_supported_hdf5_formats(ui); }); }); }); } -fn list_supported_hdf_formats(ui: &mut egui::Ui) { +fn list_supported_hdf5_formats(ui: &mut egui::Ui) { #[cfg(target_arch = "wasm32")] - ui.label(RichText::new("⚠ No HDF support on web ⚠")); + ui.label(RichText::new("⚠ No HDF5 support on web ⚠")); #[cfg(not(target_arch = "wasm32"))] { - ui.label(RichText::new("⚠ Coming soon: Bifrost TX Loop Current ⚠")); + ui.label(RichText::new("Bifrost TX Loop Current").strong()); ui.label("Loop Current measurements"); ui.add(Hyperlink::from_label_and_url( diff --git a/src/main.rs b/src/main.rs index af9f7902..63359775 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,12 @@ #![warn(clippy::all, rust_2018_idioms)] #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release -#[cfg(not(target_arch = "wasm32"))] +// Don't enable on ARM64 Linux due to: +// 'c_src/mimalloc/src/options.c:215:19: error: expansion of date or time macro is not reproducible [-Werror,-Wdate-time]' +#[cfg(not(any( + target_arch = "wasm32", + all(target_arch = "aarch64", target_os = "linux") +)))] #[global_allocator] static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; // Much faster allocator, frames rendered ~25% faster on windows 11 diff --git a/tests/snapshots/default_app_window.png b/tests/snapshots/default_app_window.png index 46fee748..d26d15ce 100644 Binary files a/tests/snapshots/default_app_window.png and b/tests/snapshots/default_app_window.png differ diff --git a/tests/snapshots/default_mqtt_config_window.png b/tests/snapshots/default_mqtt_config_window.png index 2e476643..0fbc2ab7 100644 Binary files a/tests/snapshots/default_mqtt_config_window.png and b/tests/snapshots/default_mqtt_config_window.png differ diff --git a/tests/snapshots/dropped_hdf5_bifrost_current.png b/tests/snapshots/dropped_hdf5_bifrost_current.png new file mode 100644 index 00000000..7aca28c2 Binary files /dev/null and b/tests/snapshots/dropped_hdf5_bifrost_current.png differ diff --git a/tests/snapshots/dropped_mbed_pid_regular_v6.png b/tests/snapshots/dropped_mbed_pid_regular_v6.png index c99587e0..8fee898d 100644 Binary files a/tests/snapshots/dropped_mbed_pid_regular_v6.png and b/tests/snapshots/dropped_mbed_pid_regular_v6.png differ diff --git a/tests/snapshots/dropped_mbed_status_regular_v6.png b/tests/snapshots/dropped_mbed_status_regular_v6.png index 547a5301..d0b474e7 100644 Binary files a/tests/snapshots/dropped_mbed_status_regular_v6.png and b/tests/snapshots/dropped_mbed_status_regular_v6.png differ diff --git a/tests/test_snapshot_plotinator3000.rs b/tests/test_snapshot_plotinator3000.rs index 1447be10..fad5b028 100644 --- a/tests/test_snapshot_plotinator3000.rs +++ b/tests/test_snapshot_plotinator3000.rs @@ -1,5 +1,5 @@ mod util; -use test_util::{mbed_pid_v6_regular, mbed_status_v6_regular}; +use test_util::{bifrost_current::bifrost_current, mbed_pid_v6_regular, mbed_status_v6_regular}; use util::*; #[test] @@ -61,3 +61,11 @@ fn test_snapshot_drop_load_mbed_status_pid_v6_with_cursor_on_plot_window() { // a higher diff from GPU to GPU harness.save_snapshot_with_threshold(CiThreshold(62.0)); } + +#[test] +fn test_snapshot_drop_load_hdf5_bifrost_current() { + let mut harness = HarnessWrapper::new("dropped_hdf5_bifrost_current"); + harness.drop_file(bifrost_current()); + harness.run(); + harness.save_snapshot(); +}