pub: How to create local packages and add them to my local cache ?

601 views
Skip to first unread message

Gen

unread,
Jul 2, 2015, 5:46:07 AM7/2/15
to mi...@dartlang.org
Hi,

how can I create local packages and add them to my local pub cache ?

I have found no answer yet (https://www.dartlang.org/tools/pub)

ravi teja

unread,
Jul 2, 2015, 6:11:49 AM7/2/15
to mi...@dartlang.org
It is termed as Path packages in Dart documentation

https://www.dartlang.org/tools/pub/dependencies.html#path-packages

Basically, you just have to provide the path to the local library like this:

dependencies:
  myPackage:
    path: /path/to/myPackage



--
For other discussions, see https://groups.google.com/a/dartlang.org/
 
For HOWTO questions, visit http://stackoverflow.com/tags/dart
 
To file a bug report or feature request, go to http://www.dartbug.com/new

To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.

Gen

unread,
Jul 2, 2015, 7:25:19 AM7/2/15
to mi...@dartlang.org
Thanks for the reply.

Do you not think that pub should support a local publish and "download" of code ?

What are the current best practices for development ?
Does one use filesystem paths like in your reply ?

Günter Zöchbauer

unread,
Jul 2, 2015, 12:08:29 PM7/2/15
to mi...@dartlang.org
You can run your own pub server locally.
It is still work in progress/misses some features but AFAIK some are using it successfully.
https://github.com/dart-lang/pub-dartlang

Gen

unread,
Jul 2, 2015, 1:01:16 PM7/2/15
to mi...@dartlang.org
Thanks. I will try it.
Hopefully it is simple enough because I see that it requires the App Engine SDK for Python.

Don Olmstead

unread,
Jul 2, 2015, 7:06:47 PM7/2/15
to mi...@dartlang.org
https://github.com/dart-lang/pub_server might be a better option. It doesn't require app engine. The example directory runs a server that you can use for testing.

ravi teja

unread,
Jul 2, 2015, 10:18:07 PM7/2/15
to mi...@dartlang.org
Oh, sorry. I did not know, you wanted to run local pub server. 

For development, I prefer path packages, You dont have to pub get or upgrade every time. The changes that you make to path packages are available immediately. It seriously reduces development time. 

Don Olmstead

unread,
Jul 2, 2015, 11:12:51 PM7/2/15
to mi...@dartlang.org
I would second the path setup if you're developing a set of libraries. Pub server is when you want to release them privately.

Anders Holmgren

unread,
Jul 2, 2015, 11:20:31 PM7/2/15
to mi...@dartlang.org
Depends on if you are talking about an org that wants its own private pub repo or just one or more devs developing locally.

For the latter case I quite like path dependencies as I used to hate tracking down issues with maven caching behaving badly.

Managing these dependencies between your projects can be a pain though. That's why I created jefe

You tell it which packages are projects that you want to develop together and jefe uses that place the dependency info in your pubspecs to automate switching between path, git and hosted dependencies.

My setup for backlog.io had all 7 of my packages plus like 10 shelf ones, some dartlang ones like uri that I'm contributing to etc.

My dev loop is

>jefe start myNewFeature

this creates feature branches in all the projects and sets other dependencies

> jefe finish myNewFeature

Merges feature branch into develop branch and sets git dependencies between them

> jefe release

Publishes hosted packages and sets hosted dependencies for those
Tags and merges to master
It looks in your main lib dart file to see what packages you export and sets tighter constraints for those

My dev loop is way easier to manage now

Gen

unread,
Jul 3, 2015, 2:05:13 AM7/3/15
to mi...@dartlang.org
Thank you all for your replies.

I will have a look at the proposed solutions.

Maybe I will end up writing my own build script:
- copy libraries from network and/or local cache.
- compile the project (or library)
- copy the compiled files to network and/or local cache.

Reply all
Reply to author
Forward
0 new messages