Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

need to create packages symlink in new folders #6688

Closed
jmesserly opened this Issue · 8 comments

5 participants

@jmesserly
Collaborator

From Bob on the mailing list (search for "Cannot get import to work" thread):

"In general, when you add a new directory to your package that will contain Dart entrypoints (think "bin", "example", etc. or a subdirectory of those), then you'll need to run pub install too so that you get a "packages" directory in there too."

it would be nice if those were created automatically, either by invoking Pub or the Editor itself.

@keertip
Collaborator

Set owner to @keertip.
Added this to the M3 milestone.
Removed Type-Defect label.
Added Type-Enhancement label.

@DartBot
Collaborator

This comment was originally written by @seaneagan


Since you're not supposed to check in "packages" directories to source control, I guess "pub update" would need to scan subdirectories to see if they contain dart entry points?

Sometimes these subdirectories have completely different dependencies than the package root, for example "unittest" really is only used by the "test" subdirectory, and "tool" may need dependencies for generating code which the libraries in "lib" do not depend on at all.

So maybe the subdirectories could optionally have their own pubspec.yaml which could optionally include their parent directory as a "path dependency", and pub could create a pubspec.lock and "packages" directory in the subdirectory based on this. And then 'package:" imports could walk up the directory chain to the next directory containing a "packages" directory?

@keertip
Collaborator
@munificent
Collaborator

Since you're not supposed to check in "packages" directories to source control, I guess "pub update" would need to scan subdirectories to see if they contain dart entry points?

Right now, pub has a whitelist of directories where it will create "packages" directories for you: bin, example, test, and web. (We'll add "tool" soon.) It will add them to any subdirectories of that whitelist.

This means you may get "packages" directories in directories that don't have any entrypoints, but that's OK. We're hoping to avoid scanning for entrypoints for a couple of reasons:

  1. It's a bit more complicated. Not too bad, but we always err on the side of simplicity.
  2. We're trying to minimize the number of times you have to run pub install. If you have a directory that doesn't contain any entrypoints *yet*, but will later, it's nice if pub will put a "packages" directory in there for you pre-emptively.
@DartBot
Collaborator

This comment was originally written by howlmo...@gmail.com


Same problem!


Attachment:
Doc2.docx (159.13 KB)

@danrubel
Collaborator

Removed this from the M3 milestone.
Added this to the M4 milestone.

@keertip
Collaborator
@keertip
Collaborator

Issue #8231 has been merged into this issue.

@keertip keertip was assigned by jmesserly
@jmesserly jmesserly added this to the M4 milestone
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.