From d0a81d59677a5f0a766dfc08f16b8fb4d3231c98 Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Mon, 18 Mar 2024 17:49:03 +0800 Subject: [PATCH 1/5] make it more static Signed-off-by: Bugen Zhao --- Cargo.lock | 2 ++ src/utils/workspace-config/Cargo.toml | 12 ++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9a83f31ffbd9..b9930c8fddba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14029,7 +14029,9 @@ dependencies = [ name = "workspace-config" version = "1.7.0-alpha" dependencies = [ + "libz-sys", "log", + "lzma-sys", "openssl-sys", "sasl2-sys", "tracing", diff --git a/src/utils/workspace-config/Cargo.toml b/src/utils/workspace-config/Cargo.toml index a83978a9acba..17897cdbcd30 100644 --- a/src/utils/workspace-config/Cargo.toml +++ b/src/utils/workspace-config/Cargo.toml @@ -11,15 +11,23 @@ repository = { workspace = true } [features] # some crates opt-in static linking, while some opt-in dynamic linking, # so they are two features :) -rw-static-link = ["openssl-sys", "sasl2-sys"] +rw-static-link = ["libz-sys", "lzma-sys", "openssl-sys", "sasl2-sys"] rw-dynamic-link = ["zstd-sys"] [dependencies] +# Disable verbose logs for release builds log = { version = "0.4", features = ["release_max_level_debug"] } +tracing = { version = "0.1", features = ["release_max_level_debug"] } + +# Static linking +libz-sys = { version = "1", optional = true, features = ["static"] } +lzma-sys = { version = "0.1", optional = true, features = ["static"] } openssl-sys = { version = "0.9.96", optional = true, features = ["vendored"] } sasl2-sys = { version = "0.1", optional = true, features = ["gssapi-vendored"] } -tracing = { version = "0.1", features = ["release_max_level_debug"] } + +# Dynamic linking zstd-sys = { version = "2", optional = true, default-features = false, features = ["pkg-config"] } + # workspace-hack = { path = "../../workspace-hack" } # Don't add workspace-hack into this crate! From 359a756c4a4d8140b71cd730b7e737a52819dda4 Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Mon, 18 Mar 2024 17:57:21 +0800 Subject: [PATCH 2/5] add prefix to make it clearer Signed-off-by: Bugen Zhao --- src/utils/workspace-config/Cargo.toml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/utils/workspace-config/Cargo.toml b/src/utils/workspace-config/Cargo.toml index 17897cdbcd30..52a3888acdec 100644 --- a/src/utils/workspace-config/Cargo.toml +++ b/src/utils/workspace-config/Cargo.toml @@ -11,8 +11,8 @@ repository = { workspace = true } [features] # some crates opt-in static linking, while some opt-in dynamic linking, # so they are two features :) -rw-static-link = ["libz-sys", "lzma-sys", "openssl-sys", "sasl2-sys"] -rw-dynamic-link = ["zstd-sys"] +rw-static-link = ["static-libz-sys", "static-lzma-sys", "static-openssl-sys", "static-sasl2-sys"] +rw-dynamic-link = ["dynamic-zstd-sys"] [dependencies] # Disable verbose logs for release builds @@ -20,14 +20,13 @@ log = { version = "0.4", features = ["release_max_level_debug"] } tracing = { version = "0.1", features = ["release_max_level_debug"] } # Static linking -libz-sys = { version = "1", optional = true, features = ["static"] } -lzma-sys = { version = "0.1", optional = true, features = ["static"] } -openssl-sys = { version = "0.9.96", optional = true, features = ["vendored"] } -sasl2-sys = { version = "0.1", optional = true, features = ["gssapi-vendored"] } +static-libz-sys = { package = "libz-sys", version = "1", optional = true, features = ["static"] } +static-lzma-sys = { package = "lzma-sys", version = "0.1", optional = true, features = ["static"] } +static-openssl-sys = { package = "openssl-sys", version = "0.9.96", optional = true, features = ["vendored"] } +static-sasl2-sys = { package = "sasl2-sys", version = "0.1", optional = true, features = ["gssapi-vendored"] } # Dynamic linking -zstd-sys = { version = "2", optional = true, default-features = false, features = ["pkg-config"] } - +dynamic-zstd-sys = { package = "zstd-sys", version = "2", optional = true, default-features = false, features = ["pkg-config"] } # workspace-hack = { path = "../../workspace-hack" } # Don't add workspace-hack into this crate! From 7a6e4cb9dea731c9a82aa0d6feddd0775b113ca8 Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Mon, 18 Mar 2024 17:57:34 +0800 Subject: [PATCH 3/5] use grouped sorting Signed-off-by: Bugen Zhao --- Makefile.toml | 4 ++-- ci/scripts/build.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile.toml b/Makefile.toml index f60b624f19c0..4cec01bd9f26 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -1074,8 +1074,8 @@ script = """ echo "Running $(tput setaf 4)cargo sort$(tput sgr0) checks and attempting to fix" # Rewriting Cargo.toml will cause a full rebuild of all crates, so we always check before fix. -(cargo sort -w -c > /dev/null) || cargo sort -w -test $? -eq 0 || { echo "cargo sort check failed. You may run $(tput setaf 4)cargo sort -w$(tput sgr0) to fix it."; exit 1; } +(cargo sort -g -w -c > /dev/null) || cargo sort -g -w +test $? -eq 0 || { echo "cargo sort check failed. You may run $(tput setaf 4)cargo sort -g -w$(tput sgr0) to fix it."; exit 1; } """ [tasks.check-fmt] diff --git a/ci/scripts/build.sh b/ci/scripts/build.sh index 91b26bee8d38..b631ed542539 100755 --- a/ci/scripts/build.sh +++ b/ci/scripts/build.sh @@ -28,7 +28,7 @@ if [[ "$profile" != "ci-dev" ]] && [[ "$profile" != "ci-release" ]]; then fi echo "--- Rust cargo-sort check" -cargo sort --check --workspace +cargo sort --check --workspace --grouped echo "--- Rust cargo-hakari check" cargo hakari generate --diff From 4bb291798204fe4907c5d1c2e509c21e682b8e89 Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Tue, 19 Mar 2024 13:19:07 +0800 Subject: [PATCH 4/5] move sea-orm to workspace dep Signed-off-by: Bugen Zhao --- Cargo.toml | 6 ++++++ src/meta/Cargo.toml | 8 +------- src/meta/model_v2/Cargo.toml | 8 +------- src/meta/node/Cargo.toml | 8 +------- src/meta/service/Cargo.toml | 8 +------- 5 files changed, 10 insertions(+), 28 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ae63068391aa..b4adc376372b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -160,6 +160,12 @@ opentelemetry = "0.21" opentelemetry-otlp = "0.14" opentelemetry_sdk = { version = "0.21", default-features = false } opentelemetry-semantic-conventions = "0.13" +sea-orm = { version = "0.12.14", features = [ + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", + "runtime-tokio-native-tls", +] } tokio-util = "0.7" tracing-opentelemetry = "0.22" diff --git a/src/meta/Cargo.toml b/src/meta/Cargo.toml index 07af09d29350..822a71d3ad17 100644 --- a/src/meta/Cargo.toml +++ b/src/meta/Cargo.toml @@ -62,13 +62,7 @@ risingwave_rpc_client = { workspace = true } risingwave_sqlparser = { workspace = true } rw_futures_util = { workspace = true } scopeguard = "1.2.0" -sea-orm = { version = "0.12.14", features = [ - "sqlx-mysql", - "sqlx-postgres", - "sqlx-sqlite", - "runtime-tokio-native-tls", - "macros", -] } +sea-orm = { workspace = true } serde = { version = "1.0.196", features = ["derive"] } serde_json = "1.0.113" strum = { version = "0.25", features = ["derive"] } diff --git a/src/meta/model_v2/Cargo.toml b/src/meta/model_v2/Cargo.toml index 9d75bf22b5c6..942b6adffa07 100644 --- a/src/meta/model_v2/Cargo.toml +++ b/src/meta/model_v2/Cargo.toml @@ -18,12 +18,6 @@ prost = { workspace = true } risingwave_common = { workspace = true } risingwave_hummock_sdk = { workspace = true } risingwave_pb = { workspace = true } -sea-orm = { version = "0.12.14", features = [ - "sqlx-mysql", - "sqlx-postgres", - "sqlx-sqlite", - "runtime-tokio-native-tls", - "macros", -] } +sea-orm = { workspace = true } serde = { version = "1.0.196", features = ["derive"] } serde_json = "1.0.113" diff --git a/src/meta/node/Cargo.toml b/src/meta/node/Cargo.toml index 0538fa19280e..122cf0618a11 100644 --- a/src/meta/node/Cargo.toml +++ b/src/meta/node/Cargo.toml @@ -32,13 +32,7 @@ risingwave_meta_model_migration = { workspace = true } risingwave_meta_service = { workspace = true } risingwave_pb = { workspace = true } risingwave_rpc_client = { workspace = true } -sea-orm = { version = "0.12.14", features = [ - "sqlx-mysql", - "sqlx-postgres", - "sqlx-sqlite", - "runtime-tokio-native-tls", - "macros", -] } +sea-orm = { workspace = true } serde = { version = "1", features = ["derive"] } serde_json = "1" thiserror-ext = { workspace = true } diff --git a/src/meta/service/Cargo.toml b/src/meta/service/Cargo.toml index a91e570ccd6a..47a984b17585 100644 --- a/src/meta/service/Cargo.toml +++ b/src/meta/service/Cargo.toml @@ -27,13 +27,7 @@ risingwave_hummock_sdk = { workspace = true } risingwave_meta = { workspace = true } risingwave_meta_model_v2 = { workspace = true } risingwave_pb = { workspace = true } -sea-orm = { version = "0.12.14", features = [ - "sqlx-mysql", - "sqlx-postgres", - "sqlx-sqlite", - "runtime-tokio-native-tls", - "macros", -] } +sea-orm = { workspace = true } sync-point = { path = "../../utils/sync-point" } thiserror-ext = { workspace = true } tokio = { version = "0.2", package = "madsim-tokio", features = [ From cec2c41be3ad4f8efda0f145f22b2c885fc2e5da Mon Sep 17 00:00:00 2001 From: Bugen Zhao Date: Tue, 19 Mar 2024 13:25:16 +0800 Subject: [PATCH 5/5] remove build dep on openssl-sys Signed-off-by: Bugen Zhao --- src/utils/workspace-config/Cargo.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/utils/workspace-config/Cargo.toml b/src/utils/workspace-config/Cargo.toml index 52a3888acdec..e15dd774b7e3 100644 --- a/src/utils/workspace-config/Cargo.toml +++ b/src/utils/workspace-config/Cargo.toml @@ -30,10 +30,7 @@ dynamic-zstd-sys = { package = "zstd-sys", version = "2", optional = true, defau # workspace-hack = { path = "../../workspace-hack" } # Don't add workspace-hack into this crate! -# FIXME(xxchan): This is a temporary fix due to how cargo and hakari works. See related PR for more details. -# We will revisit how to handle workspace-hack and build-dependency issues later. [build-dependencies] -openssl-sys = { version = "0.9.96", optional = true, features = ["vendored"] } [lints] workspace = true