On 8/23/16 1:46 PM, Andrei Alexandrescu wrote:
* In an extra twinge of irony, the link to the package format
specification goes to http://code.dlang.org/package-format?lang=json,
i.e. the JSON format. Which is of course not what "dub init" (which I
duly ran because it was on the getting started page) generated. It was
no source of confusion to me because I had the context, but it may for
others.
json has returned as the default format. Your distribution probably
installed an older dub that used sdl as the default format.
* So I look at the SDL spec and even after I'm done I have no idea where
to specify "I have a package called checkedint, and the only file for it
is ./checkedint/checkedint.d". I do know what I'd need to do if I had
subpackages though.
Typically, the source goes in source. So you want
source/checkedint/checkedint.d (or source/checkedint.d).
* At this point I've read two full pages of documentation and I have no
idea how to (a) define my package for one library with one file in it,
and (b) build it. Literally: no idea.
$ dub init
$ rm source/app.d # this is a library
$ vi source/checkedint.d # or mkdir source/checkedint; vi
source/checkedint/checkedint.d
...
$ dub build
Performing "debug" build using dmd for x86_64.
checkedint ~master: building configuration "library"...
Target is a library. Skipping execution.
$ ls -l
total 40
-rw-r--r--+ 1 steves staff 112 Aug 23 13:55 dub.sdl
-rw-r--r--+ 1 steves staff 39 Aug 23 13:56 dub.selections.json
-rw-r--r--+ 2 steves staff 9548 Aug 23 13:56 libcheckedint.a
drwxr-xr-x+ 3 steves staff 102 Aug 23 13:56 source
* Next thing I want is to unittest the thing. Searching the cmdline
docs, first hit suggests "dub --build=unittest" is the way to go. It
does build, but doesn't run the unittests. Fortunately I keep on
searching and find that "dub test" does what I want.
dub test
is what I usually do.
-Steve