Skip to content
This repository has been archived by the owner on Dec 11, 2024. It is now read-only.

build.rs: make wasm-ast root configurable with an env-var #79

Merged
merged 1 commit into from
Sep 10, 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-wasm-rpc-1.0.2/build.rs:29: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 `arbitrary` as a dependency of package `golem-wasm-rpc v1.0.2 (/build/cargo-vendor-dir/golem-wasm-rpc-1.0.2)`

Caused by:
  failed to load source for dependency `arbitrary`
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-examples: golemcloud/golem-examples#65

@marijanp marijanp requested a review from vigoo September 10, 2024 10:04
@vigoo vigoo merged commit e293963 into golemcloud:main Sep 10, 2024
2 checks passed
@marijanp marijanp deleted the ast-root-env-var branch September 10, 2024 13:45
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