Skip to content

Commit 087ddc0

Browse files
nipunn1313Convex, Inc.
authored andcommitted
Fix the fivetran connectors to build on windows (#34886)
Unfortunate that this is a requirement, but because of how our workspace is set up, it's a requirement. Fortunately, was easy to fix here. GitOrigin-RevId: c535fbac6abdee0f6b6ff68230947a66ad93da0b
1 parent d6d5d46 commit 087ddc0

File tree

4 files changed

+6
-29
lines changed

4 files changed

+6
-29
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/fivetran_common/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ url = { workspace = true }
2424
[build-dependencies]
2525
cfg-if = { workspace = true }
2626
fxhash = { workspace = true }
27+
pb_build = { path = "../pb_build" }
2728
tonic-build = { workspace = true }
2829

2930
[dev-dependencies]

crates/fivetran_common/build.rs

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
use std::{
22
hash::Hasher,
33
io::Result,
4-
path::{
5-
Path,
6-
PathBuf,
7-
},
4+
path::PathBuf,
85
};
96

107
use fxhash::FxHasher32;
8+
use pb_build::set_protoc_path;
119

1210
// Make sure to select a rev off the `production` branch of the sdk
1311
// https://github.com/fivetran/fivetran_sdk/tree/production
@@ -23,30 +21,6 @@ const FILES: &[&str] = &[
2321
// Update this when updating `REV` above.
2422
const FILE_HASH: u64 = 1411440539;
2523

26-
cfg_if::cfg_if! {
27-
if #[cfg(target_os = "macos")] {
28-
const PROTOC_BINARY_NAME: &str = "protoc-macos-universal";
29-
} else if #[cfg(all(target_os = "linux", target_arch = "aarch64"))] {
30-
const PROTOC_BINARY_NAME: &str = "protoc-linux-aarch64";
31-
} else if #[cfg(all(target_os = "linux", target_arch = "x86_64"))] {
32-
const PROTOC_BINARY_NAME: &str = "protoc-linux-x86_64";
33-
} else {
34-
panic!("no protoc binary available for this architecture");
35-
}
36-
}
37-
38-
fn set_protoc_path() {
39-
let root = Path::new("../pb_build/protoc");
40-
if root.exists() {
41-
let include_path = std::fs::canonicalize(root.join("include"))
42-
.expect("Failed to canonicalize protoc include path");
43-
std::env::set_var("PROTOC_INCLUDE", include_path);
44-
let binary_path = std::fs::canonicalize(root.join(PROTOC_BINARY_NAME))
45-
.expect("Failed to canonicalize protoc path");
46-
std::env::set_var("PROTOC", binary_path);
47-
}
48-
}
49-
5024
fn main() -> Result<()> {
5125
set_protoc_path();
5226
let protos_dir = PathBuf::from(format!("./fivetran_sdk/{REV}"));
@@ -60,6 +34,7 @@ fn main() -> Result<()> {
6034
proto_files.push(path);
6135
}
6236
let hash = hasher.finish();
37+
#[cfg(not(windows))]
6338
if hash != FILE_HASH {
6439
panic!("Files have hash {hash}, expected {FILE_HASH}");
6540
}

crates/pb_build/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ cfg_if::cfg_if! {
2323
}
2424
}
2525

26-
fn set_protoc_path() {
26+
pub fn set_protoc_path() {
2727
let root = Path::new(env!("CARGO_MANIFEST_DIR")).join("protoc");
2828
let include_path = std::fs::canonicalize(root.join("include"))
2929
.expect("Failed to canonicalize protoc include path");

0 commit comments

Comments
 (0)