Contracts use polkavm workspace deps (#3715)

This commit is contained in:
PG Herveou
2024-03-15 18:24:38 +01:00
committed by GitHub
parent 4987d79824
commit e8b51f60cc
5 changed files with 19 additions and 57 deletions
Generated
+9 -52
View File
@@ -9573,7 +9573,7 @@ dependencies = [
"anyhow",
"frame-system",
"parity-wasm",
"polkavm-linker 0.5.0",
"polkavm-linker",
"sp-runtime",
"tempfile",
"toml 0.8.8",
@@ -9634,7 +9634,7 @@ dependencies = [
"bitflags 1.3.2",
"parity-scale-codec",
"paste",
"polkavm-derive 0.5.0",
"polkavm-derive",
"scale-info",
]
@@ -13845,7 +13845,7 @@ dependencies = [
"libc",
"log",
"polkavm-assembler",
"polkavm-common 0.9.0",
"polkavm-common",
"polkavm-linux-raw",
]
@@ -13858,12 +13858,6 @@ dependencies = [
"log",
]
[[package]]
name = "polkavm-common"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88b4e215c80fe876147f3d58158d5dfeae7dabdd6047e175af77095b78d0035c"
[[package]]
name = "polkavm-common"
version = "0.9.0"
@@ -13873,16 +13867,6 @@ dependencies = [
"log",
]
[[package]]
name = "polkavm-derive"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6380dbe1fb03ecc74ad55d841cfc75480222d153ba69ddcb00977866cbdabdb8"
dependencies = [
"polkavm-derive-impl 0.5.0",
"syn 2.0.50",
]
[[package]]
name = "polkavm-derive"
version = "0.9.1"
@@ -13892,25 +13876,13 @@ dependencies = [
"polkavm-derive-impl-macro",
]
[[package]]
name = "polkavm-derive-impl"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc8211b3365bbafb2fb32057d68b0e1ca55d079f5cf6f9da9b98079b94b3987d"
dependencies = [
"polkavm-common 0.5.0",
"proc-macro2",
"quote",
"syn 2.0.50",
]
[[package]]
name = "polkavm-derive-impl"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c4fdfc49717fb9a196e74a5d28e0bc764eb394a2c803eb11133a31ac996c60c"
dependencies = [
"polkavm-common 0.9.0",
"polkavm-common",
"proc-macro2",
"quote",
"syn 2.0.50",
@@ -13922,25 +13894,10 @@ version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ba81f7b5faac81e528eb6158a6f3c9e0bb1008e0ffa19653bc8dea925ecb429"
dependencies = [
"polkavm-derive-impl 0.9.0",
"polkavm-derive-impl",
"syn 2.0.50",
]
[[package]]
name = "polkavm-linker"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5a668bb33c7f0b5f4ca91adb1e1e71cf4930fef5e6909f46c2180d65cce37d0"
dependencies = [
"gimli 0.28.0",
"hashbrown 0.14.3",
"log",
"object 0.32.2",
"polkavm-common 0.5.0",
"regalloc2 0.9.3",
"rustc-demangle",
]
[[package]]
name = "polkavm-linker"
version = "0.9.2"
@@ -13951,7 +13908,7 @@ dependencies = [
"hashbrown 0.14.3",
"log",
"object 0.32.2",
"polkavm-common 0.9.0",
"polkavm-common",
"regalloc2 0.9.3",
"rustc-demangle",
]
@@ -18855,7 +18812,7 @@ dependencies = [
"libsecp256k1",
"log",
"parity-scale-codec",
"polkavm-derive 0.9.1",
"polkavm-derive",
"rustversion",
"secp256k1",
"sp-core",
@@ -19047,7 +19004,7 @@ dependencies = [
"bytes",
"impl-trait-for-tuples",
"parity-scale-codec",
"polkavm-derive 0.9.1",
"polkavm-derive",
"primitive-types",
"rustversion",
"sp-core",
@@ -20069,7 +20026,7 @@ dependencies = [
"console",
"filetime",
"parity-wasm",
"polkavm-linker 0.9.2",
"polkavm-linker",
"sp-maybe-compressed-blob",
"strum 0.24.1",
"tempfile",
@@ -20,7 +20,7 @@ parity-wasm = "0.45.0"
tempfile = "3.8.1"
toml = "0.8.2"
twox-hash = "1.6.3"
polkavm-linker = { version = "0.5.0", optional = true }
polkavm-linker = { workspace = true, optional = true }
anyhow = "1.0.0"
[features]
+6 -1
View File
@@ -121,9 +121,11 @@ fn collect_entries(contracts_dir: &Path, out_dir: &Path) -> Vec<Entry> {
/// Create a `Cargo.toml` to compile the given contract entries.
fn create_cargo_toml<'a>(
fixtures_dir: &Path,
root_cargo_toml: &Path,
entries: impl Iterator<Item = &'a Entry>,
output_dir: &Path,
) -> Result<()> {
let root_toml: toml::Value = toml::from_str(&fs::read_to_string(root_cargo_toml)?)?;
let mut cargo_toml: toml::Value = toml::from_str(include_str!("./build/Cargo.toml"))?;
let mut set_dep = |name, path| -> Result<()> {
cargo_toml["dependencies"][name]["path"] = toml::Value::String(
@@ -133,6 +135,8 @@ fn create_cargo_toml<'a>(
};
set_dep("uapi", "../uapi")?;
set_dep("common", "./contracts/common")?;
cargo_toml["dependencies"]["polkavm-derive"]["version"] =
root_toml["workspace"]["dependencies"]["polkavm-derive"].clone();
cargo_toml["bin"] = toml::Value::Array(
entries
@@ -324,6 +328,7 @@ fn main() -> Result<()> {
let contracts_dir = fixtures_dir.join("contracts");
let out_dir: PathBuf = env::var("OUT_DIR")?.into();
let workspace_root = find_workspace_root(&fixtures_dir).expect("workspace root exists; qed");
let root_cargo_toml = workspace_root.join("Cargo.toml");
let entries = collect_entries(&contracts_dir, &out_dir);
if entries.is_empty() {
@@ -333,7 +338,7 @@ fn main() -> Result<()> {
let tmp_dir = tempfile::tempdir()?;
let tmp_dir_path = tmp_dir.path();
create_cargo_toml(&fixtures_dir, entries.iter(), tmp_dir.path())?;
create_cargo_toml(&fixtures_dir, &root_cargo_toml, entries.iter(), tmp_dir.path())?;
invoke_cargo_fmt(
&workspace_root.join(".rustfmt.toml"),
entries.iter().map(|entry| &entry.path as _),
@@ -6,11 +6,11 @@ edition = "2021"
# Binary targets are injected dynamically by the build script.
[[bin]]
# local path are injected dynamically by the build script.
# All paths or versions are injected dynamically by the build script.
[dependencies]
uapi = { package = 'pallet-contracts-uapi', path = "", default-features = false }
common = { package = 'pallet-contracts-fixtures-common', path = "" }
polkavm-derive = '0.5.0'
polkavm-derive = { version = "" }
[profile.release]
opt-level = 3
+1 -1
View File
@@ -21,7 +21,7 @@ scale = { package = "parity-scale-codec", version = "3.6.1", default-features =
], optional = true }
[target.'cfg(target_arch = "riscv32")'.dependencies]
polkavm-derive = '0.5.0'
polkavm-derive = { workspace = true }
[package.metadata.docs.rs]
default-target = ["wasm32-unknown-unknown"]