From cb3fd9093d9f8e817c0e3a2ab69107d7954f35a4 Mon Sep 17 00:00:00 2001 From: Darun Seethammagari Date: Mon, 14 Apr 2025 12:11:55 -0700 Subject: [PATCH 1/2] add symlink --- lazer/publisher_sdk/rust/Cargo.toml | 1 + lazer/publisher_sdk/rust/build.rs | 8 ++++---- lazer/publisher_sdk/rust/proto | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) create mode 120000 lazer/publisher_sdk/rust/proto diff --git a/lazer/publisher_sdk/rust/Cargo.toml b/lazer/publisher_sdk/rust/Cargo.toml index 010d1aea23..8b149278aa 100644 --- a/lazer/publisher_sdk/rust/Cargo.toml +++ b/lazer/publisher_sdk/rust/Cargo.toml @@ -12,3 +12,4 @@ protobuf = "3.7.2" [build-dependencies] protobuf-codegen = "3.7.2" + diff --git a/lazer/publisher_sdk/rust/build.rs b/lazer/publisher_sdk/rust/build.rs index b8d1c542d5..4f9de7eb16 100644 --- a/lazer/publisher_sdk/rust/build.rs +++ b/lazer/publisher_sdk/rust/build.rs @@ -5,13 +5,13 @@ use std::io::Result; /// Both JS and Rust SDKs read the proto files for generating types. fn main() -> Result<()> { // Tell cargo to recompile if any .proto files change - println!("cargo:rerun-if-changed=../proto/"); + println!("cargo:rerun-if-changed=proto/"); protobuf_codegen::Codegen::new() .pure() - .include("../proto") - .input("../proto/publisher_update.proto") - .input("../proto/pyth_lazer_transaction.proto") + .include("proto") + .input("proto/publisher_update.proto") + .input("proto/pyth_lazer_transaction.proto") .cargo_out_dir("protobuf") .run_from_script(); diff --git a/lazer/publisher_sdk/rust/proto b/lazer/publisher_sdk/rust/proto new file mode 120000 index 0000000000..5c8d352537 --- /dev/null +++ b/lazer/publisher_sdk/rust/proto @@ -0,0 +1 @@ +../proto \ No newline at end of file From 9d756be9638df793d236723566662151716640ae Mon Sep 17 00:00:00 2001 From: Darun Seethammagari Date: Mon, 14 Apr 2025 12:15:26 -0700 Subject: [PATCH 2/2] add comments --- lazer/publisher_sdk/rust/build.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lazer/publisher_sdk/rust/build.rs b/lazer/publisher_sdk/rust/build.rs index 4f9de7eb16..effbd94bd8 100644 --- a/lazer/publisher_sdk/rust/build.rs +++ b/lazer/publisher_sdk/rust/build.rs @@ -2,14 +2,15 @@ use std::io::Result; /// Automatically runs during cargo build. /// Proto files for Lazer are defined in the lazer sdk folder in the proto/ subdirectory. -/// Both JS and Rust SDKs read the proto files for generating types. +/// They are symlinked as proto/ in this rust/ folder with this command: ln -s ../proto proto +/// symlinking is necessary as cargo publish only includes files in the root for packaging fn main() -> Result<()> { // Tell cargo to recompile if any .proto files change println!("cargo:rerun-if-changed=proto/"); protobuf_codegen::Codegen::new() .pure() - .include("proto") + .include("proto") // symlinked proto folder. Actual fiels are in ../proto .input("proto/publisher_update.proto") .input("proto/pyth_lazer_transaction.proto") .cargo_out_dir("protobuf")