Skip to content
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

build.rs: make WIT root configurable with an env-var #65

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

marijanp
Copy link
Contributor

@marijanp marijanp commented Sep 6, 2024

In a sandboxed build environment, cargo metadata tries to query crates.io. Even though I have been trying to pass --offline or frozen, I ran into an exception:

golem>   thread 'main' panicked at /build/cargo-vendor-dir/golem-examples-1.0.4/build.rs:30:10:
golem>   called `Result::unwrap()` on an `Err` value: CargoMetadata { stderr: "warning: `/build/cargo-vendor-dir/.cargo/config` is deprecated in favor of `config.toml`
note: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
warning: `/build/.cargo/config` is deprecated in favor of `config.toml`
note: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
error: failed to get `Inflector` as a dependency of package `golem-examples v1.0.4 (/build/cargo-vendor-dir/golem-examples-1.0.4)`

Caused by:
  failed to load source for dependency `Inflector`

Caused by:
  Unable to update registry `crates-io`
Caused by:
  failed to update replaced source registry `crates-io`

Caused by:
  failed to read root of directory source: /build/cargo-vendor-dir/cargo-vendor-dir

Caused by:
  No such file or directory (os error 2)
" }

I want to propose a way to inject the location of the crate by setting an environment variable. If the environment variable is not set, we default to use cargo metadata

An analogous solution was implemented for golem-wasm-rpc: golemcloud/wasm-rpc#79

@vigoo vigoo merged commit ddb7a85 into golemcloud:main Sep 20, 2024
2 checks passed
@marijanp marijanp deleted the wit-root-env-var branch September 20, 2024 08:52
@marijanp marijanp restored the wit-root-env-var branch September 20, 2024 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants