Skip to content

Commit

Permalink
fix(gear-wasm-builder): Support 1.79.0 nightly (#3923)
Browse files Browse the repository at this point in the history
  • Loading branch information
ukint-vs authored Apr 25, 2024
1 parent 5cf5f39 commit 1473560
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -454,11 +454,12 @@ libfuzzer-sys = "0.4" # util
page_size = { version = "0.6", default-features = false } # pallets/gear
pathdiff = { version = "0.2.1", default-features = false } # utils/wasm-builder
rand_pcg = "0.3.1" # pallets/gear
rustc_version = "0.4.0" # utils/wasm-builder
schnorrkel = "0.9.1" # gcli
scopeguard = { version = "1.2.0", default-features = false } # pallets/gear
tabled = "0.10.0" # utils/regression-analysis
thousands = "0.2.0" # utils/regression-analysis
toml = "0.8.12" # utils/wasm-builder
toml = "0.8.12" # utils/wasm-builder
tracing = "0.1.40" # utils/node-loader
tracing-appender = "0.2" # utils/node-loader
tracing-subscriber = "0.3.18" # utils/node-loader
Expand Down
1 change: 1 addition & 0 deletions utils/wasm-builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ gear-wasm-instrument.workspace = true
wasm-opt = { workspace = true, optional = true }
wasmparser.workspace = true
regex.workspace = true
rustc_version.workspace = true

[dev-dependencies]
wabt.workspace = true
Expand Down
12 changes: 11 additions & 1 deletion utils/wasm-builder/src/crate_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,21 @@ impl CrateInfo {
//
// see also https://doc.rust-lang.org/reference/linkage.html
let validated_lib = |ty: &String| ty == "lib" || ty == "rlib";
let pkg_snake_case_name = pkg.name.replace('-', "_");

// Check for rustc version. See https://github.com/rust-lang/cargo/pull/12783
let compatible = rustc_version::version()?.lt(&rustc_version::Version::parse("1.79.0")?);

let _ = pkg
.targets
.iter()
.find(|target| {
target.name.eq(&pkg.name) && target.crate_types.iter().any(validated_lib)
if compatible {
target.name.eq(&pkg.name) && target.crate_types.iter().any(validated_lib)
} else {
target.name.eq(&pkg_snake_case_name)
&& target.crate_types.iter().any(validated_lib)
}
})
.ok_or(BuilderError::CrateTypeInvalid)?;

Expand Down

0 comments on commit 1473560

Please sign in to comment.