Nazariglez / notan

Cross-platform multimedia layer
https://nazariglez.github.io/notan-web/
Apache License 2.0
802 stars 55 forks source link

Moved the scripts used for example and doc building to xtask #321

Closed Rzial closed 3 months ago

Rzial commented 6 months ago

This PR handles #319 and allows to handle cross-platform compilation without major overhead in terms of script maintenance.

For now I've only added the building scripts but we may add the others in the future:

I've tested Windows on MSVC and Web targets and it works pretty fine. Seems the same for Linux but I would like some external confirmation since is not my main dev scene for Notan and I might had some overlook.

P.S.: This is one of my firsts Rust code contributions so there may be some flaws in codewritting/codestyle. If there is any feedback I'm open to it 😄

Nazariglez commented 6 months ago

Hey! I was out for a few days (Spain holidays), let me settle and I'll come back to this in a few days! thanks!

Nazariglez commented 6 months ago

This is pretty nice, I love the cargo xtask example web. However I think I am doing something wrong, if I do in the develop branch: ./scripts/build_examples.sh then I can do http-server ./docs and I see the index with all the examples linked. When I do the xtask then the ./docs folder has the examples under a subdirectory docs/web_examples/release/examples, and no index. I am on a new machine so I am probably missing something.

Something that I saw is that if you don't have wasm-bindgen-cli and wasm-opt installed then the task succeed but without output files. This is fine though, we can add to the readme this (this deps are needed for the bash script too), although eventually would be cool to have an error if the deps are not there.

Rzial commented 6 months ago

Hmm 🤔

For me, when i execute cargo xtask examples web it outputs an index.html at the root of the docs/web_examples/release folder. Maybe there is something related to paths?

Can you check which output gives to you the value in xtask/src/cli_examples_web.rs:58?

docs_web_dir(release, "").join("index.html")

About checking if some of the tools are available when trying to compile, thats something I can totally do.

P.S: I took the decision to move everything related to examples from `./docs/HERE to ./docs/TARGET_examples/HERE being TARGET values like msvc and web. The reason behind this is because we you do both tests you get a lot of mixed up files that are not really related. I can revert this if its not desired.

Nazariglez commented 3 months ago

Hey @Rzial, sorry for the delay (once again). The web build command is used to generate this: https://github.com/Nazariglez/notan-web/tree/main/docs, which is the examples page online, so the output should matches that structure. I made some minor changes (mainly directory changes and clippy fixes) and rebased from develop to keep the branch updated.

I hope this is fine with you. Thanks you so much for allocating the time and the effort to make this!