gear-wasm-builder is fine for a single contract, but it becomes a real problem for big workspaces like gear-foundation/dapps. And there's also a lot of other small issues that can be considered reasons to completely replace it with another solution.
For each contract, Cargo builds a separate executable with a build script, and since gear-wasm-builder isn't very lightweight, almost every one of them turns out to be a couple dozen megabytes. In case of the dapps repo, they consume around 9 gigabytes of storage out of 16 gigabytes of the build cache after a clean repo clone & cargo c, and with code changes, they can take even more storage.
gear-wasm-builder runs on each check & compiles only in the release mode. Thus, even on a change of one line of code, gear-wasm-builder forcibly recompiles a contract before letting Cargo do a check. Yes, we have the __GEAR_WASM_BUILDER_NO_BUILD environment variable, but because it disables all gear-wasm-builder's checks, this isn't a really good solution.
gear-wasm-builder doesn't work well with rust-analyzer because it can't parse compilation errors from the build script output.
For some reason, gear-wasm-builder doesn't use all CPU while performing a build.
Build scripts aren't really convenient for a customization because the only way to pass some arguments to them is through environment variables or a code change & recompilation.
.binpath files like any build artifacts shouldn't be placed anywhere except the target directory. I managed to move *.meta.txts to it, but .binpath is trickier since it's used by gtest.
So, in overall, the current solution for the contract building is very heavy & slow. I suppose some of these issues can be fixed pretty easily, but I really wish there'd be a more elegant
Possible Solution
like cargo-contract. Actually @shamilsan worked on a similar tool: cargo-program - but it was abandoned. I propose to revive this project & try to fix all the issues above by not repeating them in it & switching to it.
Problem to Solve
gear-wasm-builder
is fine for a single contract, but it becomes a real problem for big workspaces like gear-foundation/dapps. And there's also a lot of other small issues that can be considered reasons to completely replace it with another solution.gear-wasm-builder
isn't very lightweight, almost every one of them turns out to be a couple dozen megabytes. In case of thedapps
repo, they consume around 9 gigabytes of storage out of 16 gigabytes of the build cache after a clean repo clone &cargo c
, and with code changes, they can take even more storage.gear-wasm-builder
runs on each check & compiles only in the release mode. Thus, even on a change of one line of code,gear-wasm-builder
forcibly recompiles a contract before letting Cargo do a check. Yes, we have the__GEAR_WASM_BUILDER_NO_BUILD
environment variable, but because it disables allgear-wasm-builder
's checks, this isn't a really good solution.gear-wasm-builder
doesn't work well withrust-analyzer
because it can't parse compilation errors from the build script output.gear-wasm-builder
doesn't use all CPU while performing a build..binpath
files like any build artifacts shouldn't be placed anywhere except thetarget
directory. I managed to move*.meta.txt
s to it, but.binpath
is trickier since it's used bygtest
.So, in overall, the current solution for the contract building is very heavy & slow. I suppose some of these issues can be fixed pretty easily, but I really wish there'd be a more elegant
Possible Solution
like cargo-contract. Actually @shamilsan worked on a similar tool: cargo-program - but it was abandoned. I propose to revive this project & try to fix all the issues above by not repeating them in it & switching to it.
Notes
No response