RejectedSoftware Forums

Sign up

Conflicting package multi-references

What does the error in the subject mean?

Re: Conflicting package multi-references

On Thu, 20 Feb 2014 11:23:50 GMT, simendsjo wrote:

What does the error in the subject mean?

Some more info.. I'm attempting to use subpackages for the first time for a tutorial I'm making.
The error message is

Checking dependencies in '/home/simendsjo/code/d/dtutorials/test'
Run 'dub help' for usage information.
Checking dependencies in '/home/simendsjo/code/d/dtutorials/test'
Run 'dub help' for usage information.
Checking dependencies in '/home/simendsjo/code/d/dtutorials/test'
The same package is referenced in different paths:
  number-guess ~master: /home/simendsjo/code/d/dtutorials/test
  number-guess ~master: /home/simendsjo/code/d/dtutorials/test
Error: Conflicting package multi-references.

Run 'dub help' for usage information.

And the package.json:

{
    "name"        : "number-guess",
    "description" : "A simple number guessing game",
    "copyright"   : "Copyright © 2014, simendsjo",
    "authors"     : ["simendsjo"],

    "targetType" : "none",

    "dependencies": {
        "number-guess:cli" : "~master",
        "number-guess:web" : "~master"
    },

    "subPackages": [
        {
            "name"        : "cli",
            "targetType"  : "executable",
            "targetName"  : "number-guess",
            "sourcePaths" : ["source/cli"],
        },

        {
            "name"        : "web",
            "targetType"  : "executable",
            "targetName"  : "number-guess-web",
            "sourcePaths" : ["source/web"],
        }
    ]
}

Re: Conflicting package multi-references

On Thu, 20 Feb 2014 11:41:54 GMT, simendsjo wrote:

On Thu, 20 Feb 2014 11:23:50 GMT, simendsjo wrote:

What does the error in the subject mean?

Some more info.. I'm attempting to use subpackages for the first time for a tutorial I'm making.
The error message is

Checking dependencies in '/home/simendsjo/code/d/dtutorials/test'
Run 'dub help' for usage information.
Checking dependencies in '/home/simendsjo/code/d/dtutorials/test'
Run 'dub help' for usage information.
Checking dependencies in '/home/simendsjo/code/d/dtutorials/test'
The same package is referenced in different paths:
  number-guess ~master: /home/simendsjo/code/d/dtutorials/test
  number-guess ~master: /home/simendsjo/code/d/dtutorials/test
Error: Conflicting package multi-references.

Run 'dub help' for usage information.

And the package.json:

{
    "name"        : "number-guess",
    "description" : "A simple number guessing game",
    "copyright"   : "Copyright © 2014, simendsjo",
    "authors"     : ["simendsjo"],

    "targetType" : "none",

    "dependencies": {
        "number-guess:cli" : "~master",
        "number-guess:web" : "~master"
    },

    "subPackages": [
        {
            "name"        : "cli",
            "targetType"  : "executable",
            "targetName"  : "number-guess",
            "sourcePaths" : ["source/cli"],
        },

        {
            "name"        : "web",
            "targetType"  : "executable",
            "targetName"  : "number-guess-web",
            "sourcePaths" : ["source/web"],
        }
    ]
}

