Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dart package dependency to subdirectory of git repo

Tags:

git

dart

dart-pub

I have a couple of small dart demo projects together in one git repository. Thus each project is in a subfolder of the repository and the yaml files of each of these projects is in the corresponding folder, not under the root of the repo. Is there a way to specify a git dependency to such a subfolder within a git repo? I know that I can clone the repository manually and use a file path in the dependency specification. But what I'm looking for is a way to have a direct git url for that package in a subdir. Is this possible?

like image 698
Gregor Avatar asked Jun 30 '14 13:06

Gregor


2 Answers

Several years on, support for this has been added:

https://github.com/dart-lang/pub/pull/1650

You can now split the git dependency into a url and path:

dependencies:
  protobuf:
    git:
      url: git://github.com/dart-lang/protobuf.git
      path: protobuf

Further reading: https://dart.dev/tools/pub/dependencies#git-packages

like image 171
Danny Tuppeny Avatar answered Oct 04 '22 14:10

Danny Tuppeny


This is the answer I got from the dev team:

"This isn't something we're planning to support. Repos should have one-to-one correspondences with packages, and the packages should be located at the top level of the repos."

This makes it difficult to use dependencies to packages in a git repository as Eclipse always uses the project root as subfolder in the repository.

like image 20
Gregor Avatar answered Oct 04 '22 13:10

Gregor