Does anyone have any examples of using nimble for more advanced build configurations?
Things I would like to do:
Also, when I run nimble build, nimble complains that there is "Nothing to build. Did you specify a module to build using the bin key in your .nimble file?". Can this be suppressed? I'm building libraries, so there are no bins. And it is forcing the exit code to be 1 instead of 0.
Cheers!
Things I can't do:
Talking to myself, here. But what the heck.
It doesn't look like I can read a file from nimscript? Is that correct?
This is not correct. readFile and writeFile both work. lines, however, did not, which was the source of my confusion.
But it does leave me with one final problem: How do I abstract out my build scripts so they are usable from multiple packages?
Compile my public nim files to make sure they are all syntactically correct. Again, the hurdle appears to be identifying the files.
If by "public nim files" you mean files exposed for import by other packages, nimble seems to have a rule for this: put all non-public files in a source directory named private.
Model dependencies between targets
It isn't as dynamic as make's, but if it counts as "target dependency modeling" for you, you can use this:
before test:
exec "nimble buildTests"
after is also available.
Extract code from my README and compile it
This could be done in a source file instead of a nims/nimble script by statically reading the README, extracting the source code snippets and building an AST from them via macro. After all, with regular source files, we make the compiler suck them in with import statements and don't piece them together in the build script.
For anyone facing a similar problem, I centralized my build configuration here:
https://github.com/Nycto/ExtraNimble
It does (basically) everything I asked for in this thread above, though I had to do a few hacky things to get it working.