Is there a way in nimble to specify multiple artifacts, each one having its own set of configuration and dependencies?
A typical example would be testing libraries. One would have the library itself, with its set of dependencies, and the test executable, which would require the library but also additional dependencies (for instance https://github.com/rbmz/stopwatch to benchmark the library, or https://github.com/jyapayne/einheit in place of unittest). One usually does not want the testing libraries to become dependencies of the library itself.
Not exactly what I was talking about. Actually I do not even use nimble globally for anything (other than nimble itself). I only use nimble to manage dependencies per project. This ensures that everything I build has a well defined set of dependencies, and that building a project is reproducible on other machines (at least for the Nim part - there are of course issues for the C dependencies).
So, say I am developing the library Foo, and that I want to use einheit to test Foo. Foo itself will have its set of dependencies, and I plan to publish Foo on the official package list. But I also need to test Foo, and to do that I have to build a test executable that, when run, will tell me whether Foo is working as expected. Here I run into a few problems.
I would like to use Nimble to build the test executable, but unfortunately if I tell Nimble that one of the desired binary artifacts is test (via bin = "test"), the clients of Foo will receive that executable when installing Foo, while of course I only want to deploy a library.
My solution so far was to avoid using nimble to build the tests and just run nim c -r test or something like that. This works, as long as the test binary does not need additional dependencies. But say I want to write the tests with einheit. Now, my only option is to build the test with Nimble and add einheit as a dependency. This has the unfortunate result that clients of Foo will also depend on einheit, and the test executable!
So I was hoping that there would be some way to tell Nimble that there are multiple artifacts to build: a library, with its set of dependencies, that will end online, and a test binary, with additional dependencies, that will only be used for local development.
Am I out of chance?
A different .nimble file in the tests directory + a nim.cfg file with a --path:../src/ directive sounds like a good way to do it for now.
Please create an issue in Nimble's github repo if you would like to see something more streamlined. I thought about it for a while and I think that making the creation of another .nimble file mandatory isn't such a bad idea, to get rid of the need for the nim.cfg file I could add support for .. in the dependencies list (to specify that we depend on the package in the parent directory).