What's the proper way to add a local file dependence to dub?

Martin Tschierschke mt at smartdolphin.de
Mon Mar 12 09:38:41 UTC 2018


On Sunday, 4 March 2018 at 16:46:56 UTC, Marc wrote:
> then copy it to sources folder?
>
> let's say I have a small library folder at C:\mylibrary\D where 
> I want to use dir.d from it. How do I add that file dependence 
> to dub? But I do not want to that file be passed directly to 
> dmd, I want to that file be copied to application's source 
> folder (so it's easy to distribuite, with the dependences 
> together as possible) then compiled. So, what I want to some 
> extension is dub work with loca files.
> Is this possible to do solely with dub? I know I can easily 
> write a script to run before dub which copies the dependence 
> files from C:\mylibrary to application's source but I'm looking 
> for a more elegant
>  approach as possible; I'm afraid of rewriting a makefile-like 
> soon (I find cmake/make/makefiles just ugly).

I did it this sway:
the part of dub.json:
"dependencies": {

                 "diet-ng": "~>1.4",
                 "vibe-d:tls": "~>0.8.0",
                 "vibe-d:http": "~>0.8",
                 "mysql-d": "~>0.3",
                 "mylib":{
                         "versions": "~master",
                         "path": "/home/mt/d/mylib"
                 }
},

In spite of using a version directly after the used lib,
you give two parameters

   "versions" : "~master"

and

   "path": "/path_to_your_lib/"

Works well.




More information about the Digitalmars-d-learn mailing list