I think this particular bug is fixed in the preview versions of 0.9.21 (the error message simply doesn't make sense). But there is a very unfortunate bug/shortcoming right now that still makes this hard to use in conjunction with branches, see #151 for a similar case. This will be fixed in the next release (0.9.22, hopefully a quick one) together with some other shortcomings of the current versioning approach (see this thread). I think it would be best to skip this topic until then (if everything goes well, in about two weeks).

Independent of this issue, I'd personally advise against promoting this particular type of sub modules, because they are quite error prone: Since all source files are located in the same import root, it's easy to accidentally use a sub package that hasn't been explicitly specified as a dependency.

This can result both, in unintended cross references between sub modules, which may be discovered only much later when someone tries to use one of the sub modules in isolation, and it can cause linker errors for users that get the dependencies wrong and it may be hard for them to find the cause.

For that reason, we've added the possibility in 0.9.21 to specify a path to a stand alone package instead:

./dub.json (or legacy "package.json"):

{
  ...
  "subPackages": ["cli/", "web/"]
}

sub modules are then independently stored at ./cli/dub.json and ./web/dub.json and have their own separate source folders.

Sorry for the little mess that this transition currently generates, but I think this will be a very important change to get a clean package ecosystem in the long run.

Re: Conflicting package multi-references

On Thu, 20 Feb 2014 12:16:43 GMT, Sönke Ludwig wrote:

On Thu, 20 Feb 2014 11:41:54 GMT, simendsjo wrote:

On Thu, 20 Feb 2014 11:23:50 GMT, simendsjo wrote:

What does the error in the subject mean?

Some more info.. I'm attempting to use subpackages for the first time for a tutorial I'm making.
The error message is

Checking dependencies in '/home/simendsjo/code/d/dtutorials/test'
Run 'dub help' for usage information.
Checking dependencies in '/home/simendsjo/code/d/dtutorials/test'
Run 'dub help' for usage information.
Checking dependencies in '/home/simendsjo/code/d/dtutorials/test'
The same package is referenced in different paths:
  number-guess ~master: /home/simendsjo/code/d/dtutorials/test
  number-guess ~master: /home/simendsjo/code/d/dtutorials/test
Error: Conflicting package multi-references.

Run 'dub help' for usage information.

And the package.json:

{
    "name"        : "number-guess",
    "description" : "A simple number guessing game",
    "copyright"   : "Copyright © 2014, simendsjo",
    "authors"     : ["simendsjo"],

    "targetType" : "none",

    "dependencies": {
        "number-guess:cli" : "~master",
        "number-guess:web" : "~master"
    },

    "subPackages": [
        {
            "name"        : "cli",
            "targetType"  : "executable",
            "targetName"  : "number-guess",
            "sourcePaths" : ["source/cli"],
        },

        {
            "name"        : "web",
            "targetType"  : "executable",
            "targetName"  : "number-guess-web",
            "sourcePaths" : ["source/web"],
        }
    ]
}

I think this particular bug is fixed in the preview versions of 0.9.21 (the error message simply doesn't make sense). But there is a very unfortunate bug/shortcoming right now that still makes this hard to use in conjunction with branches, see #151 for a similar case. This will be fixed in the next release (0.9.22, hopefully a quick one) together with some other shortcomings of the current versioning approach (see this thread). I think it would be best to skip this topic until then (if everything goes well, in about two weeks).

Independent of this issue, I'd personally advise against promoting this particular type of sub modules, because they are quite error prone: Since all source files are located in the same import root, it's easy to accidentally use a sub package that hasn't been explicitly specified as a dependency.

This can result both, in unintended cross references between sub modules, which may be discovered only much later when someone tries to use one of the sub modules in isolation, and it can cause linker errors for users that get the dependencies wrong and it may be hard for them to find the cause.

For that reason, we've added the possibility in 0.9.21 to specify a path to a stand alone package instead:

./dub.json (or legacy "package.json"):

{
  ...
  "subPackages": ["cli/", "web/"]
}

sub modules are then independently stored at ./cli/dub.json and ./web/dub.json and have their own separate source folders.

Sorry for the little mess that this transition currently generates, but I think this will be a very important change to get a clean package ecosystem in the long run.

Haven't read all your links, but I think I've found a bug in the current git head.

Package 06-number-guess-defensive contains no source files. Please add {"targetType": "none"} to it's package description to avoid building it.

Then adding targetType none:

Error executing command build: Main package must have a binary target type, not none. Cannot build.

Re: Conflicting package multi-references

Am 20.02.2014 13:28, schrieb simendsjo:

Haven't read all your links, but I think I've found a bug in the current git head.

Package 06-number-guess-defensive contains no source files. Please add {"targetType": "none"} to it's package description to avoid building it.

Then adding targetType none:

Error executing command build: Main package must have a binary target type, not none. Cannot build.

I've taken the latest source from
here and ran DUB (git
HEAD) on it without errors. Is that the right version of the package?

Re: Conflicting package multi-references

On Thu, 20 Feb 2014 14:14:08 +0100, Sönke Ludwig wrote:

Am 20.02.2014 13:28, schrieb simendsjo:

Haven't read all your links, but I think I've found a bug in the current git head.

Package 06-number-guess-defensive contains no source files. Please add {"targetType": "none"} to it's package description to avoid building it.

Then adding targetType none:

Error executing command build: Main package must have a binary target type, not none. Cannot build.

I've taken the latest source from
here and ran DUB (git
HEAD) on it without errors. Is that the right version of the package?

No, the code there is only for the released tutorials. I'm just running some tests locally before the next tutorial.
I basically moved ./source to ./cli/source, moved package.json to ./cli and added a subpackage in the main package.json.

My folder now looks like this.

package.json:

{
    "name"        : "number-guess",
    "description" : "A minimal D application.",
    "copyright"   : "Copyright © 2014, simendsjo",
    "authors"     : ["simendsjo"],

    "targetType"  : "none",
    "subPackages" : ["cli/"]
}

./cli/:

GETOPT_HELP
package.json
source/

And ./cli/package.json:

{
    "name"              : "number-guess:cli",
    "description"       : "Command line interface for the number guessing game",
    "copyright"         : "Copyright © 2014, simendsjo",
    "authors"           : ["simendsjo"],

    "stringImportPaths" : ["."],
    "targetName"        : "number-guess",
}

I downloaded the dub-registry project, but I could not see any updated documentation. Is it pending, or is it available somewhere else?

PS:
I already have one newbie video tutorial showing some dub and vibe features.
It's been posted to the G+ D group and D.learn forum.
Not sure if you also want me to add announcements in these forums or if it's unecessary..?

Re: Conflicting package multi-references

On Thu, 20 Feb 2014 13:24:51 GMT, simendsjo wrote:

On Thu, 20 Feb 2014 14:14:08 +0100, Sönke Ludwig wrote:

Am 20.02.2014 13:28, schrieb simendsjo:

Haven't read all your links, but I think I've found a bug in the current git head.

Package 06-number-guess-defensive contains no source files. Please add {"targetType": "none"} to it's package description to avoid building it.

Then adding targetType none:

Error executing command build: Main package must have a binary target type, not none. Cannot build.

I've taken the latest source from
here and ran DUB (git
HEAD) on it without errors. Is that the right version of the package?

No, the code there is only for the released tutorials. I'm just running some tests locally before the next tutorial.
I basically moved ./source to ./cli/source, moved package.json to ./cli and added a subpackage in the main package.json.

My folder now looks like this.

package.json:

{
     "name"        : "number-guess",
     "description" : "A minimal D application.",
     "copyright"   : "Copyright © 2014, simendsjo",
     "authors"     : ["simendsjo"],

     "targetType"  : "none",
     "subPackages" : ["cli/"]
}

./cli/:

GETOPT_HELP
package.json
source/

And ./cli/package.json:

{
     "name"              : "number-guess:cli",
     "description"       : "Command line interface for the number guessing game",
     "copyright"         : "Copyright © 2014, simendsjo",
     "authors"           : ["simendsjo"],

     "stringImportPaths" : ["."],
     "targetName"        : "number-guess",
}

Okay, in case the root project doesn't contain any source files, you need to build the sub package manually (either using dub build number-guess:cli or cd cli && dub build). The name of the sub package should also be just "cli". There is an enhancement request on GitHub stating that in this situation all sub modules should be built instead of the root module, but that still remains to be implemented.

I downloaded the dub-registry project, but I could not see any updated documentation. Is it pending, or is it available somewhere else?

I'll update the sub packages section before uploading the final release. I think it would also be good to start using versions for the documentation, so that there can be an up-to-date documentation for master, but that will require some reorganization work first.

PS:
I already have one newbie video tutorial showing some dub and vibe features.
It's been posted to the G+ D group and D.learn forum.

I had just noticed that and already made a little blog post to increase visibility: http://vibed.org/blog/posts/apply-your-dlang Nice work, BTW!

Not sure if you also want me to add announcements in these forums or if it's unecessary..?

Those should be sufficient, I think. If you don't mind, I'll continue to feature the videos as blog posts, as those are less volatile than forum posts and hopefully reach a slightly wider audience.

Re: Conflicting package multi-references

On Thu, 20 Feb 2014 14:32:54 GMT, Sönke Ludwig wrote:
(...)

Okay, in case the root project doesn't contain any source files, you need to build the sub package manually (either using dub build number-guess:cli or cd cli && dub build). The name of the sub package should also be just "cli". There is an enhancement request on GitHub stating that in this situation all sub modules should be built instead of the root module, but that still remains to be implemented.

I have to admit that I don't get how all the features of dub fits together after reading the documentation.
Think I'll have to re-read it a couple of times and test all the different features to see what should be used when and what problems they were created to solve.

I'll update the sub packages section before uploading the final release. I think it would also be good to start using versions for the documentation, so that there can be an up-to-date documentation for master, but that will require some reorganization work first.

A good idea.

(...)

I had just noticed that and already made a little blog post to increase visibility: http://vibed.org/blog/posts/apply-your-dlang Nice work, BTW!

Not sure if you also want me to add announcements in these forums or if it's unecessary..?

Those should be sufficient, I think. If you don't mind, I'll continue to feature the videos as blog posts, as those are less volatile than forum posts and hopefully reach a slightly wider audience.

Great. There will probably be a couple of more videos showing dub and vibe, but they will not be dedicated to dub or vibe as it's a tutorial series creating a specific application.

Re: Conflicting package multi-references

On Thu, 20 Feb 2014 14:32:54 GMT, Sönke Ludwig wrote:
(...)

I had just noticed that and already made a little blog post to increase visibility: http://vibed.org/blog/posts/apply-your-dlang Nice work, BTW!

(...)

Didn't http://vibed.org/blog used to have an rss/atom feed?
It should be added to the aggregated feed: http://planet.dsource.org/
But I cannot see any way to register sites there anyway. Might have to talk to Vladimir Panteleev directly.