On Tuesday, 12 April 2016 at 07:17:05 UTC, Jon D wrote:
On Tuesday, 12 April 2016 at 06:22:55 UTC, Puming wrote:
On Tuesday, 12 April 2016 at 00:50:24 UTC, Jon D wrote:
Hi all,
I've open sourced a set of command line utilities for
manipulating tab-separated value files. They are
complementary to traditional unix tools like cut, grep, etc.
They're useful for manipulating large data files. I use them
when prepping files for R and similar tools. These tools were
part of my 'explore D' programming exercises.
[...]
Interesting, I have large csv files, and this lib will be
useful.
Can you put it onto code.dlang.org so that we could use it
with dub?
I'd certainly like to make it available via dub, but I wasn't
sure how to set it up. There are two issues. One is that the
package builds multiple executables, which dub doesn't seem to
support easily. More problematic is that quite a bit of the
test suite is run against the executables, which I could
automate using make, but didn't see how to do it with dub.
If there are suggestions for setting this up in dub that'd be
great. An example project doing something similar would be
really helpful.
--Jon
Here is what I know of it, using subPackages:
Say you have a project named myapp, and you need three
executables, app1, app2, app3, they all depend on a common code
base, which you name it common.
Using dub, you can have a parent project myapp, that does nothing
but is a container of the three apps and their common code.
dub.sdl in myapp dir:
```
name "myapp"
dependency ":common" version="*"
subPackage "./common/"
dependency ":app1" version="*"
subPackage "./app1/"
dependency ":app2" version="*"
subPackage "./app2/"
dependency ":app3" version="*"
subPackage "./app3/"
```
the comma in dependency name ":common" is equal to "myapp:common"
now use `dub init common` and the like to create subdirectories.
change dub.sdl in the subdirectory common so that it becomes a
library type:
```
name "common"
targetType "library"
```
change dub.sdl in myapp* subdirectories to depend on common:
```
name "app1"
targetType "executable"
dependency "myapp:common" version="*"
```
note here you need to add root project name "myapp:common".
Then you should register your whole project into the local dub
repo, so that subpackages can find its dependencies when building:
in the project root directory:
dub add-local .
Now you can build each executable with:
dub build :app1
dub build :app2
dub build :app3
Unfortunately dub does not build all sub packages at once when
you dub in the root directory.
But I think there might be a better way to handle multiple
executables?