Skip to content

fix(lazer-publisher-sdk): Symlink proto files for Cargo Publish #2583

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions lazer/publisher_sdk/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ protobuf = "3.7.2"

[build-dependencies]
protobuf-codegen = "3.7.2"

11 changes: 6 additions & 5 deletions lazer/publisher_sdk/rust/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ 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/");
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") // symlinked proto folder. Actual fiels are in ../proto
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

.input("proto/publisher_update.proto")
.input("proto/pyth_lazer_transaction.proto")
.cargo_out_dir("protobuf")
.run_from_script();

Expand Down
1 change: 1 addition & 0 deletions lazer/publisher_sdk/rust/proto
Loading