Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for "cargo make build" and "cargo make check" on windows #1266

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 38 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ console-subscriber = "0.4.1"
ctor = "0.2.9"
dashmap = "6.1.0"
derive_more = { version = "1.0.0", features = ["display", "into", "from_str"] }
dirs = "6.0.0"
drop-stream = "0.3.2"
figment = { version = "0.10.19", features = ["toml", "env"] }
fred = { version = "=9.4.0", features = [
Expand Down Expand Up @@ -178,6 +179,7 @@ sqlx = { version = "0.8", features = [
] }
strum = "0.26.3"
strum_macros = "0.26.4"
system-interface = "0.27.3"
tap = "1.0.1"
tempfile = "3.14.0"
testcontainers = { version = "0.23.1" }
Expand Down Expand Up @@ -223,7 +225,6 @@ wasmtime = { version = "=27.0.0", features = ["component-model"] }
wasmtime-wasi = { version = "=27.0.0" }
wasmtime-wasi-http = { version = "=27.0.0" }
webpki-roots = { version = "0.26.7" }
xdg = "2.5.2"

[patch.crates-io]
redis-protocol = { git = "https://github.com/golemcloud/redis-protocol.rs.git", branch = "unpin-cookie-factory" }
Expand Down
2 changes: 1 addition & 1 deletion golem-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ clap_complete = { version = "4.5.38" }
cli-table = { workspace = true }
colored = "2.1.0"
derive_more = { workspace = true }
dirs = "5.0.1"
dirs = { workspace = true }
futures-util = { workspace = true }
glob = "0.3.1"
golem-examples = "=1.1.1"
Expand Down
1 change: 1 addition & 0 deletions golem-worker-executor-base/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ testcontainers = { workspace = true }
testcontainers-modules = { workspace = true }
test-r = { workspace = true }
tracing-subscriber = { workspace = true }
system-interface = { workspace = true }

[build-dependencies]
cargo_metadata = "0.19.1"
Expand Down
2 changes: 1 addition & 1 deletion golem-worker-executor-base/tests/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ use std::collections::HashMap;
use std::env;
use std::io::Write;
use std::net::SocketAddr;
use std::os::unix::fs::FileExt;
use std::path::Path;
use std::sync::{Arc, Mutex};
use std::time::{Duration, Instant};
use system_interface::fs::FileIoExt;
use tokio::time::sleep;
use tracing::{debug, info};
use wasmtime_wasi::runtime::spawn;
Expand Down
7 changes: 4 additions & 3 deletions golem/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ golem-worker-service-base = { path = "../golem-worker-service-base", version = "
anyhow = { workspace = true }
bytes = { workspace = true }
clap = { workspace = true }
dirs = { workspace = true }
http-body-util = "0.1.2"
hyper = { workspace = true }
futures = { workspace = true }
Expand All @@ -49,15 +50,15 @@ sqlx = { workspace = true }
tempfile = { workspace = true }
tokio = { workspace = true }
tracing = { workspace = true }
xdg = { workspace = true }

# Sozu builds with simd support by default, but it only works on x86_64
# Sozu does not support windows, until we find an alternative we exclude suzo deps, and build a dummy binary

[target.'cfg(target_arch = "x86_64")'.dependencies]
[target.'cfg(all(target_arch = "x86_64", not(windows)))'.dependencies]
sozu-command-lib = { workspace = true }
sozu-lib = { workspace = true }

[target.'cfg(not(target_arch = "x86_64"))'.dependencies]
[target.'cfg(all(not(target_arch = "x86_64"), not(windows)))'.dependencies]
sozu-command-lib = { workspace = true, default-features = false }
sozu-lib = { workspace = true, default-features = false }

Expand Down
13 changes: 9 additions & 4 deletions golem/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,15 @@ impl<Ctx> CliCommand<Ctx> for SingleExecutableCommand {
data_dir,
clean,
} => {
let base_directories = xdg::BaseDirectories::with_prefix("golem")
.map_err(|_| GolemError("Failed to get XDG base directories".to_string()))?;

let data_dir = data_dir.unwrap_or_else(|| base_directories.get_state_home());
let data_dir = {
if let Some(data_dir) = data_dir {
data_dir
} else {
dirs::data_local_dir()
.ok_or_else(|| GolemError("Failed to get data dir".to_string()))?
.join("golem")
}
};

if clean && tokio::fs::metadata(&data_dir).await.is_ok() {
tokio::fs::remove_dir_all(&data_dir)
Expand Down
5 changes: 2 additions & 3 deletions golem/src/launch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

use crate::health;
use crate::migration::IncludedMigrationsDir;
use crate::proxy;
use crate::AllRunDetails;
use anyhow::Context;
use golem_common::config::DbConfig;
Expand Down Expand Up @@ -46,8 +47,6 @@ use tokio::runtime::Handle;
use tokio::task::JoinSet;
use tracing::Instrument;

use crate::proxy;

pub struct LaunchArgs {
pub router_host: String,
pub router_port: u16,
Expand Down Expand Up @@ -195,7 +194,7 @@ fn worker_executor_config(
..ComponentServiceGrpcConfig::default()
}
),
compiled_component_service: CompiledComponentServiceConfig::Disabled(golem_worker_executor_base::services::golem_config::CompiledComponentServiceDisabledConfig { }),
compiled_component_service: CompiledComponentServiceConfig::Disabled(golem_worker_executor_base::services::golem_config::CompiledComponentServiceDisabledConfig {}),
shard_manager_service: ShardManagerServiceConfig::Grpc(ShardManagerServiceGrpcConfig {
host: args.router_host.clone(),
port: shard_manager_run_details.grpc_port,
Expand Down
28 changes: 24 additions & 4 deletions golem/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::AllRunDetails;
use tokio::task::JoinSet;
use tracing::info;

#[cfg(not(windows))]
use anyhow::Context;
#[cfg(not(windows))]
use sozu_command_lib::proto::command::WorkerResponse;
#[cfg(not(windows))]
use sozu_command_lib::{
channel::Channel,
config::ListenerBuilder,
Expand All @@ -22,12 +29,10 @@ use sozu_command_lib::{
RequestHttpFrontend, RulePosition, SocketAddress, WorkerRequest,
},
};
#[cfg(not(windows))]
use std::net::Ipv4Addr;
use tokio::task::JoinSet;
use tracing::info;

use crate::AllRunDetails;

#[cfg(not(windows))]
pub fn start_proxy(
listener_addr: &str,
listener_port: u16,
Expand Down Expand Up @@ -163,3 +168,18 @@ pub fn start_proxy(

Ok(command_channel)
}

#[cfg(windows)]
pub struct Dummy;

#[cfg(windows)]
pub fn start_proxy(
_listener_addr: &str,
_listener_port: u16,
_healthcheck_port: u16,
_all_run_details: &AllRunDetails,
_join_set: &mut JoinSet<Result<(), anyhow::Error>>,
) -> Result<Dummy, anyhow::Error> {
info!("Proxy is not supported on windows yet");
Ok(Dummy)
}
Loading