pietroppeter / nimibook

A port of mdbook to nim(ib)
https://pietroppeter.github.io/nimibook/
MIT License
77 stars 7 forks source link

Debug builds #49

Closed HugoGranstrom closed 2 years ago

HugoGranstrom commented 2 years ago

As it is now nimiBook will always run the files in -d:release mode (https://github.com/pietroppeter/nimibook/blob/81733b417ebb4dd5a9d72f59e007084b5ca015b5/src/nimibook/publishers.nim#L8), but it also means that if a program fails to run we don't get any useful stacktraces or debugging information. This is especially cumbersome in a CI where it just tells you that it has failed, but not what have failed. So having the option to build in debug-mode would be very useful. My current workaround is changing the linked line manually on my local installation, but that's not a feasible solution.

Proposed solutions:

Any thoughts on this?

pietroppeter commented 2 years ago
HugoGranstrom commented 2 years ago

locally you should be able to have full control on how to compile a single file using directly nim r and the args you want

This is exactly what I want to avoid actually, because of reproducibility. The other day we got an error on the CI but we had problems replicating it locally. If we could have seen the debug error messages directly in the CI it would have saved us much time.

in general I think we should have the possibility to reset build default arguments (either with a new command or with a special option) and pass new ones. ideally you might want to have a mechanism where override/customize arguments for each specific file/folder you build.

Agreed! Some simple files probably take more time to compile with release than they take to run with debug, so using debug could probably speed up things if done for those files.

incidentally looking at the default list of arguments I am wondering if -f is a good default argument

That does indeed sound very wasteful of time, I can't remember the rationale for introducing it in the first case 🤔 Feels like it had something to do with CI somehow 🤣

pietroppeter commented 2 years ago

one option would be to remove all default arguments and pass all additional arguments received (so that we do not have to think of an option name to reset default arguments). In particular to reproduce current build one would call nbook build -d:release -f --verbosity:0 --hints:off.

HugoGranstrom commented 2 years ago

That does sound like a good solution to me :) Then it's very obvious which flags are passed as well, now you have to dig in the nimiBook source code to find them

pietroppeter commented 2 years ago

fixed in #50