-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add derive of
bon::Builder
for build and build_extended Opts
- Loading branch information
dj8yf0μl
committed
Oct 3, 2024
1 parent
e135aaf
commit d9abdcc
Showing
7 changed files
with
49 additions
and
6 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
/// additional argument of [build](crate::build) function, wrapped in an `Option` | ||
#[derive(Debug, Clone)] | ||
#[derive(Debug, Clone, bon::Builder)] | ||
pub struct Opts { | ||
/// override value of [crate::env_keys::nep330::CONTRACT_PATH] environment variable | ||
#[builder(into)] | ||
pub nep330_contract_path: Option<String>, | ||
/// override value of [crate::env_keys::nep330::CARGO_TARGET_DIR] environment variable, | ||
/// override value of [crate::env_keys::CARGO_TARGET_DIR] environment variable, | ||
/// which is required to avoid deadlock <https://github.com/rust-lang/cargo/issues/8938> in context of nested (cargo) build | ||
/// in build-script; | ||
/// | ||
/// should best be a subfolder of [crate::env_keys::nep330::CARGO_TARGET_DIR] | ||
/// should best be a subfolder of [crate::env_keys::CARGO_TARGET_DIR] | ||
/// of crate being built to work normally | ||
#[builder(into)] | ||
pub cargo_target_dir: Option<String>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 5 additions & 1 deletion
6
cargo-near-build/src/types/near/build_extended/build_script.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,26 @@ | ||
#[derive(Debug, Clone)] | ||
#[derive(Debug, Clone, bon::Builder)] | ||
pub struct Opts { | ||
/// environment variable name to export result `*.wasm` path to with [`cargo::rustc-env=`](https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-env) | ||
/// instruction | ||
#[builder(into)] | ||
pub result_env_key: Option<String>, | ||
/// list of paths for [`cargo::rerun-if-changed=`](https://doc.rust-lang.org/cargo/reference/build-scripts.html#rerun-if-changed) | ||
/// instruction | ||
/// | ||
/// if relative, it's relative to path of crate, where build.rs is compiled | ||
#[builder(default)] | ||
pub rerun_if_changed_list: Vec<String>, | ||
/// vector of key-value pairs of environment variable name and its value, | ||
/// when compilation should be skipped on a variable's value match; | ||
/// e.g. | ||
/// skipping emitting output `*.wasm` may be helpful when `PROFILE` is equal to `debug` | ||
/// for using `rust-analyzer/flycheck`, `cargo check`, `bacon` and other dev-tools | ||
#[builder(default)] | ||
pub build_skipped_when_env_is: Vec<(String, String)>, | ||
/// path of stub file, where a placeholder empty `wasm` output is emitted to, when | ||
/// build is skipped due to match in [`Self::build_skipped_when_env_is`] | ||
/// | ||
/// if this path is relative, then the base is [`crate::extended::BuildOptsExtended::workdir`] | ||
#[builder(into)] | ||
pub stub_path: Option<String>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters