dub icon indicating copy to clipboard operation
dub copied to clipboard

Dub with local dependencies goes crazy without "version": "*"

Open MrcSnm opened this issue 2 years ago • 3 comments

System information

  • DUB version 1.28.0, built on Mar 6 2022
  • Windows 10
  • DMD32 D Compiler v2.099.0-dirty

Bug Description

Basically, I have a project with a bunch of local dependencies. They started depend each other on something like an "utils" library. Then I specify the project by doing

"dependencies": 
{
   "utils": {"path": "../utils"}
}

After adding "version": "*", it solved this problem (I needed to delete dub.selections after that)

How to reproduce?

Maybe try cloning my project and dub it https://github.com/MrcSnm/HipremeEngine

Expected Behavior

Compile?

Logs

data >=0.0.0 @modules\data depends on hipengine_api >=0.0.0 @hipreme_engine ~master depends on hipengine_api >=0.0.0 @C:\Users\Hipreme\Documents\Programming\D\HipremeEngine\api

MrcSnm avatar May 31 '22 02:05 MrcSnm

What do you define as "going crazy"? Do you not get a usable error message?

This may well be a bug in the documentation, which contradicts itself. https://dub.pm/package-format-json#version-specs:

A version specification should only be specified when no "path" attribute is present

yet

Whenever you refer to (sub) packages within the same repository, use the "any version" version specifier: "*"

Not sure how long this contradiction is in place.

I remember "version": "*" as being obligatory for dependencies with a "path" attribute, so it may have been documented differently before.

Nevertheless I agree that it is reasonable to expect Dub to default to "version": "*" for dependencies with a "path" attribute when none is given.

veelo avatar May 31 '22 19:05 veelo

This is the error I get:

data >=0.0.0 @modules\data depends on hipengine_api >=0.0.0
@hipreme_engine ~master depends on hipengine_api >=0.0.0 @C:\Users\Hipreme\Documents\Programming\D\HipremeEngine

Which usually happens when you have 2 projects which depend on different versions of the same library. So, there's 2 bugs occurring:

  1. Not defaulting to "*" 2.They both depend on >= 0.0.0. But it is as if they're not the same version, so, that bug should never occur. Probably there's other thing which is not seen being used to compare the versions

MrcSnm avatar May 31 '22 20:05 MrcSnm

note: a path based variable should not require (and even disallow) a version, as the path should always override whatever version resolution would do. This seems like a bug in the dependency resolver.

WebFreak001 avatar Aug 08 '22 13:08 WebFreak001

there was an issue with path based dependencies in submodules wrongly being resolved, which might be at play here. Should be fixed with latest DUB beta (v1.31.1-beta.1)

If it still doesn't work, feel free to reopen.

WebFreak001 avatar Feb 13 '23 12:02 WebFreak001

The bug report was for v1.28

Geod24 avatar Feb 13 '23 12:02 Geod24

I wasn't able to reproduce it by cloning HipremeEngine and checking out 8c7894394227e7866ccaf8d44e41244ff3a3b6bf (last commit before this issue date) - neither with dub upgrade, nor with dub build

WebFreak001 avatar Feb 13 '23 13:02 WebFreak001

also in v1.28 path based dependencies also resolved wrongly, it was just a different sub-issue that didn't trigger. The regression fix has also accidentally fixed other issues that were broken with 1.28 like #2261

WebFreak001 avatar Feb 13 '23 13:02 WebFreak001