Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dub add <packagename> ignores local packages #2956

Open
gitgit3 opened this issue Jul 30, 2024 · 0 comments
Open

dub add <packagename> ignores local packages #2956

gitgit3 opened this issue Jul 30, 2024 · 0 comments

Comments

@gitgit3
Copy link

gitgit3 commented Jul 30, 2024

System information

  • DUB version 1.38.1, built on Jul 4 2024
  • Linux Mint 21 (ubuntu/debian) 5.15.0-107-generic 117-Ubuntu SMP (x86_64)

Bug Description

dub add <local_package> does not find the package.
also, "dub list" does not list local packages. The list shows only the users .dub/packages directories and ignores anything inside the local-packages.json file which might exist in that location.

It is my understanding, from the docs and some experimenting, that using dub add-local <local_package_path> will create an entry in .dub/packages/local-packages.json. So this is not really an "add" package but rather a "register" package but I digress.

So after calling:
dub add-local <local_package>
I would expect to be able to list said package by:
dub list
and I would expect to be able to add a dependency to another project by calling:
dub add <local_package>

In order to fix this, I need to edit the dub.json file and add an entry to the dependencies property:
"dependencies": {
"local_package": "~master"
},

How to reproduce?

create a new <project_dep> using dub init
create the source file <project_dep>/source<project_dep>
edit the file and add
module <project_dep>;
and also create a short test function and then:
dub build
to check you have create a lib.a file

run:
dub add-local <project_dep>
which will (should) make the project_dep available as a dependency and creates an entry in .dub/packages/local-packages.json

next create a new <project_main> using dub init
edit <project_main>/source/app.d and add the line
import <project_dep>;
and in main(), make a call to the function created in the <project_dep> project.
now run:
dub add <project_dep>

and there will be the error message
Error Could not find package 'project_dep'.

Expected Behavior

I would expect the <project_dep> to be added to dub.json as:
"dependencies": {
"local_package": "~master"
},

Indeed, if this added manually, then the project will compile using dub build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant