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

Support for a 'package.json' type file to resolve and install/update versioned vendor dependencies? #9

Closed
kruncher opened this issue Nov 18, 2016 · 5 comments

Comments

@kruncher
Copy link

Title pretty much says it all, but something similar to the dependency resolution that is used by npm to resolve and install vendor module dependencies.

Is this something that could feasibly be added to this git plugin?

@brettlangdon
Copy link
Owner

Theoretically it is feasible, but I think it strays a bit from the original implementation quite a bit, and would probably require a rewrite of a large portion of this project.

If you are looking for a go dependency manager which uses a file like package.json to manage dependencies, there are already a few really good ones out there.

https://github.com/kardianos/govendor
https://github.com/tools/godep
https://github.com/Masterminds/glide

@kruncher
Copy link
Author

Thanks for the fast response!

I'm actually looking for a general purpose framework independent package manager that I can use with Unity 3D. Git subtree / this vendor plugin seem like they might be a great fit for this but dependency resolution would be super nice for my workflow.

I am not foo familiar with shell script; but I might have a go at implementing something on top of either this or subtree using node.js since I am rather familiar with that (and there are modules that seem like they might make this a bit easier to implement such as toposort and semver).

Nevertheless, I will take a look at the dependency managers that you very kindly linked to to see if I could use or adapt these to work for my non-go needs.

Thanks again :)

@brettlangdon
Copy link
Owner

Nice! Yeah, those dependency managers probably aren't the best fit either then, since they are go specific.

Looking back I wish I had taken a slightly different approach with this library, since it also assumes that the user is working on a go project.

If you are looking for a little more info on git-subtree:
https://brett.is/writing/about/managing-go-dependencies-with-git-subtree/
https://developer.atlassian.com/blog/2015/05/the-power-of-git-subtree/

And here are the relevant parts of this project for adding/updating/removing subtree dependencies:

Adding:

message="\
Add \"$name\" from \"$repository@$ref\"
git-vendor-name: $name
git-vendor-dir: $dir
git-vendor-repository: $repository
git-vendor-ref: $ref
"
set -x
git subtree add --prefix "$dir" --message "$message" "$repository" "$ref" --squash

Removing:

git-vendor/bin/git-vendor

Lines 192 to 193 in fe2f6cc

git rm -rf "$dir"
git commit --message "Removing \"$name\" from \"$dir\""

Updating:

git-vendor/bin/git-vendor

Lines 159 to 167 in fe2f6cc

message="\
Update \"$name\" from \"$repository@$ref\"
git-vendor-name: $name
git-vendor-dir: $dir
git-vendor-repository: $repository
git-vendor-ref: $ref
"
git subtree pull --prefix "$dir" --message "$message" "$repository" "$ref" --squash

git-subtree isn't too bad to work with once you learn the few commands you need.

@kruncher
Copy link
Author

Thank you for the detailed information :)

@brettlangdon
Copy link
Owner

@kruncher not a problem. If you don't mind, I am going to close this issue, but don't hesitate to hit with up with any questions you might have. Happy to help me@brett.is

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

2 participants