From a0ce6fe48d1be9ec4e4643ccbcf68c03ddfe56f8 Mon Sep 17 00:00:00 2001 From: Toms Jansons Date: Wed, 8 Jan 2025 16:20:18 +0200 Subject: [PATCH 1/3] fix: msvc on win --- .github/workflows/release.yaml | 10 ++-------- Cargo.lock | 7 +++++++ Cargo.toml | 1 + build.rs | 3 +++ 4 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 build.rs diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 0a9e8a4..097b90c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -69,10 +69,10 @@ jobs: target: x86_64-unknown-linux-gnu name: linux-amd64 - os: windows-latest - target: x86_64-pc-windows-gcc + target: x86_64-pc-windows-msvc name: windows-amd64 # - os: windows-latest - # target: aarch64-pc-windows-gcc + # target: aarch64-pc-windows-msvc # name: windows-arm64 - os: macos-latest target: x86_64-apple-darwin @@ -90,12 +90,6 @@ jobs: with: targets: ${{ matrix.target }} - - name: Install MinGW-w64 (Windows) - if: matrix.os == 'windows-latest' - uses: egor-tensin/setup-mingw@v2 - with: - platform: x64 - - name: Cache cargo and build files uses: actions/cache@v4 with: diff --git a/Cargo.lock b/Cargo.lock index c45721b..5ed5c00 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1615,6 +1615,7 @@ dependencies = [ "serde_json", "smartstring", "sql-builder", + "static_vcruntime", "struct-field-names-as-array", "thiserror 2.0.9", "tiny_http", @@ -1838,6 +1839,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "static_vcruntime" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "954e3e877803def9dc46075bf4060147c55cd70db97873077232eae0269dc89b" + [[package]] name = "strsim" version = "0.11.1" diff --git a/Cargo.toml b/Cargo.toml index d24fecb..edfada6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,6 +26,7 @@ serde_derive = "1.0.201" serde_json = "1.0.117" smartstring = "1.0.1" sql-builder = "3.1.1" +static_vcruntime = "2.0.0" struct-field-names-as-array = "0.3.0" thiserror = "2.0.9" tiny_http = "0.12.0" diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..20e1c8e --- /dev/null +++ b/build.rs @@ -0,0 +1,3 @@ +fn main() { + static_vcruntime::metabuild(); +} From 4b4285ad3ace260d62b1b4ae6c43e5016db1d212 Mon Sep 17 00:00:00 2001 From: Toms Jansons Date: Wed, 8 Jan 2025 16:24:39 +0200 Subject: [PATCH 2/3] fix: file location --- build.rs => src/build.rs | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename build.rs => src/build.rs (100%) diff --git a/build.rs b/src/build.rs similarity index 100% rename from build.rs rename to src/build.rs From 10dc8a7ccfaf9333c77121f8db1dbe60dd4e7027 Mon Sep 17 00:00:00 2001 From: Toms Jansons Date: Wed, 8 Jan 2025 17:12:23 +0200 Subject: [PATCH 3/3] feat: build with no debug viewer --- .github/workflows/release.yaml | 40 +++++++++++++++++++++++++++++++++- Cargo.lock | 7 +++--- Cargo.toml | 15 +++++++------ src/debug/mod.rs | 1 + src/router_runner.rs | 18 +++++++++------ 5 files changed, 63 insertions(+), 18 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 097b90c..6cb20a9 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -60,6 +60,44 @@ jobs: name: RELEASE_NOTES path: RELEASE_NOTES.md + build-debug-viewer: + needs: prepare-version + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + targets: x86_64-unknown-linux-gnu + + - name: Cache cargo and build files + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/ + ~/.cargo/git/ + target/ + key: ubuntu-x86_64-cargo-debug-viewer-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ubuntu-x86_64-cargo-debug-viewer- + + - name: Build with debug-viewer + run: cargo build --release --target x86_64-unknown-linux-gnu --features debug-viewer + + - name: Prepare debug-viewer binary + run: | + mkdir dist + cp "target/x86_64-unknown-linux-gnu/release/ridi-router" "dist/ridi-router-debug-viewer-linux-amd64" + chmod +x "dist/ridi-router-debug-viewer-linux-amd64" + + - name: Upload debug-viewer binary + uses: actions/upload-artifact@v3 + with: + name: binary-debug-viewer-linux-amd64 + path: dist/* + build: needs: prepare-version strategy: @@ -123,7 +161,7 @@ jobs: path: dist/* create-release: - needs: [prepare-version, build] + needs: [prepare-version, build, build-debug-viewer] runs-on: ubuntu-latest permissions: contents: write diff --git a/Cargo.lock b/Cargo.lock index 5ed5c00..009df7c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1065,8 +1065,9 @@ dependencies = [ [[package]] name = "json-tools" -version = "1.1.3-alpha.0" -source = "git+https://github.com/tomsjansons/json-tools.git?branch=value-pairs#2b47444a5c412c20222cb0a4f006238e2f4f71cc" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d28c16c044c4acdd8c511f9b505a33cba1eff7b116448c8985b84011ee8d8368" [[package]] name = "kdtree" @@ -1593,7 +1594,7 @@ dependencies = [ [[package]] name = "ridi-router" -version = "0.4.1" +version = "0.5.1" dependencies = [ "anyhow", "bincode", diff --git a/Cargo.toml b/Cargo.toml index edfada6..3579b7b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,9 @@ name = "ridi-router" version = "0.5.1" edition = "2021" -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[features] +default = [] +debug-viewer = ["dep:duckdb", "dep:qstring", "dep:sql-builder", "dep:tiny_http"] [dependencies] anyhow = "1.0.95" @@ -11,25 +13,24 @@ bincode = "1.3.3" clap = { version = "4.5.9", features = ["derive"] } csv = "1.3.1" derive-name = "1.1.0" -duckdb = { version = "1.1.1", features = ["bundled"] } +duckdb = { version = "1.1.1", features = ["bundled"] , optional = true } geo = "0.29.3" gpx = "0.10.0" hdbscan = "0.9.0" interprocess = "2.2.1" -# json-tools = "1.1.2" -json-tools = { git = "https://github.com/tomsjansons/json-tools.git", branch = "value-pairs" } +json-tools = "1.1.3" osmpbfreader = "0.16.1" -qstring = "0.7.2" +qstring = { version = "0.7.2", optional = true } rayon = "1.10.0" serde = { version = "1.0.201", features = ["derive"] } serde_derive = "1.0.201" serde_json = "1.0.117" smartstring = "1.0.1" -sql-builder = "3.1.1" +sql-builder = { version = "3.1.1", optional = true } static_vcruntime = "2.0.0" struct-field-names-as-array = "0.3.0" thiserror = "2.0.9" -tiny_http = "0.12.0" +tiny_http = { version = "0.12.0", optional = true } tracing = "0.1.40" tracing-subscriber = { version = "0.3.18", features = ["json"] } typeshare = { version = "1.0.4", default-features = false } diff --git a/src/debug/mod.rs b/src/debug/mod.rs index 2ba158a..68abe9f 100644 --- a/src/debug/mod.rs +++ b/src/debug/mod.rs @@ -1,2 +1,3 @@ +#[cfg(feature = "debug-viewer")] pub mod viewer; pub mod writer; diff --git a/src/router_runner.rs b/src/router_runner.rs index 6ae6019..4099b5f 100644 --- a/src/router_runner.rs +++ b/src/router_runner.rs @@ -5,10 +5,7 @@ use serde::{Deserialize, Serialize}; use tracing::info; use crate::{ - debug::{ - viewer::{DebugViewer, DebugViewerError}, - writer::DebugWriter, - }, + debug::writer::DebugWriter, ipc_handler::{IpcHandler, IpcHandlerError, ResponseMessage, RouteMessage, RouterResult}, map_data::graph::MapDataGraph, map_data_cache::{MapDataCache, MapDataCacheError}, @@ -55,8 +52,11 @@ pub enum RouterRunnerError { #[error("Failed to write cache: {error}")] CacheWrite { error: MapDataCacheError }, + #[cfg(feature = "debug-viewer")] #[error("Failed run debug viewer: {error}")] - DebugViewer { error: DebugViewerError }, + DebugViewer { + error: crate::debug::viewer::DebugViewerError, + }, } #[derive(Parser)] @@ -232,6 +232,7 @@ enum CliMode { #[command(subcommand)] routing_mode: RoutingMode, }, + #[cfg(feature = "debug-viewer")] DebugViewer { #[arg(long, value_name = "DIR")] debug_dir: PathBuf, @@ -489,8 +490,11 @@ impl RouterRunner { socket_name.clone(), rule_file.clone(), ), - CliMode::DebugViewer { debug_dir } => Ok(DebugViewer::run(debug_dir.clone()) - .map_err(|error| RouterRunnerError::DebugViewer { error })?), + #[cfg(feature = "debug-viewer")] + CliMode::DebugViewer { debug_dir } => { + Ok(crate::debug::viewer::DebugViewer::run(debug_dir.clone()) + .map_err(|error| RouterRunnerError::DebugViewer { error })?) + } } } }