gear-tech / sails

Apache License 2.0
8 stars 3 forks source link

Use only one crate per program #354

Closed webtransportbot closed 1 day ago

webtransportbot commented 2 weeks ago

Problem to Solve

The current solution requires creating two crates for a single program:

The wasm crate is mostly boilerplate code, it would simplify the project structure if only one crate is needed per project

Possible Solution

Generate and build the wasm crate in app's build.rs script

Notes

No response

DennisInSky commented 2 weeks ago

@webtransportbot the reason of the presence of the second trait is that it is mainly not for building the resulting WASM, but for generating IDL file which requires a crate with all services/program built. If the latter is not needed, then the second crate can be removed. Another possible solution of having a single crate is building the app crate using different targets, i.e. it can be built as cdylib for wasm32 and a regular binary for native targets. The latter can output IDL and can be executed as a part of build pipeline should the IDL is required