Skip to content
This repository has been archived by the owner on May 25, 2023. It is now read-only.

remove cargo env var and improve code gen #38

Merged
merged 5 commits into from
May 8, 2023

Conversation

SuperFluffy
Copy link
Member

It turns out that environment variables set inside .cargo/config are only seen by cargo if ran from the same workspace. The env vars are not seen if another 3rd crate imports this as a dependency, leading to compilation errors, leading to errors like:

error: environment variable `CARGO_WORKSPACE_DIR` not defined at compile time
 --> /home/runner/.cargo/git/checkouts/sequencer-relayer-8e1835a068793f96/a0172d3/sequencer-relayer/build.rs:3:38
  |
3 |     const PROTO_ROOT: &str = concat!(env!("CARGO_WORKSPACE_DIR"), "/proto/");
  |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: Cargo sets build script variables at run time. Use `std::env::var("CARGO_WORKSPACE_DIR")` instead
  = note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)

Since there are other ways to solve this issue this config was removed in favor of:

  1. creating a new crate sequencer-relayer-proto that owns the protobuf definitions and takes care of the rust codegen for protobuf;
  2. moving the kubernetes yaml files into sequencer-relayer-test because that is were the files are used (nice extra: test-environment.yml is now generated from a test; as the main entry point for the integration tests it is now protected by CI).

@SuperFluffy SuperFluffy requested a review from noot May 8, 2023 13:38
Copy link
Collaborator

@noot noot left a comment

Choose a reason for hiding this comment

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

fixed my issue, thanks!!

@noot noot merged commit de602be into master May 8, 2023
@noot noot deleted the superfluffy/fix-cargo-env-var branch May 8, 2023 18:25
steezeburger added a commit that referenced this pull request May 8, 2023
* master:
  remove cargo env var and improve code gen (#38)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants