Skip to content

Commit

Permalink
fix(nep330): return back fallback vals of CARGO_PKG_REPOSITORY and …
Browse files Browse the repository at this point in the history
…`CARGO_PKG_VERSION`

To avoid problems on older <0.7.0 cargo-near versions
  • Loading branch information
dj8yf0μl committed Jul 5, 2024
1 parent 3b455e7 commit cb3a7d2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions near-sdk-macros/src/core_impl/contract_metadata/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,17 @@ struct Standard {
impl ContractMetadata {
fn populate(mut self) -> Self {
if self.link.is_none() {
let field_val = std::env::var("NEP330_LINK").unwrap_or(String::from(""));
let field_val = std::env::var("NEP330_LINK")
.or(std::env::var("CARGO_PKG_REPOSITORY"))
.unwrap_or(String::from(""));
if !field_val.is_empty() {
self.link = Some(field_val);
}
}
if self.version.is_none() {
let field_val = std::env::var("NEP330_VERSION").unwrap_or(String::from(""));
let field_val = std::env::var("NEP330_VERSION")
.or(std::env::var("CARGO_PKG_VERSION"))
.unwrap_or(String::from(""));
if !field_val.is_empty() {
self.version = Some(field_val);
}
Expand Down

0 comments on commit cb3a7d2

Please sign in to comment.