dlang / dub

Package and build management system for D
MIT License
670 stars 230 forks source link

subpackage interdependency path comparison broken #485

Open John-Colvin opened 9 years ago

John-Colvin commented 9 years ago

From a dub.json where one subpackage depends on another, like so:

 13             "name": "level2",
 14             "dependencies": {
 15                 "clwrap:level1": { "path": "." }
 16             },

attempting to build level2 gives: Error executing command build: Dependency from clwrap:level2 to root package references wrong path: /Users/john/Git/John-Colvin/clWrap vs. /Users/john/Git/John-Colvin/clWrap/

It's choking on the trailing /

Easy workaround is to use "path": "./"

s-ludwig commented 9 years ago

Just a general note: The canonical way to reference sub packages within the same root package is to use the "any" placeholder: "dependencies": {"clwrap:level1": "*"}

The bug of course still remains, though. But maybe it would be good to also issue a warning to use "*" instead.

Timoses commented 6 years ago

It's really weird.

I have the following setup:

test2
    |- dub.json
    |- dep1/dub.json
    |- dep2/dub.json

and

test2/dub.json

{
    "name": "test2",
    "authors": [
        "timoses"
    ],
    "description": "A minimal D application.",
    "copyright": "Copyright © 2018, timoses",
    "license": "proprietary",

    "dependencies": {
        "test2:dep1": "*"
    },

    "subPackages": [
        "dep1",
        "dep2"
    ]

}

test2/dep1/dub.json

{
    "name": "dep1",
    "authors": [
        "timoses"
    ],
    "description": "A minimal D application.",
    "copyright": "Copyright © 2018, timoses",
    "license": "proprietary",

    "dependencies": {
        "test2:dep2": { "path": "../", "version": "*" }
    }
}

test2/dep2/dub.json

{
    "name": "dep2",
    "authors": [
        "timoses"
    ],
    "description": "A minimal D application.",
    "copyright": "Copyright © 2018, timoses",
    "license": "proprietary"
}

As it sometimes happens when I run dub in test2 folder I get:

Dependency from test2:dep to root package references wrong path: /.../test2/ vs. /.../test2/dep2/

When I change

"test2:dep2": { "path": "../", "version": "*" }

to

"test2:dep2": "*"

in dep1/dub.json I can successfully run dub in test2 (Well, now it won't work in dep1, it'll say:

Root package dep1 references unknown package test2:dep2

).

However, if I now again change it back again to

"test2:dep2": { "path": "../", "version": "*" }

I can successfully run dub in test2 and in test2/dep1....

What's going on?

dub clean and rm -rf .dub in test2 did not resolve it. Had to do the actual change described above.

$ uname -a
Linux tfdebian 4.9.0-4-amd64 #1 SMP Debian 4.9.65-3+deb9u1 (2017-12-23) x86_64 GNU/Linux
logicfish commented 5 years ago

I'm having a similar issue. The setup is the same as above. On windows, using "test2:dep2":"*" as dependency, dub upgrade works for each package but when I build the error is Non-optional dependency test2:dep1 of test2 not found in dependency tree!?. On linux the build works.