dub icon indicating copy to clipboard operation
dub copied to clipboard

PackageManager must know placement dir

Open denizzzka opened this issue 4 years ago • 4 comments

upd: For now if you try to replace PackageManager arguments (representing repositories dirs) you will catch inconsistency between provided dirs where dub will search packages and dirs where dub stores fetched packages.

This PR:

  • Removes duplicate definition of paths to local repositories
  • Adds possibility for user defined PackageManager (PR what opens this ability is coming soon)

denizzzka avatar Jul 21 '21 13:07 denizzzka

It might be a good idea to add a second package manager instance to verify that everything has been caught.

e.g. regex match packages names into a custom directory.

rikkimax avatar Jul 21 '21 13:07 rikkimax

@rikkimax can you explain more detail your idea, what problem can be solved by second PackageManager?

denizzzka avatar Jul 21 '21 13:07 denizzzka

@rikkimax can you explain more detail your idea, what problem can be solved by second PackageManager?

To verify that this change works correctly both today and will continue to work in the future.

There could be some hidden assumptions in some place that can only be found by doing this.

rikkimax avatar Jul 21 '21 13:07 rikkimax

There could be some hidden assumptions in some place that can only be found by doing this.

For now in ~master if you try to replace PackageManager arguments (representing repositories dirs) you will catch inconsistency between provided dirs where dub will search packages and dirs where dub stores fetched packages.

In this PR possibility of this is excluded - it totally removes this paths from Dub.

So, I think, it isn't necessary. Or conside this PR as bugfix :-)

denizzzka avatar Jul 21 '21 13:07 denizzzka

So, after countless refactorings of the PackageManager, I don't think it should know the default PlacementLocation. Instead, the API offers 2 possibilities:

  • Act on all possible PlacementLocation (usually reads);
  • Act on a specific PlacementLocation (usually write);

The Dub class is responsible for choosing the PlacementLocation and storing the default. Feel free to re-open if you disagree and have a use case I am not seeing.

Geod24 avatar Sep 11 '22 09:09 Geod24