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

feat(wasm-builder): Another approach to build demos #3837

Closed
wants to merge 6 commits into from
Closed
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
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[alias]
gear = "run -p cargo-gear -- gear"
116 changes: 112 additions & 4 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions examples/async-init/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ license.workspace = true
homepage.workspace = true
repository.workspace = true

[package.metadata.cargo-gear]

[dependencies]
gstd.workspace = true
parity-scale-codec.workspace = true
Expand Down
2 changes: 2 additions & 0 deletions examples/ping/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ license.workspace = true
homepage.workspace = true
repository.workspace = true

[package.metadata.cargo-gear]

[dependencies]
gstd.workspace = true

Expand Down
126 changes: 63 additions & 63 deletions pallets/gear/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ sp-externalities.workspace = true
pallet-balances.workspace = true
pallet-authorship.workspace = true
pallet-timestamp.workspace = true
sp-consensus-babe = { workspace = true, optional = true}
sp-consensus-babe = { workspace = true, optional = true }

# Benchmark deps
gear-sandbox = { workspace = true, optional = true }
Expand Down Expand Up @@ -130,70 +130,70 @@ gmeta.workspace = true
[features]
default = ['std']
std = [
"parity-scale-codec/std",
"env_logger",
"log/std",
"common/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-support-test/std",
"frame-system/std",
"gear-wasm-instrument/std",
"scopeguard/use_std",
"core-processor/std",
"gear-core-backend/std",
"gear-lazy-pages-interface/std",
"scale-info/std",
"sp-io/std",
"sp-std/std",
"sp-core/std",
"sp-runtime/std",
"sp-externalities/std",
"pallet-balances/std",
"pallet-authorship/std",
"pallet-gear-gas/std",
"pallet-gear-messenger/std",
"pallet-gear-scheduler/std",
"pallet-gear-program/std",
"pallet-gear-voucher/std",
"pallet-gear-bank/std",
"pallet-gear-proc-macro/full",
"primitive-types/std",
"serde/std",
"sp-consensus-babe/std",
"test-syscalls?/std",
"demo-read-big-state?/std",
"demo-proxy?/std",
"demo-reserve-gas?/std",
"demo-delayed-sender?/std",
"demo-constructor?/std",
"demo-waiter?/std",
"demo-init-wait?/std",
"demo-signal-entry?/std",
"gear-runtime-interface/std",
"parity-scale-codec/std",
"env_logger",
"log/std",
"common/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-support-test/std",
"frame-system/std",
"gear-wasm-instrument/std",
"scopeguard/use_std",
"core-processor/std",
"gear-core-backend/std",
"gear-lazy-pages-interface/std",
"scale-info/std",
"sp-io/std",
"sp-std/std",
"sp-core/std",
"sp-runtime/std",
"sp-externalities/std",
"pallet-balances/std",
"pallet-authorship/std",
"pallet-gear-gas/std",
"pallet-gear-messenger/std",
"pallet-gear-scheduler/std",
"pallet-gear-program/std",
"pallet-gear-voucher/std",
"pallet-gear-bank/std",
"pallet-gear-proc-macro/full",
"primitive-types/std",
"serde/std",
"sp-consensus-babe/std",
"test-syscalls?/std",
"demo-read-big-state?/std",
"demo-proxy?/std",
"demo-reserve-gas?/std",
"demo-delayed-sender?/std",
"demo-constructor?/std",
"demo-waiter?/std",
"demo-init-wait?/std",
"demo-signal-entry?/std",
"gear-runtime-interface/std",
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"common/runtime-benchmarks",
"gear-core-backend/mock",
"gear-core-errors/codec",
"gear-sandbox",
"sp-consensus-slots",
"sp-consensus-babe",
"rand",
"rand_pcg",
"test-syscalls/wasm-wrapper",
"demo-read-big-state/wasm-wrapper",
"demo-proxy/wasm-wrapper",
"gsys",
"demo-reserve-gas/wasm-wrapper",
"demo-delayed-sender/wasm-wrapper",
"demo-constructor/wasm-wrapper",
"demo-waiter/wasm-wrapper",
"demo-init-wait/wasm-wrapper",
"demo-signal-entry/wasm-wrapper",
"frame-benchmarking/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"common/runtime-benchmarks",
"gear-core-backend/mock",
"gear-core-errors/codec",
"gear-sandbox",
"sp-consensus-slots",
"sp-consensus-babe",
"rand",
"rand_pcg",
"test-syscalls/wasm-wrapper",
"demo-read-big-state/wasm-wrapper",
"demo-proxy/wasm-wrapper",
"gsys",
"demo-reserve-gas/wasm-wrapper",
"demo-delayed-sender/wasm-wrapper",
"demo-constructor/wasm-wrapper",
"demo-waiter/wasm-wrapper",
"demo-init-wait/wasm-wrapper",
"demo-signal-entry/wasm-wrapper",
]
runtime-benchmarks-checkers = []
try-runtime = ["frame-support/try-runtime"]
Expand Down
39 changes: 39 additions & 0 deletions pallets/gear/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// This file is part of Gear.
//
// Copyright (C) 2024 Gear Technologies Inc.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

use std::env;

fn is_intellij_sync() -> bool {
env::var("RUSTC_WRAPPER")
.unwrap_or_default()
.contains("intellij")
}

fn main() {
let wasm_built = env::var("__GEAR_WASM_BUILT").as_deref() == Ok("1");

if wasm_built || is_intellij_sync() {
println!("cargo:rustc-cfg=cargo_gear");
}

if wasm_built {
if let Ok(path) = env::var("__GEAR_WASM_TARGET_DIR") {
println!("cargo:rustc-env=__GEAR_WASM_TARGET_DIR={path}");
}
}
}
Loading
Loading