Am 21.02.2014 09:31, schrieb simendsjo:
I'm having problems understanding how to create multiple packages.
Running dub master.Here I have a project
a
which creates a binary, and I have projectb
that relies on that binary.
When buildingb
, it states "no source files". I'm guessing it refers toa
. Is this a bug..? Or what is happening here?And if I look at
a
,dub build
has not been run. Doesn't dependencies in dub build the packages?Also.. How can I refer to the location of the package
a
? I know it produces a binary (well, hopefully once I sort this out), and I wish to copy this binary to my project. I see thepreBuildCommands
and$PACKAGE_DIR
, but how can I get the$PACKAGE_DIR
ofa
? The best thing would be if I could reference thetargetName
ofa
directly, so mypreBuildCommands
could copy$(TARGET_NAME a)
tob
s directory. After all,a
is a dependency ofb
, anda
has atargetType
to create an executable.Any tips on how this should be structured?
In
b/dub.json
below (thee dub.json
line), I added"a" : "~master"
as a dependency.➜ test dub init a Successfully created an empty project in '/home/simendsjo/code/d/dtutorials/test/a'. ➜ test dub init b Successfully created an empty project in '/home/simendsjo/code/d/dtutorials/test/b'. ➜ test cd b ➜ b e dub.json ➜ b dub add-local ../a "~master" Registered package: a (version: ~master) ➜ b dub build Package a contains no source files. Please add {"targetType": "none"} to it's package description to avoid building it. b: ["b", "a"] Building b configuration "application", build type debug. Compiling... Linking... ➜ b ./b Edit source/app.d to start your project. ➜ b
Executable dependencies are not yet properly supported. It's planned to
allow this by specifying the proper sub configuration (i.e. "subConfigurations": {"a": "application"}
, though. The best workaround
for now is to add a "preGenerateCommand" or "preBuildCommand" that
executes dub run a -- <args>
.