Building custom library package with dub
alexander1974 via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Aug 24 04:03:54 PDT 2017
On Saturday, 18 March 2017 at 13:47:34 UTC, alex1974 wrote:
> On Saturday, 18 March 2017 at 13:41:12 UTC, Mike Parker wrote:
>> On Saturday, 18 March 2017 at 12:49:33 UTC, alex1974 wrote:
>>
>>>
>>> This simple layout works, but then all parts will be compiled
>>> every time. Is there a way to just compile the "sublibraries"
>>> which have changed?
>>
>> By "compiled every time", if you're talking about when using
>> the library as a dependency, that's not quite true. dub will
>> compile dependencies on the first run, then only in specific
>> scenarios, not every time. It's really not a big deal. Take a
>> look at dlib [1], for example. On big monolithic library and I
>> haven't seen anyone complaining.
>>
>> But if you really want to, take a look at subpackages[2] in
>> the dub docs.
>>
>> [1] https://github.com/gecko0307/dlib
>> [2]
>> https://code.dlang.org/package-format?lang=json#sub-packages
>
> Actually the compiling is fast. But its confusing, that all
> unittests from all sublibraries are performed every time.
> I thought with subpackages I can perform just the test from the
> part I'm working on.
> But I can't get the right layout for the subpackages.
My folder structure looks like
extensions/
dub.sdl
regex/
dub.sdl
source/
regex.d
files/
dub.sdl
source/
package.d
commons.d
fileexceptions.d
...
the main dub.sdl under extensions/:
dependency "extensions:regex" version="*"
subPackage "./regex/"
dependency "extensions:path" version="*"
subPackage "./path/"
dependency "extensions:files" version="*"
subPackage "./files/"
dependency "extensions:ranges" version="*"
subPackage "./ranges/"
dependency "extensions:arrays" version="*"
subPackage "./arrays/"
dependency "extensions:types" version="*"
subPackage "./types/"
eg regex/dub.sdl:
name "regex"
targetType "library"
"simple" subpackages, like extensions:regex, compile fine with
dub build extensions:regex
but subpackages containing several files won't, like
dub build extensions:files
Also reffering to them from external projects don't work.
Any ideas?
More information about the Digitalmars-d-learn
mailing list