Skip to content

Commit eb9f970

Browse files
nipunn1313Convex, Inc.
authored andcommitted
Update deps to compile better on windows (#25226)
GitOrigin-RevId: 1f4522f57ab7a55f5bf5caa005e9c38dacc41a9f
1 parent d389e75 commit eb9f970

File tree

5 files changed

+47
-49
lines changed

5 files changed

+47
-49
lines changed

Cargo.lock

Lines changed: 26 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/isolate/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ vector = { path = "../vector" }
8585

8686
[build-dependencies]
8787
anyhow = { workspace = true }
88-
common = { path = "../common" }
8988
serde = { workspace = true }
9089
serde_json = { workspace = true }
90+
value = { path = "../value" }
9191

9292
[dev-dependencies]
9393
async-broadcast = { workspace = true }

crates/isolate/build.rs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ use std::{
1414
};
1515

1616
use anyhow::Context;
17-
use common::sha256::Sha256;
1817
use serde::Deserialize;
18+
use value::sha256::Sha256;
1919

2020
const PACKAGES_DIR: &str = "../../npm-packages";
2121
const NPM_DIR: &str = "../../npm-packages/convex";
@@ -26,6 +26,16 @@ const NODE_EXECUTOR_DIST_DIR: &str = "../../npm-packages/node-executor/dist";
2626

2727
const ADMIN_KEY: &str = include_str!("../keybroker/dev/admin_key.txt");
2828

29+
#[cfg(not(target_os = "windows"))]
30+
const RUSH: &str = "../scripts/node_modules/.bin/rush";
31+
#[cfg(target_os = "windows")]
32+
const RUSH: &str = "../../scripts/node_modules/.bin/rush.cmd";
33+
#[cfg(not(target_os = "windows"))]
34+
const NPM: &str = "npm";
35+
#[cfg(target_os = "windows")]
36+
const NPM: &str = "npm.cmd";
37+
const CONVEX: &str = "node_modules/convex/bin/main.js";
38+
2939
#[derive(Debug, Deserialize)]
3040
#[serde(rename_all = "camelCase")]
3141
struct Bundle {
@@ -109,8 +119,8 @@ fn main() -> anyhow::Result<()> {
109119

110120
// Step 1: Ensure the `server`, `dashboard`, and `cli` deps are installed.
111121
for _ in 0..3 {
112-
let output = Command::new("../scripts/node_modules/.bin/rush")
113-
.current_dir(PACKAGES_DIR)
122+
let output = Command::new(RUSH)
123+
.current_dir(Path::new(PACKAGES_DIR))
114124
.args(["install"])
115125
.output()
116126
.context("Failed on rush install")?;
@@ -127,7 +137,7 @@ fn main() -> anyhow::Result<()> {
127137
anyhow::ensure!(output.status.success(), "Failed to 'rush install'");
128138
break;
129139
}
130-
let status = Command::new("../scripts/node_modules/.bin/rush")
140+
let status = Command::new(RUSH)
131141
.current_dir(PACKAGES_DIR)
132142
.args([
133143
"build",
@@ -144,7 +154,7 @@ fn main() -> anyhow::Result<()> {
144154
.context("Failed on rush build")?;
145155
anyhow::ensure!(status.success(), "Failed to 'rush build'");
146156
// Step 2: Use `build-server` to package up our builtin `_system` UDFs.
147-
let output = Command::new("npm")
157+
let output = Command::new(NPM)
148158
.current_dir(NPM_DIR)
149159
.arg("run")
150160
.arg("--silent")
@@ -202,10 +212,10 @@ fn write_udf_test_bundle(out_dir: &Path) -> anyhow::Result<()> {
202212
if Path::exists(&bundle_dir) {
203213
fs::remove_dir_all(bundle_dir.clone())?;
204214
}
205-
let output = Command::new("npx")
215+
let output = Command::new("node")
206216
.current_dir(UDF_TESTS_DIR)
207217
.args([
208-
"convex",
218+
CONVEX,
209219
"deploy",
210220
"--debug-bundle-path",
211221
bundle_dir.to_str().unwrap(),
7.78 MB
Binary file not shown.

crates/pb_build/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ cfg_if::cfg_if! {
1515
const PROTOC_BINARY_NAME: &str = "protoc-linux-aarch64";
1616
} else if #[cfg(all(target_os = "linux", target_arch = "x86_64"))] {
1717
const PROTOC_BINARY_NAME: &str = "protoc-linux-x86_64";
18+
} else if #[cfg(all(target_os = "windows"))] {
19+
// works on arm too
20+
const PROTOC_BINARY_NAME: &str = "protoc-windows-x86_64";
1821
} else {
1922
panic!("no protoc binary available for this architecture");
2023
}

0 commit comments

Comments
 (0)