From 379e4539120dd4aebdc30d7195f9b61cee09b24b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20F=C3=A4rnstrand?= Date: Tue, 21 Jan 2025 15:29:06 +0100 Subject: [PATCH 1/3] Remove libraries and not needed crates from default-members --- Cargo.toml | 40 +++++----------------------------------- 1 file changed, 5 insertions(+), 35 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1fd83313b634..24f40c5e8f27 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,13 +13,13 @@ members = [ "mullvad-api", "mullvad-cli", "mullvad-daemon", + "mullvad-encrypted-dns-proxy", "mullvad-exclude", "mullvad-fs", "mullvad-ios", "mullvad-jni", "mullvad-management-interface", "mullvad-nsis", - "mullvad-encrypted-dns-proxy", "mullvad-paths", "mullvad-problem-report", "mullvad-relay-selector", @@ -45,44 +45,14 @@ members = [ "wireguard-go-rs", "windows-installer", ] -# The default members may exclude packages that cannot be built for all targets, or that do not always -# need to be built +# Default members dictate what is built when running `cargo build` in the root directory. +# This is set to a minimal set of packages to speed up the build process and avoid building +# crates which might not compile without additional input, such as the `windows-installer` crate. +# To build or test everything, add `--workspace` to your cargo commands. default-members = [ - "android/translations-converter", - "desktop/packages/nseventforwarder", - "mullvad-api", "mullvad-cli", "mullvad-daemon", - "mullvad-exclude", - "mullvad-fs", - "mullvad-ios", - "mullvad-jni", - "mullvad-management-interface", - "mullvad-nsis", - "mullvad-encrypted-dns-proxy", - "mullvad-paths", - "mullvad-problem-report", - "mullvad-relay-selector", - "mullvad-setup", - "mullvad-types", - "mullvad-types/intersection-derive", "mullvad-version", - "talpid-core", - "talpid-dbus", - "talpid-future", - "talpid-macos", - "talpid-net", - "talpid-openvpn", - "talpid-openvpn-plugin", - "talpid-platform-metadata", - "talpid-routing", - "talpid-time", - "talpid-tunnel", - "talpid-tunnel-config-client", - "talpid-windows", - "talpid-wireguard", - "tunnel-obfuscation", - "wireguard-go-rs", ] # Keep all lints in sync with `test/Cargo.toml` From 194226c3b74a04e97194a62904703a41799dba6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20F=C3=A4rnstrand?= Date: Tue, 21 Jan 2025 15:56:02 +0100 Subject: [PATCH 2/3] Add --workspace to cargo invocations, to test all crates --- .github/workflows/clippy.yml | 4 ++-- ci/check-rust.sh | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index 5adfb7970abe..ec021eb956e8 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -75,8 +75,8 @@ jobs: RUSTFLAGS: --deny warnings run: | source env.sh - time cargo clippy --locked --all-targets --no-default-features - time cargo clippy --locked --all-targets --all-features + time cargo clippy --workspace --locked --all-targets --no-default-features + time cargo clippy --workspace --locked --all-targets --all-features clippy-check-android: name: Clippy linting, Android diff --git a/ci/check-rust.sh b/ci/check-rust.sh index cb48fbed3f1b..c50adbaf3f5c 100755 --- a/ci/check-rust.sh +++ b/ci/check-rust.sh @@ -4,9 +4,12 @@ set -eux export RUSTFLAGS="--deny warnings" +# Excluding windows-installer because it builds an actual full installer +# at the build step, which is not desired in a CI environment. + # Build Rust crates source env.sh -time cargo build --locked --verbose +time cargo build --workspace --exclude windows-installer --locked --verbose # Test Rust crates -time cargo test --locked --verbose +time cargo test --workspace --exclude windows-installer --locked --verbose From 109f1b174c748fd8a750ddec50a4fbcc0c808c33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20F=C3=A4rnstrand?= Date: Tue, 21 Jan 2025 16:13:03 +0100 Subject: [PATCH 3/3] Specify --package when trying to run relay_list --- android/app/build.gradle.kts | 2 +- build.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts index 9da8b23fe4c5..26db17f1bbb6 100644 --- a/android/app/build.gradle.kts +++ b/android/app/build.gradle.kts @@ -299,7 +299,7 @@ tasks.register("generateRelayList") { onlyIf { isReleaseBuild() || !relayListPath.exists() } - commandLine("cargo", "run", "--bin", "relay_list") + commandLine("cargo", "run", "-p", "mullvad-api", "--bin", "relay_list") doLast { val output = standardOutput as ByteArrayOutputStream diff --git a/build.sh b/build.sh index 7d2bce9d511e..fd73914c9742 100755 --- a/build.sh +++ b/build.sh @@ -361,7 +361,7 @@ else fi log_info "Updating relays.json..." -cargo run --bin relay_list "${CARGO_ARGS[@]}" > build/relays.json +cargo run -p mullvad-api --bin relay_list "${CARGO_ARGS[@]}" > build/relays.json log_header "Installing JavaScript dependencies"