Reputation: 2091
I have a project that uses dub. I want to use an external file vendored into my project, as a dependency. How do I do this? I don't want to have it in my project's source/
dir. I don't want to add it as a dub managed dependency, but I do want to be able to just import xxx
.
The package is this one: https://github.com/gianm/d-json , it does not use dub or have a dub.json project file.
Upvotes: 1
Views: 406
Reputation: 25595
Alternative thing: make a third_party
directory, put the file in there, then add that to the sourcePaths
in your dub config (you'll probably specify both ["third_party", "source"]
since the default source
will be overridden if you don't list it too.
Upvotes: 2
Reputation: 2091
dub.json
file in the root, with the following contents: {"name": "jsonx"}
. Create a source
folder, and move jsonx.d
into it.dub.json
: "dependencies": {
...
"jsonx": {"path": "../jsonx/"}
}
import jsonx;
.In conclusion, if your app is in a dir called app
, your tree should look like this:
.
├── app
│ ├── dub.json
│ └── source
│ └── myapp.d
└── jsonx
├── dub.json
└── source
└── jsonx.d
Upvotes: 2