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

fix(gear-wasm-builder): Support 1.79.0 nightly #3923

Merged
merged 3 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
ukint-vs marked this conversation as resolved.
Show resolved Hide resolved
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
Loading